@homebridge-plugins/homebridge-eufy-security 4.6.0-beta.20 → 4.6.0-beta.22

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/.claude/CLAUDE.md CHANGED
@@ -8,6 +8,8 @@ Homebridge plugin that exposes Eufy Security devices to Apple HomeKit. Published
8
8
 
9
9
  Depends on `eufy-security-client` (upstream: bropat/eufy-security-client) for cloud API, P2P, push notifications, and MQTT communication.
10
10
 
11
+ For detailed functional requirements, device coverage, configuration options, and architecture boundaries, see `.claude/PRD.md`.
12
+
11
13
  ## Build & Dev Commands
12
14
 
13
15
  ```bash
@@ -17,9 +19,10 @@ npm run lint # eslint 'src/**/*.ts' --max-warnings=0
17
19
  npm run lint-fix # eslint with --fix
18
20
  ```
19
21
 
22
+ - No test suite -- there are no unit or integration tests
20
23
  - Output: `dist/`
21
24
  - `--max-warnings=0` is enforced -- all warnings must be fixed before committing
22
- - `@typescript-eslint/no-explicit-any` is globally disabled; do not add eslint-disable comments for it
25
+ - ESLint uses flat config (`eslint.config.mjs`); `@typescript-eslint/no-explicit-any` is globally disabled -- do not add eslint-disable comments for it
23
26
  - Run `npm run lint` and `npm run build` before pushing
24
27
 
25
28
  ## Architecture
@@ -27,11 +30,12 @@ npm run lint-fix # eslint with --fix
27
30
  Entry point `src/index.ts` registers `EufySecurityPlatform` with Homebridge. The platform class (`src/platform.ts`) is the core -- it initializes the `EufySecurity` client, discovers devices, and creates HomeKit accessories.
28
31
 
29
32
  **Accessory classes** in `src/accessories/` map Eufy device types to HomeKit services:
30
- - `CameraAccessory` -- cameras, doorbells, floodlights (handles streaming delegates)
31
- - `StationAccessory` -- base stations (security system service for arm/disarm)
32
- - `LockAccessory`, `EntrySensorAccessory`, `MotionSensorAccessory`, `SmartDropAccessory`
33
+ - `BaseAccessory.ts` -- root base class (characteristic registration, service pruning)
34
+ - `Device.ts` (`DeviceAccessory`) -- extends `BaseAccessory`; adds sensor/battery services, property helpers
35
+ - `CameraAccessory` -- cameras, doorbells, floodlights (handles streaming delegates); extends `DeviceAccessory`
36
+ - `StationAccessory` -- base stations (security system service for arm/disarm); extends `BaseAccessory` directly
37
+ - `LockAccessory`, `EntrySensorAccessory`, `MotionSensorAccessory`, `SmartDropAccessory` -- extend `DeviceAccessory`
33
38
  - `AutoSyncStationAccessory` -- virtual accessory that syncs station guard mode with HomeKit
34
- - `Device.ts` -- base class shared by all accessories
35
39
 
36
40
  **Streaming pipeline** in `src/controller/`:
37
41
  - `streamingDelegate.ts` -- HomeKit camera streaming (FFmpeg-based)
@@ -39,20 +43,19 @@ Entry point `src/index.ts` registers `EufySecurityPlatform` with Homebridge. The
39
43
  - `snapshotDelegate.ts` -- snapshot handling
40
44
  - `LocalLivestreamManager.ts` -- manages P2P livestream sessions
41
45
 
42
- **Utilities** in `src/utils/`: logging (`utils.ts`), FFmpeg wrapper (`ffmpeg.ts`), two-way audio (`Talkback.ts`).
46
+ **Utilities** in `src/utils/`: logging (`utils.ts`), FFmpeg wrapper (`ffmpeg.ts`), two-way audio (`Talkback.ts`), config schema (`configTypes.ts`), internal interfaces (`interfaces.ts`).
47
+
48
+ **Constants** in `src/settings.ts`: HKSV segment lengths, snapshot cache ages, streaming bitrate headroom, IDR intervals -- reference this when tuning streaming or recording behaviour.
43
49
 
44
- **Plugin UI** in `homebridge-ui/`: `server.js` handles UI server logic and diagnostics generation.
50
+ **Plugin UI** in `homebridge-ui/`: `server.js` (plain JS, eslint-ignored) handles UI server logic and diagnostics generation. The UI and the plugin runtime (`src/`) are **separate processes** that share state through `accessories.json` on disk (written by `src/utils/accessoriesStore.ts`, read by `homebridge-ui/server.js`). Both independently import `eufy-security-client` types (`DeviceType`, `PropertyName`, `Device`, etc.) -- changes to the device/station record shape must be kept in sync between `accessoriesStore.ts` and `server.js`.
45
51
 
46
52
  ### Key source files for device registration and triage
47
53
 
48
54
  - `src/platform.ts` (`register_device`) -- device registration logic; devices can stack multiple capabilities (independent `if` blocks, not `else if`)
49
- - `src/accessories/BaseAccessory.ts` -- characteristic registration, service pruning
50
- - `src/accessories/Device.ts` -- sensor/battery service, property helpers
51
- - `src/accessories/<Type>Accessory.ts` -- device-specific HomeKit mapping
52
55
 
53
56
  ## Key Technical Details
54
57
 
55
- - ESM project (`"type": "module"`) -- imports use `.js` extensions
58
+ - ESM project (`"type": "module"`, `"module": "NodeNext"`) -- imports must use `.js` extensions (NodeNext resolution requires explicit extensions)
56
59
  - TypeScript strict mode, ES2022 target (`noImplicitAny: false` relaxes implicit-any checks)
57
60
  - Node.js 20, 22, or 24 required
58
61
  - Homebridge >=1.9.0 or ^2.0.0-beta
@@ -131,9 +134,24 @@ When updating the `eufy-security-client` version in `package.json`:
131
134
  3. Summarize the impact in the PR body
132
135
  4. If there are breaking changes, note any required code adjustments
133
136
 
