node-switchbot 4.0.0-beta.0 → 4.0.0-beta.10
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/.github/copilot-instructions.md +19 -5
- package/BLE.md +117 -4
- package/CHANGELOG.md +45 -0
- package/README.md +7 -1
- package/dist/api.d.ts +3 -3
- package/dist/api.d.ts.map +1 -1
- package/dist/api.js +9 -6
- package/dist/api.js.map +1 -1
- package/dist/ble.d.ts +38 -4
- package/dist/ble.d.ts.map +1 -1
- package/dist/ble.js +409 -53
- package/dist/ble.js.map +1 -1
- package/dist/devices/base.d.ts +83 -5
- package/dist/devices/base.d.ts.map +1 -1
- package/dist/devices/base.js +371 -34
- package/dist/devices/base.js.map +1 -1
- package/dist/devices/device-override-state-during-connection.d.ts +27 -0
- package/dist/devices/device-override-state-during-connection.d.ts.map +1 -0
- package/dist/devices/device-override-state-during-connection.js +45 -0
- package/dist/devices/device-override-state-during-connection.js.map +1 -0
- package/dist/devices/index.d.ts +4 -0
- package/dist/devices/index.d.ts.map +1 -1
- package/dist/devices/index.js +4 -0
- package/dist/devices/index.js.map +1 -1
- package/dist/devices/sequence-device.d.ts +36 -0
- package/dist/devices/sequence-device.d.ts.map +1 -0
- package/dist/devices/sequence-device.js +75 -0
- package/dist/devices/sequence-device.js.map +1 -0
- package/dist/devices/wo-air-purifier.d.ts +2 -2
- package/dist/devices/wo-air-purifier.d.ts.map +1 -1
- package/dist/devices/wo-air-purifier.js +2 -2
- package/dist/devices/wo-air-purifier.js.map +1 -1
- package/dist/devices/wo-bulb.d.ts +10 -0
- package/dist/devices/wo-bulb.d.ts.map +1 -1
- package/dist/devices/wo-bulb.js +69 -0
- package/dist/devices/wo-bulb.js.map +1 -1
- package/dist/devices/wo-curtain.d.ts +3 -3
- package/dist/devices/wo-curtain.d.ts.map +1 -1
- package/dist/devices/wo-curtain.js +12 -9
- package/dist/devices/wo-curtain.js.map +1 -1
- package/dist/devices/wo-hand.d.ts +53 -2
- package/dist/devices/wo-hand.d.ts.map +1 -1
- package/dist/devices/wo-hand.js +121 -3
- package/dist/devices/wo-hand.js.map +1 -1
- package/dist/devices/wo-lock-pro.d.ts +11 -2
- package/dist/devices/wo-lock-pro.d.ts.map +1 -1
- package/dist/devices/wo-lock-pro.js +65 -3
- package/dist/devices/wo-lock-pro.js.map +1 -1
- package/dist/devices/wo-lock.d.ts +7 -2
- package/dist/devices/wo-lock.d.ts.map +1 -1
- package/dist/devices/wo-lock.js +58 -3
- package/dist/devices/wo-lock.js.map +1 -1
- package/dist/devices/wo-plug-mini-us.d.ts +2 -2
- package/dist/devices/wo-plug-mini-us.d.ts.map +1 -1
- package/dist/devices/wo-plug-mini-us.js +2 -2
- package/dist/devices/wo-plug-mini-us.js.map +1 -1
- package/dist/devices/wo-relay-switch-1.d.ts +4 -2
- package/dist/devices/wo-relay-switch-1.d.ts.map +1 -1
- package/dist/devices/wo-relay-switch-1.js +36 -4
- package/dist/devices/wo-relay-switch-1.js.map +1 -1
- package/dist/devices/wo-relay-switch-2pm.d.ts +21 -0
- package/dist/devices/wo-relay-switch-2pm.d.ts.map +1 -0
- package/dist/devices/wo-relay-switch-2pm.js +39 -0
- package/dist/devices/wo-relay-switch-2pm.js.map +1 -0
- package/dist/devices/wo-rgbic-bulb.d.ts +29 -0
- package/dist/devices/wo-rgbic-bulb.d.ts.map +1 -0
- package/dist/devices/wo-rgbic-bulb.js +84 -0
- package/dist/devices/wo-rgbic-bulb.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/settings.d.ts +17 -0
- package/dist/settings.d.ts.map +1 -1
- package/dist/settings.js +18 -1
- package/dist/settings.js.map +1 -1
- package/dist/switchbot.d.ts +7 -0
- package/dist/switchbot.d.ts.map +1 -1
- package/dist/switchbot.js +109 -40
- package/dist/switchbot.js.map +1 -1
- package/dist/types/ble.d.ts +20 -1
- package/dist/types/ble.d.ts.map +1 -1
- package/dist/types/ble.js.map +1 -1
- package/dist/types/device.d.ts +30 -3
- package/dist/types/device.d.ts.map +1 -1
- package/dist/types/index.d.ts +22 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js.map +1 -1
- package/dist/utils/bot-ble.d.ts +36 -0
- package/dist/utils/bot-ble.d.ts.map +1 -0
- package/dist/utils/bot-ble.js +109 -0
- package/dist/utils/bot-ble.js.map +1 -0
- package/dist/utils/circuit-breaker.d.ts +98 -0
- package/dist/utils/circuit-breaker.d.ts.map +1 -0
- package/dist/utils/circuit-breaker.js +187 -0
- package/dist/utils/circuit-breaker.js.map +1 -0
- package/dist/utils/connection-tracker.d.ts +66 -0
- package/dist/utils/connection-tracker.d.ts.map +1 -0
- package/dist/utils/connection-tracker.js +184 -0
- package/dist/utils/connection-tracker.js.map +1 -0
- package/dist/utils/fallback-handler.d.ts +68 -0
- package/dist/utils/fallback-handler.d.ts.map +1 -0
- package/dist/utils/fallback-handler.js +131 -0
- package/dist/utils/fallback-handler.js.map +1 -0
- package/dist/utils/index.d.ts +10 -0
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +41 -4
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/retry.d.ts +55 -0
- package/dist/utils/retry.d.ts.map +1 -0
- package/dist/utils/retry.js +95 -0
- package/dist/utils/retry.js.map +1 -0
- package/docs/assets/hierarchy.js +1 -1
- package/docs/assets/navigation.js +1 -1
- package/docs/assets/search.js +1 -1
- package/docs/classes/APIError.html +2 -2
- package/docs/classes/APINotAvailableError.html +2 -2
- package/docs/classes/BLEConnection.html +16 -10
- package/docs/classes/BLENotAvailableError.html +2 -2
- package/docs/classes/BLEScanner.html +11 -9
- package/docs/classes/CommandFailedError.html +2 -2
- package/docs/classes/ConnectionTimeoutError.html +2 -2
- package/docs/classes/DeviceManager.html +13 -13
- package/docs/classes/DeviceNotFoundError.html +2 -2
- package/docs/classes/DeviceOverrideStateDuringConnection.html +56 -0
- package/docs/classes/DiscoveryError.html +2 -2
- package/docs/classes/OpenAPIClient.html +24 -24
- package/docs/classes/SequenceDevice.html +58 -0
- package/docs/classes/SwitchBot.html +12 -11
- package/docs/classes/SwitchBotDevice.html +43 -15
- package/docs/classes/SwitchBotError.html +2 -2
- package/docs/classes/ValidationError.html +2 -2
- package/docs/classes/WoAirPurifier.html +48 -18
- package/docs/classes/WoAirPurifierTable.html +48 -18
- package/docs/classes/WoBlindTilt.html +48 -20
- package/docs/classes/WoBulb.html +52 -19
- package/docs/classes/WoCeilingLight.html +52 -19
- package/docs/classes/WoContact.html +42 -14
- package/docs/classes/WoCurtain.html +46 -18
- package/docs/classes/WoHand.html +63 -19
- package/docs/classes/WoHub2.html +42 -14
- package/docs/classes/WoHub3.html +42 -14
- package/docs/classes/WoHumi.html +46 -18
- package/docs/classes/WoHumi2.html +46 -18
- package/docs/classes/WoIOSensorTH.html +42 -14
- package/docs/classes/WoKeypad.html +42 -14
- package/docs/classes/WoLeak.html +42 -14
- package/docs/classes/WoPlugMiniJP.html +45 -17
- package/docs/classes/WoPlugMiniUS.html +45 -17
- package/docs/classes/WoPresence.html +42 -14
- package/docs/classes/WoRelaySwitch1.html +47 -17
- package/docs/classes/WoRelaySwitch1PM.html +47 -17
- package/docs/classes/WoRemote.html +42 -14
- package/docs/classes/WoSensorTH.html +42 -14
- package/docs/classes/WoSensorTHPlus.html +42 -14
- package/docs/classes/WoSensorTHPro.html +42 -14
- package/docs/classes/WoSensorTHProCO2.html +42 -14
- package/docs/classes/WoSmartLock.html +49 -16
- package/docs/classes/WoSmartLockPro.html +52 -17
- package/docs/classes/WoStrip.html +52 -19
- package/docs/enums/LogLevel.html +2 -2
- package/docs/enums/SwitchBotBLEModel.html +2 -2
- package/docs/enums/SwitchBotBLEModelName.html +2 -2
- package/docs/functions/updateBaseURL.html +1 -1
- package/docs/hierarchy.html +1 -1
- package/docs/index.html +2 -2
- package/docs/interfaces/APICommandRequest.html +2 -2
- package/docs/interfaces/APICommandResponse.html +2 -2
- package/docs/interfaces/APIDevice.html +2 -2
- package/docs/interfaces/APIDeviceStatus.html +2 -2
- package/docs/interfaces/APIErrorResponse.html +2 -2
- package/docs/interfaces/APIResponse.html +2 -2
- package/docs/interfaces/AirPurifierCommands.html +2 -2
- package/docs/interfaces/AirPurifierServiceData.html +20 -5
- package/docs/interfaces/AirPurifierStatus.html +7 -7
- package/docs/interfaces/BLEAdvertisement.html +3 -2
- package/docs/interfaces/BLEScanOptions.html +5 -5
- package/docs/interfaces/BLEServiceData.html +22 -5
- package/docs/interfaces/BlindTiltCommands.html +2 -2
- package/docs/interfaces/BlindTiltServiceData.html +21 -5
- package/docs/interfaces/BlindTiltStatus.html +6 -6
- package/docs/interfaces/BotCommands.html +6 -2
- package/docs/interfaces/BotServiceData.html +20 -5
- package/docs/interfaces/BotStatus.html +6 -6
- package/docs/interfaces/BulbCommands.html +4 -2
- package/docs/interfaces/BulbServiceData.html +21 -5
- package/docs/interfaces/BulbStatus.html +6 -6
- package/docs/interfaces/CeilingLightCommands.html +4 -2
- package/docs/interfaces/CeilingLightServiceData.html +21 -5
- package/docs/interfaces/CeilingLightStatus.html +6 -6
- package/docs/interfaces/CommandResult.html +6 -6
- package/docs/interfaces/ContactServiceData.html +22 -5
- package/docs/interfaces/ContactStatus.html +6 -6
- package/docs/interfaces/CurtainCommands.html +2 -2
- package/docs/interfaces/CurtainServiceData.html +22 -5
- package/docs/interfaces/CurtainStatus.html +6 -6
- package/docs/interfaces/DeviceInfo.html +23 -13
- package/docs/interfaces/DeviceListResponse.html +2 -2
- package/docs/interfaces/DeviceStatus.html +6 -6
- package/docs/interfaces/DiscoveryOptions.html +7 -7
- package/docs/interfaces/HubServiceData.html +22 -5
- package/docs/interfaces/HubStatus.html +6 -6
- package/docs/interfaces/HumidifierCommands.html +2 -2
- package/docs/interfaces/HumidifierServiceData.html +23 -6
- package/docs/interfaces/HumidifierStatus.html +6 -6
- package/docs/interfaces/KeypadStatus.html +6 -6
- package/docs/interfaces/LeakServiceData.html +22 -5
- package/docs/interfaces/LeakStatus.html +6 -6
- package/docs/interfaces/LockCommands.html +6 -2
- package/docs/interfaces/LockServiceData.html +20 -6
- package/docs/interfaces/LockStatus.html +6 -6
- package/docs/interfaces/MeterServiceData.html +22 -5
- package/docs/interfaces/MeterStatus.html +6 -6
- package/docs/interfaces/MotionServiceData.html +22 -5
- package/docs/interfaces/MotionStatus.html +6 -6
- package/docs/interfaces/PlugCommands.html +2 -2
- package/docs/interfaces/PlugServiceData.html +21 -5
- package/docs/interfaces/PlugStatus.html +6 -6
- package/docs/interfaces/PresenceServiceData.html +22 -5
- package/docs/interfaces/PresenceStatus.html +6 -6
- package/docs/interfaces/RelaySwitchCommands.html +2 -2
- package/docs/interfaces/RelaySwitchServiceData.html +21 -5
- package/docs/interfaces/RelaySwitchStatus.html +6 -6
- package/docs/interfaces/RemoteStatus.html +6 -6
- package/docs/interfaces/SceneListResponse.html +2 -2
- package/docs/interfaces/StripCommands.html +4 -2
- package/docs/interfaces/StripServiceData.html +21 -5
- package/docs/interfaces/StripStatus.html +6 -6
- package/docs/interfaces/SwitchBotConfig.html +21 -9
- package/docs/interfaces/WebhookConfig.html +2 -2
- package/docs/interfaces/WebhookDetails.html +2 -2
- package/docs/interfaces/WebhookQueryResponse.html +2 -2
- package/docs/interfaces/WebhookSetupResponse.html +2 -2
- package/docs/media/BLE.md +117 -4
- package/docs/modules.html +1 -1
- package/docs/types/ConnectionType.html +1 -1
- package/docs/types/PhysicalDeviceType.html +1 -1
- package/docs/types/VirtualDeviceType.html +1 -1
- package/docs/variables/urls.html +1 -1
- package/package.json +12 -8
- package/tmp-switchbot-scan.mjs +79 -0
- package/todo/PYSWITCHBOT_COMPARISON.md +484 -0
- package/todo/README.md +68 -0
- package/todo/completed.md +134 -0
- package/todo/todo.md +296 -0
- package/tsconfig.build.json +17 -0
- package/PRODUCTION_READY.md +0 -135
|
@@ -0,0 +1,484 @@
|
|
|
1
|
+
# pySwitchBot Comparison - Implementation Roadmap
|
|
2
|
+
|
|
3
|
+
Comprehensive comparison between pySwitchBot (Python) and node-switchbot (TypeScript/Node.js) based on repository analysis performed on March 7, 2026.
|
|
4
|
+
|
|
5
|
+
## 🔍 Discovery & Advertisement Parsing
|
|
6
|
+
|
|
7
|
+
### Current Gap
|
|
8
|
+
- **pySwitchBot**: 50+ dedicated device parsers extracting detailed status from advertisements without connection
|
|
9
|
+
- **node-switchbot**: Basic model identification, requires connection for detailed status
|
|
10
|
+
|
|
11
|
+
### Implementation Tasks
|
|
12
|
+
|
|
13
|
+
#### High Priority
|
|
14
|
+
- [ ] **Task 1.1**: Create dedicated advertisement parser per device type in `src/devices/`
|
|
15
|
+
- Bot: Extract `switchMode`, `isOn`, `battery` from advertisements
|
|
16
|
+
- Curtain: Extract `calibration`, `inMotion`, `position`, `lightLevel`, `deviceChain`
|
|
17
|
+
- Lock: Extract `sequence_number`, `status`, `door_open`, alarms, `night_latch`
|
|
18
|
+
- Meter: Extract temperature, humidity, battery
|
|
19
|
+
- Relay Switch: Extract `sequence_number`, `isOn`, `channel2_isOn`
|
|
20
|
+
|
|
21
|
+
- [ ] **Task 1.2**: Implement manufacturer data extraction priority
|
|
22
|
+
- Check service data first (UUID `fd3d`)
|
|
23
|
+
- Fall back to manufacturer data (IDs: 2409, 741, 89)
|
|
24
|
+
- Merge data from both sources
|
|
25
|
+
|
|
26
|
+
- [ ] **Task 1.3**: Add model-to-MAC caching system
|
|
27
|
+
- Cache discovered device models
|
|
28
|
+
- Speed up subsequent scans
|
|
29
|
+
- Store in DeviceManager
|
|
30
|
+
|
|
31
|
+
#### Medium Priority
|
|
32
|
+
- [ ] **Task 1.4**: Enhance advertisement data structure
|
|
33
|
+
- Add `rawAdvData` field
|
|
34
|
+
- Add `isEncrypted` flag
|
|
35
|
+
- Add `modelFriendlyName` field
|
|
36
|
+
|
|
37
|
+
- [ ] **Task 1.5**: Add advertisement data merging
|
|
38
|
+
- Preserve old values when new data is None
|
|
39
|
+
- Recursive dict merging for nested structures
|
|
40
|
+
- Implement `_merge_data()` helper
|
|
41
|
+
|
|
42
|
+
## 🎮 Control Commands Enhancement
|
|
43
|
+
|
|
44
|
+
### Bot (WoHand) Commands
|
|
45
|
+
|
|
46
|
+
#### High Priority
|
|
47
|
+
- [ ] **Task 2.1**: Add `setMode(mode: 'switch' | 'press')` command
|
|
48
|
+
- Switch mode: Toggle on/off
|
|
49
|
+
- Press mode: Momentary press
|
|
50
|
+
- Command: `0x57 0x0F 0x47 0x01 MODE` (MODE: 0x00=press, 0x01=switch)
|
|
51
|
+
|
|
52
|
+
- [ ] **Task 2.2**: Add `setLongPress(duration: number)` command
|
|
53
|
+
- Configure press duration (1-255 deciseconds)
|
|
54
|
+
- Command: `0x57 0x0F 0x47 0x03 DURATION`
|
|
55
|
+
|
|
56
|
+
- [ ] **Task 2.3**: Add direct arm control
|
|
57
|
+
- `handUp()` - Raise arm
|
|
58
|
+
- `handDown()` - Lower arm
|
|
59
|
+
- More precise than toggle
|
|
60
|
+
|
|
61
|
+
### Curtain Commands
|
|
62
|
+
|
|
63
|
+
#### High Priority
|
|
64
|
+
- [ ] **Task 3.1**: Add speed parameter to movement commands
|
|
65
|
+
- `open(speed?: number)` - Speed 1-255 (default: 255)
|
|
66
|
+
- `close(speed?: number)` - Speed 1-255
|
|
67
|
+
- `setPosition(position: number, speed?: number)` - Position with speed
|
|
68
|
+
- Command: `0x57 0x0F 0x45 0x01 0x05 MODE SPEED POSITION`
|
|
69
|
+
|
|
70
|
+
- [ ] **Task 3.2**: Add Curtain 3 specific commands
|
|
71
|
+
- Support Curtain 3 model detection
|
|
72
|
+
- Implement multi-command sequences
|
|
73
|
+
- Add extended info retrieval
|
|
74
|
+
|
|
75
|
+
#### Medium Priority
|
|
76
|
+
- [ ] **Task 3.3**: Add `getExtendedInfo()` command
|
|
77
|
+
- Returns device chain information
|
|
78
|
+
- Grouped curtain status
|
|
79
|
+
- Command: `0x57 0x0F 0x46 0x01`
|
|
80
|
+
|
|
81
|
+
### Lock Commands
|
|
82
|
+
|
|
83
|
+
#### High Priority
|
|
84
|
+
- [ ] **Task 4.1**: Add `unlockWithoutUnlatch()` command
|
|
85
|
+
- EU firmware feature
|
|
86
|
+
- Unlocks without unlatching door
|
|
87
|
+
- Command: Different from standard unlock
|
|
88
|
+
|
|
89
|
+
- [ ] **Task 4.2**: Implement notification handling
|
|
90
|
+
- Subscribe to lock notifications
|
|
91
|
+
- Real-time status updates
|
|
92
|
+
- Handle unsolicited notifications
|
|
93
|
+
|
|
94
|
+
- [ ] **Task 4.3**: Add smart lock state detection
|
|
95
|
+
- Check current state before sending command
|
|
96
|
+
- Avoid unnecessary unlock/lock commands
|
|
97
|
+
- Return early if already in target state
|
|
98
|
+
|
|
99
|
+
#### Medium Priority
|
|
100
|
+
- [ ] **Task 4.4**: Add `getLockInfo()` command
|
|
101
|
+
- Get detailed lock configuration
|
|
102
|
+
- Battery, firmware, settings
|
|
103
|
+
- Command: `0x57 0x02`
|
|
104
|
+
|
|
105
|
+
### Relay Switch (1PM/2PM) Commands
|
|
106
|
+
|
|
107
|
+
#### High Priority
|
|
108
|
+
- [ ] **Task 5.1**: Add `toggle()` command
|
|
109
|
+
- Toggle current state
|
|
110
|
+
- Command: `0x57 0x0F 0x50 0x01 0x01 0x02`
|
|
111
|
+
|
|
112
|
+
- [ ] **Task 5.2**: Implement power monitoring
|
|
113
|
+
- `getBasicInfo()` - Returns voltage, current, power, energy
|
|
114
|
+
- Parse response: 11 bytes with power data at specific offsets
|
|
115
|
+
- Command: `0x57 0x02`
|
|
116
|
+
|
|
117
|
+
- [ ] **Task 5.3**: Add channel-specific control (2PM model)
|
|
118
|
+
- `setChannel1(state: boolean)`
|
|
119
|
+
- `setChannel2(state: boolean)`
|
|
120
|
+
- Detect 2PM vs 1PM model
|
|
121
|
+
|
|
122
|
+
#### Medium Priority
|
|
123
|
+
- [ ] **Task 5.4**: Add time/energy tracking
|
|
124
|
+
- `getCurrentTimeAndStartTime()` - For energy calculations
|
|
125
|
+
- Command: `0x57 0x0F 0x51 0x01 0x05 0x01 0x00 0x00 0x00`
|
|
126
|
+
|
|
127
|
+
- [ ] **Task 5.5**: Add garage door opener support
|
|
128
|
+
- Variant of relay switch
|
|
129
|
+
- Specific command sequences
|
|
130
|
+
- Model: SwitchBot Relay Switch (garage mode)
|
|
131
|
+
|
|
132
|
+
### Light (Bulb/Strip) Commands
|
|
133
|
+
|
|
134
|
+
#### High Priority
|
|
135
|
+
- [ ] **Task 6.1**: Add effect presets (20+ effects)
|
|
136
|
+
- Christmas, Halloween, Sunset, Rainbow, etc.
|
|
137
|
+
- Command: `0x57 0x0F 0x47 0x01 EFFECT_ID 0xFF SPEED 0x00 0x00 0x00`
|
|
138
|
+
- Effect IDs: 0x00-0x13 (20 effects)
|
|
139
|
+
- Speed: 0x01 (slow) to 0x64 (fast)
|
|
140
|
+
|
|
141
|
+
- [ ] **Task 6.2**: Add RGBIC segmented control
|
|
142
|
+
- Control individual LED segments
|
|
143
|
+
- RGBIC-specific effects
|
|
144
|
+
- Multi-zone color control
|
|
145
|
+
|
|
146
|
+
#### Medium Priority
|
|
147
|
+
- [ ] **Task 6.3**: Add color temperature with min/max
|
|
148
|
+
- `setColorTemp(minTemp: number, maxTemp: number, temp: number)`
|
|
149
|
+
- Command: `0x57 0x0F 0x47 0x01 0x17 BRIGHTNESS MIN_KEL MAX_KEL TEMP`
|
|
150
|
+
|
|
151
|
+
- [ ] **Task 6.4**: Implement multi-command sequences
|
|
152
|
+
- Send multiple commands in series
|
|
153
|
+
- Used for complex light patterns
|
|
154
|
+
- Support for Strip Light 3
|
|
155
|
+
|
|
156
|
+
### Humidifier Commands
|
|
157
|
+
|
|
158
|
+
#### High Priority
|
|
159
|
+
- [ ] **Task 7.1**: Add humidity level control
|
|
160
|
+
- `setLevel(level: number)` - Set target humidity (1-100)
|
|
161
|
+
- Command: `0x57 0x0F 0xXX 0x01 LEVEL` (XX varies by model)
|
|
162
|
+
|
|
163
|
+
- [ ] **Task 7.2**: Add mode control
|
|
164
|
+
- `setAuto()` - Automatic mode
|
|
165
|
+
- `setManual()` - Manual mode
|
|
166
|
+
- Get target humidity level
|
|
167
|
+
|
|
168
|
+
### Air Purifier Commands
|
|
169
|
+
|
|
170
|
+
#### High Priority
|
|
171
|
+
- [ ] **Task 8.1**: Add preset modes
|
|
172
|
+
- Modes: `level_1`, `level_2`, `level_3`, `auto`, `sleep`, `pet`
|
|
173
|
+
- `setPresetMode(mode: string)`
|
|
174
|
+
- Command: `0x57 0x0F 0x4E 0x01 MODE_ID`
|
|
175
|
+
|
|
176
|
+
- [ ] **Task 8.2**: Add status with AQI/PM2.5
|
|
177
|
+
- Parse air quality index from response
|
|
178
|
+
- PM2.5 levels
|
|
179
|
+
- Fan speed and mode
|
|
180
|
+
|
|
181
|
+
### Vacuum Commands
|
|
182
|
+
|
|
183
|
+
#### High Priority
|
|
184
|
+
- [ ] **Task 9.1**: Implement vacuum device classes
|
|
185
|
+
- K10+, K10+ Pro, K10+ Pro Combo
|
|
186
|
+
- K11+, K20
|
|
187
|
+
- S10, S20
|
|
188
|
+
|
|
189
|
+
- [ ] **Task 9.2**: Add basic vacuum commands
|
|
190
|
+
- `cleanUp(protocolVersion: number)` - Start cleaning
|
|
191
|
+
- `returnToDock(protocolVersion: number)` - Return to base
|
|
192
|
+
- Support protocol versions 1 and 2
|
|
193
|
+
|
|
194
|
+
- [ ] **Task 9.3**: Add vacuum status getters
|
|
195
|
+
- Battery level
|
|
196
|
+
- Work status (cleaning, returning, docked, etc.)
|
|
197
|
+
- Dustbin status
|
|
198
|
+
- Network status
|
|
199
|
+
|
|
200
|
+
## 📊 Status & Response Parsing
|
|
201
|
+
|
|
202
|
+
### Advertisement-Based Status (No Connection Required)
|
|
203
|
+
|
|
204
|
+
#### High Priority
|
|
205
|
+
- [ ] **Task 10.1**: Implement passive status from advertisements
|
|
206
|
+
- Parse device state from BLE advertisements
|
|
207
|
+
- No connection needed for basic status
|
|
208
|
+
- Cache last known state
|
|
209
|
+
|
|
210
|
+
- [ ] **Task 10.2**: Add sequence number tracking
|
|
211
|
+
- Monitor `sequence_number` in advertisements
|
|
212
|
+
- Auto-trigger status update when sequence changes
|
|
213
|
+
- Implement for: locks, relay switches, vacuums, air purifiers
|
|
214
|
+
|
|
215
|
+
#### Medium Priority
|
|
216
|
+
- [ ] **Task 10.3**: Add calibration status tracking
|
|
217
|
+
- Parse calibration bit from advertisements
|
|
218
|
+
- Track for: curtains, blind tilts
|
|
219
|
+
- Warn if device not calibrated
|
|
220
|
+
|
|
221
|
+
- [ ] **Task 10.4**: Add direction detection for covers
|
|
222
|
+
- Track `_is_opening` / `_is_closing` states
|
|
223
|
+
- Update based on position changes
|
|
224
|
+
- Help UI show proper icons
|
|
225
|
+
|
|
226
|
+
### Response Validation
|
|
227
|
+
|
|
228
|
+
#### High Priority
|
|
229
|
+
- [ ] **Task 11.1**: Add byte-by-byte response validation
|
|
230
|
+
- Check response length
|
|
231
|
+
- Validate specific byte positions
|
|
232
|
+
- Compare against expected value sets: `{1}`, `{1, 5}`, `{1, 6}`
|
|
233
|
+
|
|
234
|
+
- [ ] **Task 11.2**: Implement password detection
|
|
235
|
+
- Check for `0x07` (password required)
|
|
236
|
+
- Check for `0x09` (password incorrect)
|
|
237
|
+
- Throw specific authentication errors
|
|
238
|
+
|
|
239
|
+
## 🆕 New Device Types to Add
|
|
240
|
+
|
|
241
|
+
### High Priority Devices
|
|
242
|
+
|
|
243
|
+
#### Vacuum Cleaners
|
|
244
|
+
- [ ] **Task 12.1**: K10+ Vacuum
|
|
245
|
+
- [ ] **Task 12.2**: K10+ Pro Vacuum
|
|
246
|
+
- [ ] **Task 12.3**: K10+ Pro Combo Vacuum
|
|
247
|
+
- [ ] **Task 12.4**: K11+ Vacuum
|
|
248
|
+
- [ ] **Task 12.5**: K20 Vacuum
|
|
249
|
+
- [ ] **Task 12.6**: S10 Vacuum
|
|
250
|
+
- [ ] **Task 12.7**: S20 Vacuum
|
|
251
|
+
|
|
252
|
+
#### Lock Variants
|
|
253
|
+
- [ ] **Task 13.1**: Lock Lite
|
|
254
|
+
- [ ] **Task 13.2**: Lock Vision
|
|
255
|
+
- [ ] **Task 13.3**: Lock Vision Pro
|
|
256
|
+
- [ ] **Task 13.4**: Lock Pro WiFi
|
|
257
|
+
|
|
258
|
+
#### Relay Switches
|
|
259
|
+
- [ ] **Task 14.1**: Relay Switch 2PM
|
|
260
|
+
- [ ] **Task 14.2**: Garage Door Opener (relay variant)
|
|
261
|
+
|
|
262
|
+
### Medium Priority Devices
|
|
263
|
+
|
|
264
|
+
#### Climate Control
|
|
265
|
+
- [ ] **Task 15.1**: Evaporative Humidifier (WoHumi2) - Already exists, enhance
|
|
266
|
+
- [ ] **Task 15.2**: Circulator Fan (Battery/USB)
|
|
267
|
+
- [ ] **Task 15.3**: Smart Thermostat Radiator
|
|
268
|
+
- [ ] **Task 15.4**: Climate Panel
|
|
269
|
+
|
|
270
|
+
#### Lighting
|
|
271
|
+
- [ ] **Task 16.1**: Strip Light 3
|
|
272
|
+
- [ ] **Task 16.2**: Floor Lamp
|
|
273
|
+
- [ ] **Task 16.3**: RGBICWW Strip Light
|
|
274
|
+
- [ ] **Task 16.4**: RGBICWW Floor Lamp
|
|
275
|
+
- [ ] **Task 16.5**: Art Frame
|
|
276
|
+
|
|
277
|
+
#### Other
|
|
278
|
+
- [ ] **Task 17.1**: Plug Mini EU - Already exists, verify
|
|
279
|
+
- [ ] **Task 17.2**: Roller Shade
|
|
280
|
+
- [ ] **Task 17.3**: Keypad Vision
|
|
281
|
+
- [ ] **Task 17.4**: Keypad Vision Pro
|
|
282
|
+
- [ ] **Task 17.5**: Hub3 - Already exists, enhance
|
|
283
|
+
- [ ] **Task 17.6**: HubMini Matter
|
|
284
|
+
|
|
285
|
+
**Total New Devices:** ~30+ device types/variants to add or enhance
|
|
286
|
+
|
|
287
|
+
## 🔐 Encryption & Security
|
|
288
|
+
|
|
289
|
+
### High Priority
|
|
290
|
+
|
|
291
|
+
- [ ] **Task 18.1**: Implement GCM encryption mode
|
|
292
|
+
- AES128-GCM cipher support
|
|
293
|
+
- 12-byte IV for GCM (vs 16-byte for CTR)
|
|
294
|
+
- Include 2-byte authentication tag
|
|
295
|
+
- Skip auth verification (firmware returns partial tag)
|
|
296
|
+
|
|
297
|
+
- [ ] **Task 18.2**: Add automatic encryption mode detection
|
|
298
|
+
- Detect CTR vs GCM from device response
|
|
299
|
+
- Command: `0x57 0x0F 0x21 0x03 KEY_ID` to get IV
|
|
300
|
+
- Parse response to determine mode
|
|
301
|
+
|
|
302
|
+
- [ ] **Task 18.3**: Implement IV increment for GCM
|
|
303
|
+
- Increment IV after each encrypted command
|
|
304
|
+
- Reset IV on reconnection
|
|
305
|
+
- Track current IV state
|
|
306
|
+
|
|
307
|
+
- [ ] **Task 18.4**: Add encryption for relay switches
|
|
308
|
+
- Newer relay switches require encryption
|
|
309
|
+
- Same key retrieval process as locks
|
|
310
|
+
|
|
311
|
+
- [ ] **Task 18.5**: Add encryption for air purifiers
|
|
312
|
+
- Newer air purifiers require encryption
|
|
313
|
+
- Command encryption for all control commands
|
|
314
|
+
|
|
315
|
+
- [ ] **Task 18.6**: Add encryption for light strips
|
|
316
|
+
- Newer light strips require encryption
|
|
317
|
+
- Effect commands need encryption
|
|
318
|
+
|
|
319
|
+
### Medium Priority
|
|
320
|
+
|
|
321
|
+
- [ ] **Task 18.7**: Add encryption state reset on disconnect
|
|
322
|
+
- Clear IV, cipher, encryption mode
|
|
323
|
+
- Re-initialize on next connection
|
|
324
|
+
- Handle firmware updates that change encryption
|
|
325
|
+
|
|
326
|
+
- [ ] **Task 18.8**: Implement key verification
|
|
327
|
+
- `verifyEncryptionKey()` - Test key validity
|
|
328
|
+
- Try commands with key before assuming valid
|
|
329
|
+
- Better error messages for invalid keys
|
|
330
|
+
|
|
331
|
+
## ⚠️ Error Handling
|
|
332
|
+
|
|
333
|
+
### High Priority
|
|
334
|
+
|
|
335
|
+
- [ ] **Task 19.1**: Add specific BLE exceptions
|
|
336
|
+
- `SwitchbotOperationError` - Operation failures
|
|
337
|
+
- `SwitchbotAuthenticationError` - Auth failures
|
|
338
|
+
- `CharacteristicMissingError` - BLE characteristic missing
|
|
339
|
+
|
|
340
|
+
- [ ] **Task 19.2**: Implement command result verification
|
|
341
|
+
- `checkCommandResult()` validates response bytes
|
|
342
|
+
- Expected value sets: `{1}`, `{1, 5}`, `{1, 6}`
|
|
343
|
+
- Throw errors with hex result, index, expected values, RSSI
|
|
344
|
+
|
|
345
|
+
- [ ] **Task 19.3**: Add password verification responses
|
|
346
|
+
- Check for `0x07` byte (password required)
|
|
347
|
+
- Check for `0x09` byte (password incorrect)
|
|
348
|
+
- Throw `SwitchbotAuthenticationError` with context
|
|
349
|
+
|
|
350
|
+
### Medium Priority
|
|
351
|
+
|
|
352
|
+
- [ ] **Task 19.4**: Enhance retry logic
|
|
353
|
+
- DBus error backoff (0.25s)
|
|
354
|
+
- `BLEAK_RETRY_EXCEPTIONS` handling
|
|
355
|
+
- Better context in retry errors
|
|
356
|
+
|
|
357
|
+
- [ ] **Task 19.5**: Add response length validation
|
|
358
|
+
- Check minimum expected length
|
|
359
|
+
- Throw errors for truncated responses
|
|
360
|
+
- Include actual vs expected length in error
|
|
361
|
+
|
|
362
|
+
## 🔗 Connection Management
|
|
363
|
+
|
|
364
|
+
### High Priority
|
|
365
|
+
|
|
366
|
+
- [ ] **Task 20.1**: Implement persistent connection with timer
|
|
367
|
+
- Keep connection open for 8.5 seconds after last command
|
|
368
|
+
- Reset timer on each command
|
|
369
|
+
- Allows command batching without reconnecting
|
|
370
|
+
|
|
371
|
+
- [ ] **Task 20.2**: Add operation lock
|
|
372
|
+
- Prevent concurrent BLE operations
|
|
373
|
+
- `_operation_lock` async lock
|
|
374
|
+
- Wait for operations to complete before disconnecting
|
|
375
|
+
|
|
376
|
+
- [ ] **Task 20.3**: Implement command batching
|
|
377
|
+
- Queue multiple commands
|
|
378
|
+
- Send in sequence on single connection
|
|
379
|
+
- Share connection overhead
|
|
380
|
+
|
|
381
|
+
### Medium Priority
|
|
382
|
+
|
|
383
|
+
- [ ] **Task 20.4**: Add expected disconnect tracking
|
|
384
|
+
- `_expected_disconnect` flag
|
|
385
|
+
- Differentiate expected vs unexpected disconnects
|
|
386
|
+
- Better error handling for unexpected disconnects
|
|
387
|
+
|
|
388
|
+
- [ ] **Task 20.5**: Implement notification handling
|
|
389
|
+
- Per-command notification futures
|
|
390
|
+
- Timeout handling (5s default)
|
|
391
|
+
- Log unsolicited notifications
|
|
392
|
+
|
|
393
|
+
- [ ] **Task 20.6**: Add characteristic caching
|
|
394
|
+
- Cache read/write characteristics
|
|
395
|
+
- Clear cache on characteristic missing error
|
|
396
|
+
- Avoid repeated characteristic discovery
|
|
397
|
+
|
|
398
|
+
## ✨ Advanced Features
|
|
399
|
+
|
|
400
|
+
### High Priority
|
|
401
|
+
|
|
402
|
+
- [ ] **Task 21.1**: Implement sequence device pattern
|
|
403
|
+
- `SequenceDevice` base class
|
|
404
|
+
- Monitor `sequence_number` from advertisements
|
|
405
|
+
- Auto-trigger `update()` when sequence changes
|
|
406
|
+
- Use for: locks, relay switches, vacuums, air purifiers
|
|
407
|
+
|
|
408
|
+
- [ ] **Task 21.2**: Add override state during connection pattern
|
|
409
|
+
- `DeviceOverrideStateDuringConnection` base class
|
|
410
|
+
- Ignore advertisement data while connected
|
|
411
|
+
- Prevents stale data issues
|
|
412
|
+
- Use for: bot, plugs
|
|
413
|
+
|
|
414
|
+
### Medium Priority
|
|
415
|
+
|
|
416
|
+
- [ ] **Task 21.3**: Add multi-command support
|
|
417
|
+
- `sendMultipleCommands()` - Send series, return if any succeed
|
|
418
|
+
- `sendCommandSequence()` - Send series, must all succeed
|
|
419
|
+
- Used for Curtain 3 and newer devices
|
|
420
|
+
|
|
421
|
+
- [ ] **Task 21.4**: Implement basic settings command
|
|
422
|
+
- `getBasicInfo()` - Universal settings retrieval
|
|
423
|
+
- Returns: battery, firmware, device-specific settings
|
|
424
|
+
- Command: `0x57 0x02`
|
|
425
|
+
|
|
426
|
+
- [ ] **Task 21.5**: Add mode setting commands
|
|
427
|
+
- Universal mode setting command: `0x57 0x03`
|
|
428
|
+
- Extended settings command
|
|
429
|
+
- Per-device mode enums
|
|
430
|
+
|
|
431
|
+
### Low Priority
|
|
432
|
+
|
|
433
|
+
- [ ] **Task 21.6**: Add passive polling
|
|
434
|
+
- `PASSIVE_POLL_INTERVAL = 60 * 60 * 24` (24 hours)
|
|
435
|
+
- `pollNeeded()` method
|
|
436
|
+
- Auto-poll inactive devices periodically
|
|
437
|
+
|
|
438
|
+
- [ ] **Task 21.7**: Implement cloud device fetching
|
|
439
|
+
- `getDevices()` - Fetch devices from SwitchBot account
|
|
440
|
+
- Auto-populate model cache from cloud
|
|
441
|
+
- Handle regional APIs (US/CN/EU)
|
|
442
|
+
|
|
443
|
+
## 📋 Implementation Priority Guide
|
|
444
|
+
|
|
445
|
+
### Phase 1: Critical Functionality (Q1 2026)
|
|
446
|
+
1. Curtain speed control (Task 3.1)
|
|
447
|
+
2. Advertisement-based status (Task 10.1, 10.2)
|
|
448
|
+
3. Encryption GCM mode (Task 18.1-18.3)
|
|
449
|
+
4. Command result verification (Task 19.2, 19.3)
|
|
450
|
+
5. Persistent connections (Task 20.1, 20.2)
|
|
451
|
+
|
|
452
|
+
### Phase 2: Command Enhancement (Q2 2026)
|
|
453
|
+
1. Bot mode/settings (Task 2.1, 2.2)
|
|
454
|
+
2. Lock advanced features (Task 4.1-4.3)
|
|
455
|
+
3. Light effects (Task 6.1)
|
|
456
|
+
4. Relay switch power monitoring (Task 5.1, 5.2)
|
|
457
|
+
5. Sequence device pattern (Task 21.1)
|
|
458
|
+
|
|
459
|
+
### Phase 3: New Devices (Q3 2026)
|
|
460
|
+
1. Vacuum cleaners (Task 12.1-12.7)
|
|
461
|
+
2. Lock variants (Task 13.1-13.4)
|
|
462
|
+
3. Climate control (Task 15.1-15.4)
|
|
463
|
+
4. Lighting variants (Task 16.1-16.5)
|
|
464
|
+
|
|
465
|
+
### Phase 4: Advanced Features (Q4 2026)
|
|
466
|
+
1. Multi-command sequences (Task 21.3)
|
|
467
|
+
2. Override state pattern (Task 21.2)
|
|
468
|
+
3. Passive polling (Task 21.6)
|
|
469
|
+
4. Cloud device fetching (Task 21.7)
|
|
470
|
+
|
|
471
|
+
## 🎯 Success Metrics
|
|
472
|
+
|
|
473
|
+
- **Feature Parity**: 90%+ of pySwitchBot commands implemented
|
|
474
|
+
- **Device Coverage**: 95%+ of SwitchBot device types supported
|
|
475
|
+
- **Status Accuracy**: Advertisement-based status for all devices
|
|
476
|
+
- **Connection Efficiency**: 50% reduction in connection overhead via batching
|
|
477
|
+
- **Error Clarity**: Specific error types for all failure modes
|
|
478
|
+
|
|
479
|
+
## 📚 References
|
|
480
|
+
|
|
481
|
+
- **pySwitchBot Repository**: https://github.com/Danielhiversen/pySwitchbot
|
|
482
|
+
- **SwitchBot BLE API**: https://github.com/OpenWonderLabs/SwitchBotAPI-BLE
|
|
483
|
+
- **Current node-switchbot**: v4.0.0 with macOS BLE compatibility
|
|
484
|
+
- **Analysis Date**: March 7, 2026
|
package/todo/README.md
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
# TODO Management
|
|
2
|
+
|
|
3
|
+
This folder tracks the implementation roadmap for achieving feature parity with pySwitchBot.
|
|
4
|
+
|
|
5
|
+
## Files
|
|
6
|
+
|
|
7
|
+
- **[todo.md](./todo.md)** - All pending implementation tasks organized by phase and priority
|
|
8
|
+
- **[completed.md](./completed.md)** - Completed tasks with dates and notes
|
|
9
|
+
- **[../PYSWITCHBOT_COMPARISON.md](../PYSWITCHBOT_COMPARISON.md)** - Full comparison analysis and detailed task specifications
|
|
10
|
+
|
|
11
|
+
## Workflow
|
|
12
|
+
|
|
13
|
+
### When Starting a Task
|
|
14
|
+
1. Pick a task from `todo.md` (preferably in priority order)
|
|
15
|
+
2. Create a branch for the task if needed
|
|
16
|
+
3. Implement the feature following the specifications in PYSWITCHBOT_COMPARISON.md
|
|
17
|
+
|
|
18
|
+
### When Completing a Task
|
|
19
|
+
1. Check the box in `todo.md`: `- [ ]` → `- [x]`
|
|
20
|
+
2. Cut the completed task from `todo.md`
|
|
21
|
+
3. Paste it into `completed.md` under the appropriate phase
|
|
22
|
+
4. Add completion date: `(Completed: YYYY-MM-DD)`
|
|
23
|
+
5. Add implementation notes if there were deviations or interesting details
|
|
24
|
+
6. Update "Last Updated" timestamp in both files
|
|
25
|
+
7. Commit both files together
|
|
26
|
+
|
|
27
|
+
### Example Completion Entry
|
|
28
|
+
|
|
29
|
+
```markdown
|
|
30
|
+
- [x] **Task 3.1**: Add speed parameter to curtain movement commands (Completed: 2026-03-15)
|
|
31
|
+
- Implemented in `src/devices/wo-curtain.ts`
|
|
32
|
+
- Added validation for speed range 1-255
|
|
33
|
+
- Updated tests to cover speed parameter
|
|
34
|
+
- PR: #123
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## Task Organization
|
|
38
|
+
|
|
39
|
+
Tasks are organized by:
|
|
40
|
+
|
|
41
|
+
### Phase
|
|
42
|
+
- **Phase 1**: Critical Functionality (Q1 2026) - Core features needed immediately
|
|
43
|
+
- **Phase 2**: Command Enhancement (Q2 2026) - Additional commands and features
|
|
44
|
+
- **Phase 3**: New Devices (Q3 2026) - Support for new device types
|
|
45
|
+
- **Phase 4**: Advanced Features (Q4 2026) - Nice-to-have optimizations
|
|
46
|
+
|
|
47
|
+
### Priority
|
|
48
|
+
- **High Priority**: User-facing functionality, critical gaps
|
|
49
|
+
- **Medium Priority**: Enhancements, optimizations
|
|
50
|
+
- **Low Priority**: Nice-to-have features
|
|
51
|
+
|
|
52
|
+
## Current Status
|
|
53
|
+
|
|
54
|
+
Track overall progress:
|
|
55
|
+
|
|
56
|
+
- **Phase 0**: ✅ Complete (BLE infrastructure hardening)
|
|
57
|
+
- **Phase 1**: 🟡 In Progress
|
|
58
|
+
- **Phase 2**: ⏳ Not Started
|
|
59
|
+
- **Phase 3**: ⏳ Not Started
|
|
60
|
+
- **Phase 4**: ⏳ Not Started
|
|
61
|
+
|
|
62
|
+
## Quick Links
|
|
63
|
+
|
|
64
|
+
- [View Pending Tasks](./todo.md)
|
|
65
|
+
- [View Completed Tasks](./completed.md)
|
|
66
|
+
- [Full Comparison Document](../PYSWITCHBOT_COMPARISON.md)
|
|
67
|
+
- [pySwitchBot Repository](https://github.com/Danielhiversen/pySwitchbot)
|
|
68
|
+
- [SwitchBot BLE API](https://github.com/OpenWonderLabs/SwitchBotAPI-BLE)
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
# Completed Tasks
|
|
2
|
+
|
|
3
|
+
Track completed implementation tasks from the pySwitchBot comparison roadmap.
|
|
4
|
+
|
|
5
|
+
Last Updated: March 7, 2026
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## Phase 0: Foundation & Preparation ✅
|
|
10
|
+
|
|
11
|
+
### BLE Infrastructure Hardening (Completed March 6, 2026)
|
|
12
|
+
- [x] Add enumerable device properties for Homebridge compatibility
|
|
13
|
+
- [x] Implement ID-based BLE lookups for macOS (empty MAC address support)
|
|
14
|
+
- [x] Add manufacturer data MAC extraction fallback
|
|
15
|
+
- [x] Broaden discovery filters for legacy UUIDs (000d)
|
|
16
|
+
- [x] Add peripheral validation (connectable flag, RSSI bounds)
|
|
17
|
+
- [x] Implement BLE event listener cleanup
|
|
18
|
+
- [x] Add connection error cleanup (characteristics discovery failure)
|
|
19
|
+
- [x] Create BLE lifecycle regression tests
|
|
20
|
+
- [x] Fix resource leaks (event listeners, connection maps)
|
|
21
|
+
|
|
22
|
+
### Testing & Validation (Completed March 6-7, 2026)
|
|
23
|
+
- [x] 124 unit tests passing
|
|
24
|
+
- [x] BLE scanner lifecycle tests
|
|
25
|
+
- [x] BLE connection cleanup tests
|
|
26
|
+
- [x] macOS compatibility validation (45 real devices)
|
|
27
|
+
|
|
28
|
+
---
|
|
29
|
+
|
|
30
|
+
## Phase 1: Core Parity Sprint ✅
|
|
31
|
+
|
|
32
|
+
### Completed March 7, 2026
|
|
33
|
+
- [x] Advertisement status parsing and model cache support
|
|
34
|
+
- Added richer advertisement parsing for Bot, Curtain/Curtain3, Lock/Lock Pro, and Relay Switch models
|
|
35
|
+
- Added per-discovery model cache in `BLEScanner`
|
|
36
|
+
- Stored parsed BLE service data on device info for status fallback
|
|
37
|
+
|
|
38
|
+
- [x] Curtain speed control
|
|
39
|
+
- Added optional speed to `open`, `close`, and `setPosition` commands
|
|
40
|
+
- Updated BLE payload and OpenAPI `setPosition` parameter construction
|
|
41
|
+
|
|
42
|
+
- [x] GCM/CTR BLE encryption plumbing
|
|
43
|
+
- Added encryption mode (`auto`/`ctr`/`gcm`) support in `BLEConnection`
|
|
44
|
+
- Added IV length validation, auto mode resolution, and GCM IV increment behavior
|
|
45
|
+
|
|
46
|
+
- [x] BLE command result and password response validation
|
|
47
|
+
- Added command response checks for ack bytes (`0x01`, `0x05`, `0x06`)
|
|
48
|
+
- Added password-required (`0x07`) and password-incorrect (`0x09`) detection
|
|
49
|
+
|
|
50
|
+
- [x] Persistent BLE connections + operation locking
|
|
51
|
+
- Added per-device operation lock queue in `BLEConnection`
|
|
52
|
+
- Added configurable persistent connection timer with auto-disconnect
|
|
53
|
+
- Added device-level BLE command serialization in base device class
|
|
54
|
+
|
|
55
|
+
---
|
|
56
|
+
|
|
57
|
+
## Phase 2: Command Enhancement (Wave 1) ✅
|
|
58
|
+
|
|
59
|
+
### Completed March 7, 2026
|
|
60
|
+
- [x] Bot mode configuration
|
|
61
|
+
- Implemented `setMode('press'|'switch')`, `setLongPress(duration)`, `handUp()`, and `handDown()` on `WoHand`
|
|
62
|
+
|
|
63
|
+
- [x] Lock advanced features
|
|
64
|
+
- Implemented `unlockWithoutUnlatch()` on `WoSmartLockPro`
|
|
65
|
+
- Added smart pre-checks to skip lock/unlock when already in target state
|
|
66
|
+
- Added `getLockInfo()` helper on lock devices
|
|
67
|
+
- Added BLE notification subscription hooks for lock updates
|
|
68
|
+
|
|
69
|
+
- [x] Light effect presets
|
|
70
|
+
- Added 20 preset effects with `setEffect(effectName, speed)` on `WoBulb`/`WoStrip`
|
|
71
|
+
|
|
72
|
+
- [x] Relay power monitoring
|
|
73
|
+
- Added relay basic-info parsing for voltage/current/energy from BLE response payload
|
|
74
|
+
- Integrated parsed metrics into relay BLE status response
|
|
75
|
+
|
|
76
|
+
- [x] Phase 2 regression coverage
|
|
77
|
+
- Added `test/phase2-features.test.ts` covering Bot mode config, lock smart detection, light effects, and relay metrics parsing
|
|
78
|
+
|
|
79
|
+
---
|
|
80
|
+
|
|
81
|
+
## Phase 2: Command Enhancement (Wave 2) ✅
|
|
82
|
+
|
|
83
|
+
### Completed March 7, 2026
|
|
84
|
+
- [x] Relay 2PM channel-specific control (Task 5.3)
|
|
85
|
+
- Created `WoRelaySwitch2PM` class extending `WoRelaySwitch1`
|
|
86
|
+
- Implemented `setChannel1(state: boolean)` and `setChannel2(state: boolean)` methods
|
|
87
|
+
- Added channel-specific command constants (CHANNEL1_ON/OFF, CHANNEL2_ON/OFF) to DEVICE_COMMANDS.RELAY
|
|
88
|
+
|
|
89
|
+
- [x] Bulb color temperature with min/max bounds (Task 6.3)
|
|
90
|
+
- Added `setColorTemp(minTemp, maxTemp, temp)` method to `WoBulb` class
|
|
91
|
+
- Command format: `0x57 0x0F 0x47 0x01 0x17 BRIGHTNESS MIN_KEL MAX_KEL TEMP`
|
|
92
|
+
- Validates and clamps temperatures, ensures current temp within min/max bounds
|
|
93
|
+
- Auto-corrects reversed min/max values
|
|
94
|
+
|
|
95
|
+
- [x] RGBIC bulb segmented control (Task 6.2)
|
|
96
|
+
- Created `WoRGBICBulb` class extending `WoBulb`
|
|
97
|
+
- Implemented `setSegmentColor(segmentId, r, g, b)` for individual LED segment color control
|
|
98
|
+
- Implemented `setSegmentEffect(segmentId, effectName, speed)` for segment-specific effects
|
|
99
|
+
- Added 25 RGBIC effects including segment_cycle, segment_wave, segment_chase, segment_strobe, segment_twinkle
|
|
100
|
+
- Inherits all standard bulb features from WoBulb (standard effects, color temperature bounds)
|
|
101
|
+
|
|
102
|
+
- [x] Phase 2 Wave 2 regression coverage
|
|
103
|
+
- Added `test/phase2-remaining.test.ts` with 21 tests covering Relay 2PM channels, color temperature bounds, and RGBIC segmented control
|
|
104
|
+
|
|
105
|
+
---
|
|
106
|
+
|
|
107
|
+
## Phase 2: Advanced Features ✅
|
|
108
|
+
|
|
109
|
+
### Completed March 7, 2026
|
|
110
|
+
- [x] Sequence device pattern (Task 21.1)
|
|
111
|
+
- Added `SequenceDevice` base class
|
|
112
|
+
- Tracks advertisement `sequenceNumber` changes and emits `sequence-changed`
|
|
113
|
+
- Auto-triggers `update()` on sequence changes with in-flight suppression
|
|
114
|
+
- Applied to lock, relay switch, and air purifier device families
|
|
115
|
+
- Added regression coverage in `test/sequence-device.test.ts`
|
|
116
|
+
|
|
117
|
+
- [x] Override state during connection pattern (Task 21.2)
|
|
118
|
+
- Added `DeviceOverrideStateDuringConnection` base class
|
|
119
|
+
- Ignores advertisement state (`bleServiceData`, battery, RSSI) while BLE connection is active
|
|
120
|
+
- Prevents stale advertisement fallback state during live connections
|
|
121
|
+
- Applied to bot and plug device families
|
|
122
|
+
- Added regression coverage in `test/device-override-state-during-connection.test.ts`
|
|
123
|
+
|
|
124
|
+
---
|
|
125
|
+
|
|
126
|
+
## Notes
|
|
127
|
+
|
|
128
|
+
When moving a task from todo.md to this file:
|
|
129
|
+
1. Add the completion date
|
|
130
|
+
2. Note any implementation details or deviations
|
|
131
|
+
3. Link to relevant PRs or commits if applicable
|
|
132
|
+
4. Update "Last Updated" timestamp
|
|
133
|
+
|
|
134
|
+
Format: `- [x] **Task X.Y**: Description (Completed: YYYY-MM-DD)`
|