137
+ ## Skills
138
+
139
+ Skills in `.claude/skills/` provide structured workflows for common tasks:
140
+
141
+ | Skill | Purpose |
142
+ |---|---|
143
+ | `planner` | Build a step-by-step action plan with guardrails before coding |
144
+ | `developer` | Execute code changes following an approved plan or direct instructions |
145
+ | `qa` | Verify build, lint, imports, architecture, and git hygiene before pushing |
146
+ | `architect` | Quick codebase questions, mini-bug debugging, workflow improvement |
147
+ | `support` | Triage GitHub issues using diagnostics archives and logs |
148
+ | `new-device-support` | Full workflow to add a new Eufy device type across both repos |
149
+
150
+ Typical flow: **planner** -> **developer** -> **qa**. Use **architect** for exploration and **support** for issue triage.
151
+
134
152
  ## Diagnostic Triage
135
153
 
136
- For issue triage using diagnostics archives, see the full triage prompt at `.github/prompts/diag-triage.prompt.md`. For adding new device types, use the `new-device-support` skill. Key points:
154
+ For issue triage, use the `support` skill with an issue number (e.g. `/support 423`). For the full triage reference, see `.github/prompts/diag-triage.prompt.md`. For adding new device types, use the `new-device-support` skill. Key points:
137
155
 
138
156
  - Diagnostics archives are encrypted (RSA-4096 + AES-256-GCM); decrypt with `node scripts/decrypt-diagnostics.mjs <file>.tar.gz.enc`
139
157
  - Always check archive completeness before analysis -- missing runtime logs means the plugin wasn't running
package/.claude/PRD.md ADDED
@@ -0,0 +1,241 @@
1
+ # PRD -- homebridge-eufy-security
2
+
3
+ Product Requirements Document for `@homebridge-plugins/homebridge-eufy-security`.
4
+
5
+ ## Purpose
6
+
7
+ Expose Eufy Security devices to Apple HomeKit via Homebridge. Users control cameras, doorbells, locks, sensors, base stations, and delivery boxes from the Home app -- including live video, HomeKit Secure Video recording, arm/disarm, and two-way audio.
8
+
9
+ ## Target Users
10
+
11
+ Homebridge users with Eufy Security hardware who want native HomeKit integration without Eufy's official HomeKit firmware (limited or unavailable for most devices).
12
+
13
+ ## System Requirements
14
+
15
+ | Requirement | Value |
16
+ |---|---|
17
+ | Node.js | 20, 22, or 24 |
18
+ | Homebridge | >=1.9.0 or ^2.0.0-beta |
19
+ | Eufy Account | Dedicated guest account (admin accounts blocked) |
20
+ | FFmpeg | Bundled via `ffmpeg-for-homebridge` |
21
+
22
+ ---
23
+
24
+ ## Functional Requirements
25
+
26
+ ### FR-1: Device Discovery & Registration
27
+
28
+ - Connect to Eufy cloud via `eufy-security-client` (cloud API, P2P, push notifications, MQTT)
29
+ - Discover stations and devices automatically on plugin startup
30
+ - Batch device processing with 10-second debounce to avoid thrashing during sync
31
+ - Hot-add/remove devices after initial discovery completes
32
+ - Restore cached accessories across Homebridge restarts
33
+ - Prune stale cached accessories when `cleanCache: true`
34
+ - Devices can stack multiple capabilities (camera + motion sensor + doorbell) via independent registration blocks
35
+
36
+ ### FR-2: Camera Streaming
37
+
38
+ #### FR-2.1: Live Streaming
39
+ - P2P direct stream (default, low latency)
40
+ - RTSP stream (opt-in per camera)
41
+ - FFmpeg transcoding to H.264 + AAC-ELD with SRTP encryption
42
+ - Hardware encoder detection: VideoToolbox (macOS), V4L2 (Raspberry Pi), VAAPI/QSV (Linux)
43
+ - Fallback to libx264 software encoding
44
+ - Configurable max resolution, bitrate, frame rate
45
+ - Max concurrent streams per camera (default 2)
46
+ - Configurable livestream duration (default 30s, max 86400s)
47
+ - RTCP keep-alive monitoring with inactivity timeout
48
+
49
+ #### FR-2.2: HomeKit Secure Video (HKSV)
50
+ - Record motion/doorbell events as fMP4 fragments
51
+ - 4-second segment length (HomeKit requirement)
52
+ - 8-second timeshift buffer for pre-motion capture
53
+ - Audio recording (AAC-ELD or AAC-LC per HomeKit config)
54
+ - Snapshot capture during active recording
55
+ - Max 3 segment errors before connection reset
56
+
57
+ #### FR-2.3: Snapshots
58
+ - Four handling modes: AlwaysFresh, Balanced, CloudOnly (default), Auto
59
+ - Intelligent caching with configurable thresholds (fresh: 15s, balanced: 30s)
60
+ - Placeholder images for offline/disabled/unavailable states
61
+ - Cloud snapshot skip within 30s of livestream capture (prevents quality degradation)
62
+
63
+ #### FR-2.4: Two-Way Audio (Talkback)
64
+ - Bidirectional audio via duplex stream
65
+ - Caches audio data until device is ready
66
+ - 2-second silence auto-stop
67
+ - Configurable channel count (mono default)
68
+
69
+ ### FR-3: Security System (Stations)
70
+
71
+ - Map Eufy guard modes to HomeKit security states (Stay, Away, Night, Off)
72
+ - Per-station guard mode mapping (configurable numeric mode values)
73
+ - Manual alarm trigger with configurable duration and HomeKit mode filter
74
+ - Alarm arm delay and alarm event handling via push notifications
75
+ - Multi-station sync via virtual AutoSyncStationAccessory (opt-in)
76
+
77
+ ### FR-4: Locks
78
+
79
+ - Lock/unlock control via HomeKit LockMechanism service
80
+ - Lock jammed state detection via push notifications
81
+ - Lock management service (auto-security timeout, admin-only access)
82
+
83
+ ### FR-5: Sensors
84
+
85
+ #### FR-5.1: Motion Sensors
86
+ - Standalone motion detection service
87
+ - Camera-integrated motion with configurable timeout
88
+ - Multi-event support: person, pet, vehicle, sound, crying, dog, stranger
89
+
90
+ #### FR-5.2: Entry Sensors (Contact Sensors)
91
+ - Door/window open/closed state
92
+
93
+ ### FR-6: Doorbells
94
+
95
+ - ProgrammableSwitchEvent on ring
96
+ - Optional motion-triggers-doorbell mode
97
+ - Optional indoor chime control switch
98
+ - Snapshot delay on doorbell ring (configurable)
99
+
100
+ ### FR-7: Floodlights
101
+
102
+ - Lightbulb service for floodlight control
103
+ - Combined camera + light capabilities
104
+
105
+ ### FR-8: Smart Drop (Package Boxes)
106
+
107
+ - One-way open via LockMechanism
108
+ - Package delivery detection via ContactSensor
109
+
110
+ ### FR-9: Per-Device Switches
111
+
112
+ - Enable/disable device switch
113
+ - Motion detection toggle switch
114
+ - Light control switch (floodlights)
115
+ - Indoor chime toggle switch
116
+ - All switches individually configurable per camera
117
+
118
+ ---
119
+
120
+ ## Configuration Requirements
121
+
122
+ ### CR-1: Global Configuration
123
+ - Eufy credentials (username, password, device name)
124
+ - Country code (ISO 3166-1 alpha-2)
125
+ - Polling interval (default 10 minutes)
126
+ - Global guard mode mapping (hkHome, hkAway, hkNight, hkOff)
127
+ - Device/station ignore lists by serial number
128
+ - Debug logging toggle (`enableDetailedLogging`)
129
+ - Log file opt-out (`omitLogFiles`)
130
+ - Cache cleanup toggle (`cleanCache`, default true)
131
+ - Auto-sync station mode toggle
132
+ - Embedded PKCS1 support toggle (Node.js <24.5 workaround)
133
+
134
+ ### CR-2: Per-Camera Configuration
135
+ - Stream source: P2P or RTSP
136
+ - Enable/disable camera streaming entirely
137
+ - Snapshot handling method (AlwaysFresh, Balanced, CloudOnly, Auto)
138
+ - Audio enable/disable
139
+ - Talkback enable/disable with channel count
140
+ - HKSV recording duration
141
+ - Motion timeout
142
+ - Per-switch visibility (enable, motion, light, indoor chime)
143
+ - Full FFmpeg video config override (codec, resolution, bitrate, filters, encoder options, custom binary path)
144
+
145
+ ### CR-3: Per-Station Configuration
146
+ - Guard mode mapping overrides (hkHome, hkAway, hkNight, hkOff)
147
+ - Manual alarm trigger modes and duration
148
+
149
+ ---
150
+
151
+ ## Plugin UI Requirements
152
+
153
+ ### UI-1: Device Discovery
154
+ - Login flow with TFA and captcha support
155
+ - Discovery progress reporting (authenticating, queuing, processing, done)
156
+ - Skip button for unsupported device intel wait
157
+ - Admin account detection and blocking
158
+
159
+ ### UI-2: Device Management
160
+ - Display discovered stations and devices with type, capabilities, power status
161
+ - Show unsupported devices separately
162
+ - Detect running plugin via heartbeat (accessories.json `storedAt` < 90s old)
163
+ - Load stored accessories from cache when plugin is not running
164
+
165
+ ### UI-3: Diagnostics
166
+ - Generate encrypted diagnostics archive (RSA-4096 + AES-256-GCM)
167
+ - Rate-limited to 60-second minimum between downloads
168
+ - Archive includes: config (sanitized), all log files, accessories.json, system info
169
+ - Decryptable via `node scripts/decrypt-diagnostics.mjs`
170
+
171
+ ### UI-4: Storage Management
172
+ - Reset plugin storage (persistent.json, accessories.json)
173
+ - Clean all storage option
174
+ - System info endpoint (plugin version, Node.js version, host OS)
175
+
176
+ ---
177
+
178
+ ## Non-Functional Requirements
179
+
180
+ ### NFR-1: Logging
181
+ - Rotating file streams (daily rotation, max 3 archives, 200MB limit)
182
+ - Styled console output (color-coded by level)
183
+ - Debug mode adds file:line references and library-level logging
184
+ - Separate log streams: plugin, library, UI server, UI library, FFmpeg (global + per-camera + snapshots)
185
+
186
+ ### NFR-2: Reliability
187
+ - Connection retry (3 attempts, 30s backoff) on Eufy cloud failure
188
+ - P2P stream retry with exponential backoff (2-10s, max 3 attempts, 15s timeout per attempt)
189
+ - Multi-consumer stream sharing via reference counting (streaming, recording, snapshots share one P2P connection)
190
+ - 5-second grace period before stopping shared P2P stream
191
+ - Node.js MaxListeners raised to 30 for multi-camera setups
192
+ - fMP4 box validation (max 50MB per box) during HKSV recording
193
+
194
+ ### NFR-3: Compatibility
195
+ - ESM module (`"type": "module"`, `"module": "NodeNext"`)
196
+ - TypeScript strict mode, ES2022 target
197
+ - PKCS1 padding workaround for Node.js 20/22 (restored natively in Node.js 24.5+)
198
+ - Hardware codec probing at startup with graceful software fallback
199
+
200
+ ### NFR-4: Security
201
+ - Encrypted credential persistence (never logged)
202
+ - Guest account enforcement (admin account usage blocked)
203
+ - TFA/captcha graceful handling with shutdown and re-auth prompt
204
+ - Diagnostics archives encrypted before export
205
+
206
+ ---
207
+
208
+ ## Architecture Boundaries
209
+
210
+ ### homebridge-eufy-security (this plugin)
211
+ - Accessory registration and HomeKit service mapping
212
+ - FFmpeg transcoding pipeline
213
+ - Configuration handling and validation
214
+ - Plugin UI (device discovery, diagnostics, storage management)
215
+ - accessories.json persistence for UI communication
216
+
217
+ ### eufy-security-client (upstream dependency)
218
+ - Eufy cloud API authentication and communication
219
+ - P2P connection establishment and stream management
220
+ - Push notification and MQTT event handling
221
+ - Device type classification and property management
222
+ - Command execution (arm/disarm, lock/unlock, etc.)
223
+
224
+ Issues must be triaged to the correct layer. The plugin communicates with the library via events (`station added`, `device added`, `property changed`, push events) and commands.
225
+
226
+ ---
227
+
228
+ ## Device Type Coverage
229
+
230
+ | Category | HomeKit Services |
231
+ |---|---|
232
+ | Cameras | CameraRTPStreamManagement, MotionSensor, optional Switches |
233
+ | Doorbells | Doorbell + Camera services, ProgrammableSwitchEvent |
234
+ | Floodlights | Camera + Lightbulb services |
235
+ | Base Stations | SecuritySystem (arm/disarm), optional manual alarm Switch |
236
+ | Smart Locks | LockMechanism, LockManagement |
237
+ | Entry Sensors | ContactSensor |
238
+ | Motion Sensors | MotionSensor |
239
+ | Smart Drop | LockMechanism (open-only), ContactSensor (package detect) |
240
+ | Video Locks | Camera + Lock services (LockWifiVideo) |
241
+ | Auto-Sync Station | Virtual SecuritySystem syncing multiple stations |
@@ -0,0 +1,76 @@
1
+ ---
2
+ name: architect
3
+ description: Answer quick architectural questions, debug mini-issues, explore the codebase, and help improve skills and workflows. Use this skill when the user asks "how does X work", "where is Y", "why does Z happen", wants to understand code flow, trace a bug through the system, or asks about the relationship between components. Also use when the user wants to improve an existing skill or refine development workflows. This is the lightweight, exploratory counterpart to the planner -- use it for questions and small fixes, not multi-file changes.
4
+ ---
5
+
6
+ # Architect
7
+
8
+ You are an architectural advisor for homebridge-eufy-security. You answer questions quickly, trace code paths, debug small issues, and help refine the development workflow. You are the "thinking" mode -- fast, focused, and precise.
9
+
10
+ Refer to CLAUDE.md for the full architecture and project conventions.
11
+
12
+ ## What you do
13
+
14
+ ### Codebase exploration
15
+
16
+ When the user asks "how does X work" or "where is Y":
17
+
18
+ 1. Search the codebase (Glob, Grep) to find the relevant code
19
+ 2. Read the key files
20
+ 3. Explain the flow concisely with file:line references
21
+ 4. Draw the path through the system if it crosses multiple files
22
+
23
+ Quick-reference starting points:
24
+
25
+ | Question | Start here |
26
+ |---|---|
27
+ | Device discovery? | `src/platform.ts` -- `onStationAdded`, `onDeviceAdded`, `register_device` |
28
+ | Streaming? | `src/controller/streamingDelegate.ts` -> `LocalLivestreamManager.ts` |
29
+ | HKSV recording? | `src/controller/recordingDelegate.ts` |
30
+ | Snapshots? | `src/controller/snapshotDelegate.ts` |
31
+ | UI <-> plugin? | `src/utils/accessoriesStore.ts` -> `homebridge-ui/server.js` |
32
+ | Arm/disarm? | `src/accessories/StationAccessory.ts` |
33
+ | Two-way audio? | `src/utils/Talkback.ts` |
34
+
35
+ ### Mini-bug debugging
36
+
37
+ For small, contained bugs:
38
+
39
+ 1. Reproduce the understanding -- what's expected vs what happens?
40
+ 2. Trace the code path from trigger to symptom
41
+ 3. Identify the root cause with file:line reference
42
+ 4. If it's a one-line fix, suggest it directly
43
+ 5. If it's bigger, recommend using the planner skill
44
+
45
+ ### Skill and workflow improvement
46
+
47
+ When the user wants to refine skills or workflows:
48
+
49
+ 1. Read the current skill/workflow file
50
+ 2. Identify what's working and what's not based on user feedback
51
+ 3. Suggest specific, minimal changes
52
+ 4. Apply changes after user approval
53
+
54
+ ### Quick code review
55
+
56
+ When asked to review code or a diff:
57
+
58
+ 1. Focus on correctness, not style
59
+ 2. Check the architectural boundaries (plugin vs eufy-security-client)
60
+ 3. Flag potential issues with file:line references
61
+ 4. Don't nitpick -- only flag things that could break or confuse
62
+
63
+ ## How to respond
64
+
65
+ - Be concise. Use file:line references.
66
+ - Show the relevant code snippet when it helps understanding.
67
+ - If the answer requires reading more than 3-4 files, use subagents for parallel exploration.
68
+ - If the question turns into a multi-file change request, suggest switching to the planner skill.
69
+ - If you're unsure, say so. Don't speculate about code you haven't read.
70
+
71
+ ## What you don't do
72
+
73
+ - Don't make multi-file code changes (use planner -> developer)
74
+ - Don't run builds or lint (use QA skill)
75
+ - Don't create PRs or push code (use the git workflow directly)
76
+ - Don't write lengthy essays -- keep answers tight and actionable
@@ -0,0 +1,59 @@
1
+ ---
2
+ name: developer
3
+ description: Execute code changes following an approved plan or direct user instructions. Use this skill when the user says "implement", "code it", "go ahead", "execute the plan", or when transitioning from the planner skill after approval. Also use for direct coding tasks where the user provides clear, specific instructions. This skill writes clean, correct code respecting all project conventions.
4
+ ---
5
+
6
+ # Developer
7
+
8
+ You are a code execution agent for homebridge-eufy-security. You write code that is clean, correct, and follows every project convention. You either execute an approved plan from the planner skill, or implement direct user instructions.
9
+
10
+ Follow all conventions in CLAUDE.md (ESM imports, lint, architecture patterns, code style, git workflow).
11
+
12
+ ## Before writing any code
13
+
14
+ 1. **Read first**: Read every file you intend to modify. Understand existing patterns before touching them.
15
+ 2. **Check the plan**: If a plan was approved, follow it exactly. If you spot an issue with the plan during implementation, stop and flag it -- don't silently deviate.
16
+ 3. **Branch check**: Verify you're on the correct branch per CLAUDE.md git workflow.
17
+
18
+ ## Implementation workflow
19
+
20
+ ### Step 1 -- Write the code
21
+
22
+ Make changes file by file, following the plan order. For each file:
23
+ - Use the Edit tool for modifications (not Bash with sed/awk)
24
+ - Use Write only for new files
25
+ - Keep changes minimal and focused
26
+ - Don't add features beyond what was requested
27
+ - Don't refactor surrounding code while fixing a bug
28
+
29
+ ### Step 2 -- Self-review
30
+
31
+ After all changes are made, re-read each modified file to verify:
32
+ - No syntax errors
33
+ - Imports use `.js` extensions
34
+ - No accidental duplicate code
35
+ - Changes match the plan
36
+
37
+ ### Step 3 -- Verify
38
+
39
+ ```bash
40
+ npm run lint
41
+ npm run build
42
+ ```
43
+
44
+ If either fails, fix the issue immediately. Do not commit code that doesn't lint or build.
45
+
46
+ ### Step 4 -- Commit
47
+
48
+ Follow the git workflow from CLAUDE.md. Stage each logical change individually.
49
+
50
+ ## Chaining
51
+
52
+ After committing, automatically invoke the **qa** skill to verify the changes before pushing. Do not wait for the user to ask -- QA is part of the development flow.
53
+
54
+ ## When things go wrong
55
+
56
+ - **Lint failure**: Fix the warning. Don't disable the rule.
57
+ - **Build failure**: Read the error. If it's a type error, trace it back. If it's an import error, check `.js` extensions.
58
+ - **Plan doesn't work**: Stop. Explain what you found. Don't improvise a workaround without user approval.
59
+ - **Unclear requirement**: Ask. Don't guess.
@@ -99,35 +99,22 @@ Execute the plan. Key implementation notes:
99
99
  - **Companion custom properties**: Some properties have required companions with `custom_*` keys that never appear in raw device data (they're populated at runtime). The script detects these and marks them with `⚠ companion`. Always include them — omitting a companion breaks functionality silently. Key pairs: `DeviceRTSPStream` → `DeviceRTSPStreamUrl`, `DeviceWifiRSSI` → `DeviceWifiSignalLevel`, `DeviceCellularRSSI` → `DeviceCellularSignalLevel`.
100
100
  - **Insert in order**: When adding to enums, switch statements, or `if` chains, maintain numeric ordering by device type number.
101
101
  - **Audio recording property**: Different device families use different audio recording property constants (e.g. `DeviceAudioRecordingProperty`, `DeviceAudioRecordingStarlight4gLTEProperty`). Match the closest existing device.
102
- - **No Co-Authored-By**: Do not add co-author lines to commits.
103
102
 
104
103
  ## Phase 4 — Build & Lint Verification
105
104
 
106
- Run these in parallel:
107
- ```bash
108
- cd eufy-security-client && npm run build
109
- cd homebridge-eufy-security && npm run build
110
- ```
111
-
112
- Then verify lint:
113
- ```bash
114
- cd eufy-security-client && npm run lint
115
- cd homebridge-eufy-security && npm run lint
116
- ```
117
-
118
- Note: eufy-security-client lint may fail due to a pre-existing `jiti` library issue unrelated to our changes. The TypeScript build succeeding is sufficient validation.
105
+ Run build and lint for both repos. Note: eufy-security-client lint may fail due to a pre-existing `jiti` library issue unrelated to our changes — the TypeScript build succeeding is sufficient validation.
119
106
 
120
107
  ## Phase 5 — Git & PR
121
108
 
122
- ### eufy-security-client
109
+ Follow CLAUDE.md Git Workflow for commit messages, branch naming, and PR body format. This skill creates **two PRs** across repos:
110
+
111
+ ### eufy-security-client (cross-fork)
123
112
 
124
- 1. Discard any unrelated changes (e.g. `package-lock.json`)
125
- 2. Sync develop with upstream: `git fetch upstream && git checkout develop && git merge upstream/develop`
126
- 3. Create branch: `git checkout -b feat/<device-slug>`
127
- 4. Stage only relevant files (images (should match the `<device-slug>`), `src/http/types.ts`, `src/http/device.ts`, `src/push/service.ts`, `docs/supported_devices.md`)
128
- 5. Commit: `git commit -m "feat: add <Device Name> (<Model>, type <number>) support"`
129
- 6. Push: `git push origin feat/<device-slug>`
130
- 7. Create cross-fork PR:
113
+ 1. Discard unrelated changes (e.g. `package-lock.json`)
114
+ 2. Sync develop: `git fetch upstream && git checkout develop && git merge upstream/develop`
115
+ 3. Branch: `git checkout -b feat/<device-slug>`
116
+ 4. Stage only: images, `src/http/types.ts`, `src/http/device.ts`, `src/push/service.ts`, `docs/supported_devices.md`
117
+ 5. Cross-fork PR:
131
118
  ```bash
132
119
  gh pr create --repo bropat/eufy-security-client --base develop \
133
120
  --head lenoxys:feat/<device-slug> \
@@ -137,26 +124,9 @@ Note: eufy-security-client lint may fail due to a pre-existing `jiti` library is
137
124
 
138
125
  ### homebridge-eufy-security
139
126
 
140
- 1. Branch from the current beta branch (check with `git branch`): `git checkout -b feat/<device-slug>`
127
+ 1. Branch from current beta: `git checkout -b feat/<device-slug>`
141
128
  2. Stage: `homebridge-ui/public/utils/device-images.js` + any added image
142
- 3. Commit: `git commit -m "feat: add <Device Name> (<Model>, type <number>) device image mapping"`
143
- 4. Push: `git push origin feat/<device-slug>`
144
- 5. Create PR:
145
- ```bash
146
- gh pr create --repo homebridge-plugins/homebridge-eufy-security \
147
- --base <beta-branch> \
148
- --title "feat: add <Device Name> (<Model>, type <number>) device image" \
149
- --body-file /tmp/pr-body-<branch>.md
150
- ```
151
-
152
- ### PR body format
153
-
154
- Write PR bodies to `/tmp/pr-body-<branch>.md` files. Include:
155
- - `## Summary` — bullet points describing the changes
156
- - Cross-references: `Closes homebridge-plugins/homebridge-eufy-security#<issue>` in the client PR, `Closes #<issue>` in the plugin PR
157
- - `Depends on bropat/eufy-security-client#<pr>` in the plugin PR
158
- - `## Test plan` — checklist of verification steps
159
129
 
160
- ### Link the issue
130
+ ### Cross-referencing
161
131
 
162
- After both PRs are created, update both PR bodies so they reference the issue with closing keywords.
132
+ After both PRs are created, update both bodies so they reference each other.
@@ -0,0 +1,100 @@
1
+ ---
2
+ name: planner
3
+ description: Build a precise, step-by-step action plan before making any code changes. Use this skill whenever the user describes a feature, bug fix, refactor, or any multi-file change. Also use when the user says "plan", "think through", "what would it take", or describes a problem without jumping to code. TRIGGER BEFORE writing any code for non-trivial changes. Do not skip planning for changes that touch more than one file or involve architectural decisions.
4
+ ---
5
+
6
+ # Planner
7
+
8
+ You are a planning agent for homebridge-eufy-security. Your job is to produce a detailed, reviewable action plan BEFORE any code is written. The plan is a contract -- once the user approves it, the developer skill executes it.
9
+
10
+ Follow all project conventions from CLAUDE.md (architecture, ESM imports, lint, build, git workflow). Use the Architecture section to trace impact across files.
11
+
12
+ ## When to plan
13
+
14
+ Always plan when:
15
+ - The change touches more than one file
16
+ - A new device type, accessory, or service is being added
17
+ - The change involves the streaming pipeline or recording delegates
18
+ - Configuration schema changes are needed
19
+ - The change crosses the plugin/eufy-security-client boundary
20
+
21
+ Skip planning (just do it) when:
22
+ - Single-line typo or constant fix
23
+ - The user explicitly says "just do it" or "quick fix"
24
+
25
+ ## Planning process
26
+
27
+ ### Step 1 -- Understand the goal
28
+
29
+ Read the relevant source files before planning. Never plan based on assumptions about code you haven't read. Identify:
30
+
31
+ - What is the user trying to achieve?
32
+ - Is this a bug fix, feature, refactor, or chore?
33
+ - Does this touch homebridge-eufy-security only, or also eufy-security-client?
34
+
35
+ ### Step 2 -- Identify affected files
36
+
37
+ List every file that needs to change. For each file, note:
38
+ - What section/function changes
39
+ - Why it changes
40
+ - Dependencies on other changes in the plan
41
+
42
+ ### Step 3 -- Define guardrails
43
+
44
+ For every plan, explicitly state:
45
+ - **Lint**: Will this pass `npm run lint` (zero warnings)?
46
+ - **Build**: Will `npm run build` succeed?
47
+ - **ESM**: Do new imports use `.js` extensions?
48
+ - **Breaking changes**: Does this change config schema, public behavior, or require user action?
49
+ - **Boundary**: Is any part of this change in the wrong layer? (plugin vs eufy-security-client)
50
+
51
+ ### Step 4 -- Sequence the work
52
+
53
+ Order the changes so each step is independently buildable where possible. Group related changes into commits following the git workflow in CLAUDE.md.
54
+
55
+ ### Step 5 -- Present the plan
56
+
57
+ Output the plan in this format:
58
+
59
+ ```
60
+ ## Plan: <title>
61
+
62
+ ### Goal
63
+ <one sentence>
64
+
65
+ ### Changes
66
+
67
+ 1. **<file path>** -- <what and why>
68
+ - <specific function/section>
69
+ - <detail>
70
+
71
+ 2. **<file path>** -- <what and why>
72
+ ...
73
+
74
+ ### Guardrails
75
+ - [ ] Lint passes
76
+ - [ ] Build passes
77
+ - [ ] ESM imports correct
78
+ - [ ] No breaking config changes (or: breaking change documented)
79
+ - [ ] Correct architectural layer
80
+
81
+ ### Commits
82
+ 1. `feat: <message>` -- files: <list>
83
+ 2. `fix: <message>` -- files: <list>
84
+
85
+ ### Risks / Open questions
86
+ - <anything uncertain that needs user input>
87
+ ```
88
+
89
+ Wait for the user to approve, modify, or reject before proceeding.
90
+
91
+ ## Chaining
92
+
93
+ When the user approves the plan (says "go", "looks good", "approved", "do it", etc.), immediately invoke the **developer** skill to execute it. Pass the approved plan as context -- do not ask the user to repeat it.
94
+
95
+ ## What NOT to do
96
+
97
+ - Never start editing files during planning
98
+ - Never assume device properties without reading raw data or existing code
99
+ - Never plan changes to `src/version.ts` (auto-generated)
100
+ - Never plan changes that mix plugin and eufy-security-client in one commit
@@ -0,0 +1,79 @@
1
+ ---
2
+ name: qa
3
+ description: Verify that code changes are correct, safe, and ready to ship. Use this skill after implementing changes, before pushing or creating a PR. Also use when the user says "check", "verify", "review", "QA", "is this ready", or when you want to validate work done by the developer skill. Runs build, lint, and structural checks.
4
+ ---
5
+
6
+ # QA / Verification
7
+
8
+ You are a quality assurance agent for homebridge-eufy-security. Your job is to verify that changes are correct, complete, and safe before they ship. You are thorough but not pedantic -- focus on things that break, not style preferences.
9
+
10
+ Refer to CLAUDE.md for all project conventions (build commands, ESM rules, architecture boundaries, git workflow, dependency policy).
11
+
12
+ ## Verification checklist
13
+
14
+ Run through these checks in order. Stop at the first failure and report it.
15
+
16
+ ### 1. Build verification
17
+
18
+ Run `npm run lint` and `npm run build`. Both must pass with zero errors and zero warnings.
19
+
20
+ ### 2. Import verification
21
+
22
+ Check all new or modified imports for `.js` extensions (NodeNext), resolution to real files, and circular imports.
23
+
24
+ ### 3. Architectural boundary check
25
+
26
+ For each changed file, verify:
27
+ - Plugin code uses the eufy-security-client public API (events, commands, property accessors), not internal methods
28
+ - `homebridge-ui/server.js` and `src/utils/accessoriesStore.ts` are in sync if device/station record shapes changed
29
+ - No HomeKit service logic leaked into base classes that shouldn't have it
30
+
31
+ ### 4. Configuration safety
32
+
33
+ If config schema changed (`src/utils/configTypes.ts`): defaults set for new options, existing configs still work, `config.schema.json` updated if applicable.
34
+
35
+ ### 5. Streaming pipeline check
36
+
37
+ If streaming code changed (`src/controller/`): valid FFmpeg arguments, correct SRTP handling, clean stream lifecycle, concurrent stream limits respected.
38
+
39
+ ### 6. Git hygiene
40
+
41
+ Per CLAUDE.md git workflow: correct branch, commit message conventions, no Co-Authored-By, no unrelated files staged, correct `eufy-security-client` dependency for the branch.
42
+
43
+ ### 7. Diff review
44
+
45
+ Read the full diff and check for: accidental debug logging, hardcoded values that should be in `src/settings.ts`, missing `override` keyword, new eslint-disable comments.
46
+
47
+ ## Output format
48
+
49
+ ```
50
+ ## QA Report
51
+
52
+ ### Status: PASS / FAIL
53
+
54
+ ### Checks
55
+ - [x] Build passes
56
+ - [x] Lint passes (0 warnings)
57
+ - [x] ESM imports correct
58
+ - [x] Architecture boundaries respected
59
+ - [ ] Config schema -- ISSUE: <description>
60
+ - [x] Git hygiene
61
+
62
+ ### Issues found
63
+ 1. **<severity>**: <description> -- <file>:<line>
64
+
65
+ ### Ready to push: YES / NO
66
+ ```
67
+
68
+ ## Chaining
69
+
70
+ - **If QA passes**: Ask the user if they want to push and/or create a PR.
71
+ - **If QA fails**: Fix issues that are safe to fix silently (typos, missing `.js` extensions). For anything else, report the failure and loop back to the developer skill to address it.
72
+
73
+ ## When to flag vs fix
74
+
75
+ - **Typos in your own changes**: Fix silently
76
+ - **Missing `.js` extension**: Fix silently
77
+ - **Architectural issue**: Flag to user, don't fix without approval
78
+ - **Potential breaking change**: Flag to user with impact assessment
79
+ - **Pre-existing issues unrelated to current changes**: Note but don't fix (avoid scope creep)
@@ -0,0 +1,175 @@
1
+ ---
2
+ name: support
3
+ description: Triage a GitHub issue using diagnostics archives and logs. Use this skill when the user provides a GitHub issue number or URL, says "triage", "diagnose", "look at this issue", "check this bug report", or wants to analyze a diagnostics archive. Handles decryption, log analysis, device identification, root cause narrowing, label suggestions, and drafting issue comments.
4
+ ---
5
+
6
+ # Support / Issue Triage
7
+
8
+ You are a support triage agent for homebridge-eufy-security. Given a GitHub issue, you decrypt diagnostics, analyze logs, identify root causes, and draft user-facing responses.
9
+
10
+ Refer to CLAUDE.md for label recommendations, issue comment guidelines, and diagnostic triage basics.
11
+
12
+ ## Input
13
+
14
+ The user provides `$ARGUMENTS` as either:
15
+ - A GitHub issue number (e.g. `423`)
16
+ - A GitHub issue URL (e.g. `https://github.com/homebridge-plugins/homebridge-eufy-security/issues/423`)
17
+
18
+ ## Step 1 -- Fetch the issue
19
+
20
+ ```bash
21
+ gh issue view <number> --repo homebridge-plugins/homebridge-eufy-security
22
+ ```
23
+
24
+ Extract:
25
+ - What the user reports (symptoms, expected vs actual behavior)
26
+ - Device model/type if mentioned
27
+ - Plugin version if mentioned
28
+ - Whether a diagnostics archive is attached
29
+
30
+ If no diagnostics attached, draft a comment asking the user to export diagnostics with debug mode enabled and stop.
31
+
32
+ ## Step 2 -- Download and decrypt diagnostics
33
+
34
+ Download the `.tar.gz.enc` attachment, then:
35
+
36
+ ```bash
37
+ node scripts/decrypt-diagnostics.mjs <file>.tar.gz.enc
38
+ ```
39
+
40
+ The script prints the archive creation date. Note if the archive is older than 90 days -- data may be stale.
41
+
42
+ ## Step 3 -- Validate archive completeness
43
+
44
+ List the extracted files and check what's present:
45
+
46
+ | File | Required for |
47
+ |---|---|
48
+ | `accessories.json` | All issues |
49
+ | `eufy-security.log` | Runtime issues |
50
+ | `eufy-lib.log` | Runtime issues |
51
+ | `configui-server.log` | UI issues |
52
+ | `configui-lib.log` | UI issues |
53
+ | `ffmpeg.log` | Streaming/snapshot issues |
54
+ | `ffmpeg-<serial>.log` | Per-camera streaming issues |
55
+ | `ffmpeg-snapshots.log` | Snapshot issues |
56
+ | `unsupported.json` | Device support requests |
57
+
58
+ **Stop conditions:**
59
+ - Runtime logs missing (`eufy-security.log`, `eufy-lib.log`) -- ask user to restart Homebridge, wait for full load, re-export
60
+ - Only `accessories.json` present -- archive incomplete, can only confirm device presence
61
+
62
+ ## Step 4 -- Check debug mode
63
+
64
+ In `eufy-security.log`, check the first lines:
65
+ - **Debug ON**: log level `DEBUG`, file/line references (e.g. `platform.ts:311`), logger name includes version (e.g. `[EufySecurity-4.4.2-beta.41]`)
66
+ - **Debug OFF**: log level starts at `INFO`, no file/line refs, logger name is just `[EufySecurity]`
67
+
68
+ Also check config dump for `"enableDetailedLogging":true`.
69
+
70
+ If debug is disabled, ask the user to enable `Detailed Logging` in plugin settings and re-export. Label `debug log missing`.
71
+
72
+ ## Step 5 -- Extract environment
73
+
74
+ From the first lines of `eufy-security.log`:
75
+ - Plugin version
76
+ - eufy-security-client version
77
+ - Node.js version
78
+ - OS and architecture
79
+
80
+ **HOOBS check**: If the environment indicates HOOBS (storage path, OS, or user mentions it), label `hoobs` + `wontfix`, comment, and close per CLAUDE.md guidelines.
81
+
82
+ **Node.js check**: Plugin requires Node.js 20, 22, or 24. If on an unsupported version, note it.
83
+
84
+ **PKCS1 check**: Node.js 24.5+ has native PKCS1 support -- `enableEmbeddedPKCS1Support` workaround is unnecessary. For Node.js 20/22, the embedded fallback is still needed.
85
+
86
+ ## Step 6 -- Check config for excluded devices
87
+
88
+ From the config dump in `eufy-security.log`:
89
+ - `ignoreDevices` -- serial numbers excluded
90
+ - `ignoreStations` -- station serials excluded
91
+ - `cleanCache` -- stale accessory pruning
92
+
93
+ In `accessories.json`:
94
+ - `disabled: true` on a station -- its devices won't load
95
+ - `ignored: true` on a device -- excluded
96
+ - `unsupported: true` -- device type not supported
97
+
98
+ ## Step 7 -- Confirm device presence
99
+
100
+ Search `accessories.json` for the reported device by type, model, serial, or name. Note: `type`, `isCamera`, `isSmartDrop`, `isLock`, `isDoorbell`, `DeviceEnabled`, `standalone`.
101
+
102
+ ## Step 8 -- Analyze logs
103
+
104
+ ### Runtime issues (`eufy-security.log`)
105
+ - Device discovery: search for device name/serial, `register_device`
106
+ - Discovery warnings: `[DISCOVERY WARNING]`, `[DEVICE SKIP]`, `[STATION SKIP]`
107
+ - Accessory instantiation: `Constructed`, `REGISTER CHARACTERISTIC`, `SEED`
108
+ - Service pruning: `Pruning unused service`
109
+ - Property events: `Property Changes`, `ON '...`
110
+ - Errors: `Error`, stack traces
111
+
112
+ ### Library issues (`eufy-lib.log`)
113
+ - Device serial presence -- did the library load it?
114
+ - `property changed` events
115
+ - Connection/authentication errors
116
+ - Push notification handling
117
+
118
+ ### Boundary determination
119
+
120
+ | Symptom | Layer |
121
+ |---|---|
122
+ | Device missing from `eufy-lib.log` or API errors | `eufy-security-client` |
123
+ | Device loads in library but fails in accessory registration | `homebridge-eufy-security` |
124
+ | P2P/push/MQTT failures | `eufy-security-client` |
125
+ | HomeKit service wrong or missing | `homebridge-eufy-security` |
126
+ | Config not applied | `homebridge-eufy-security` |
127
+
128
+ ### Streaming issues
129
+
130
+ Check per-camera FFmpeg log (`ffmpeg-<serial>.log`) first -- it isolates that camera's stderr. Look for codec errors, resolution mismatches, connection failures.
131
+
132
+ If logs are insufficient for livestream issues, consider requesting temporary device sharing:
133
+
134
+ ```
135
+ To validate a fix and avoid back-and-forth log exchanges, I'd need to test against an actual <device model> device. Would you be willing to temporarily share your device with the following Eufy account?
136
+
137
+ homebridge.eufy.sec@gmail.com
138
+
139
+ Please also let me know which country your account is registered in.
140
+
141
+ This is entirely optional -- no obligation. I understand sharing device access requires trust. The access would only be used for debugging and can be revoked at any time once testing is complete.
142
+ ```
143
+
144
+ ## Step 9 -- Cross-reference with code
145
+
146
+ If needed, read the relevant source to confirm behavior. Use the Architecture section in CLAUDE.md to locate the right files.
147
+
148
+ ## Step 10 -- Produce triage report
149
+
150
+ Output:
151
+
152
+ ```
153
+ ## Triage: #<issue-number> -- <title>
154
+
155
+ ### Environment
156
+ - Plugin: <version>
157
+ - eufy-security-client: <version>
158
+ - Node.js: <version>
159
+ - OS: <os>
160
+
161
+ ### Root cause
162
+ <concise explanation with file:line references if applicable>
163
+
164
+ ### Layer
165
+ homebridge-eufy-security / eufy-security-client / configuration issue / inconclusive
166
+
167
+ ### Suggested labels
168
+ <comma-separated labels from CLAUDE.md label table>
169
+
170
+ ### Suggested action
171
+ <what to do next: fix, upstream issue, request more info, close>
172
+
173
+ ### Draft comment
174
+ <user-facing comment ready to post -- formal, concise, first person, simple language, no jargon>
175
+ ```
package/dist/version.js CHANGED
@@ -1,2 +1,2 @@
1
- export const LIB_VERSION = "4.6.0-beta.20";
1
+ export const LIB_VERSION = "4.6.0-beta.22";
2
2
  //# sourceMappingURL=version.js.map
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "displayName": "Homebridge Eufy Security",
3
3
  "name": "@homebridge-plugins/homebridge-eufy-security",
4
- "version": "4.6.0-beta.20",
4
+ "version": "4.6.0-beta.22",
5
5
  "description": "Control Eufy Security from homebridge.",
6
6
  "type": "module",
7
7
  "license": "Apache-2.0",