node-switchbot 4.0.0-beta.7 โ 4.0.0-beta.9
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/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 +32 -1
- package/dist/ble.d.ts.map +1 -1
- package/dist/ble.js +262 -15
- package/dist/ble.js.map +1 -1
- package/dist/devices/base.d.ts +3 -0
- package/dist/devices/base.d.ts.map +1 -1
- package/dist/devices/base.js +45 -10
- package/dist/devices/base.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.js +1 -1
- package/dist/devices/wo-hand.js.map +1 -1
- package/dist/devices/wo-lock-pro.js +1 -1
- package/dist/devices/wo-lock-pro.js.map +1 -1
- package/dist/devices/wo-lock.js +1 -1
- package/dist/devices/wo-lock.js.map +1 -1
- package/dist/devices/wo-relay-switch-1.js +1 -1
- package/dist/devices/wo-relay-switch-1.js.map +1 -1
- package/dist/switchbot.d.ts.map +1 -1
- package/dist/switchbot.js +4 -2
- package/dist/switchbot.js.map +1 -1
- package/dist/types/ble.d.ts +18 -0
- package/dist/types/ble.d.ts.map +1 -1
- package/dist/types/ble.js.map +1 -1
- package/dist/types/device.d.ts +3 -3
- package/dist/types/device.d.ts.map +1 -1
- package/dist/types/index.d.ts +8 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js.map +1 -1
- package/docs/assets/hierarchy.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 +14 -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/DiscoveryError.html +2 -2
- package/docs/classes/OpenAPIClient.html +24 -24
- package/docs/classes/SwitchBot.html +11 -11
- package/docs/classes/SwitchBotDevice.html +28 -28
- package/docs/classes/SwitchBotError.html +2 -2
- package/docs/classes/ValidationError.html +2 -2
- package/docs/classes/WoAirPurifier.html +32 -32
- package/docs/classes/WoAirPurifierTable.html +32 -32
- package/docs/classes/WoBlindTilt.html +34 -34
- package/docs/classes/WoBulb.html +33 -33
- package/docs/classes/WoCeilingLight.html +33 -33
- package/docs/classes/WoContact.html +28 -28
- package/docs/classes/WoCurtain.html +32 -32
- package/docs/classes/WoHand.html +34 -34
- package/docs/classes/WoHub2.html +28 -28
- package/docs/classes/WoHub3.html +28 -28
- package/docs/classes/WoHumi.html +32 -32
- package/docs/classes/WoHumi2.html +32 -32
- package/docs/classes/WoIOSensorTH.html +28 -28
- package/docs/classes/WoKeypad.html +28 -28
- package/docs/classes/WoLeak.html +28 -28
- package/docs/classes/WoPlugMiniJP.html +31 -31
- package/docs/classes/WoPlugMiniUS.html +31 -31
- package/docs/classes/WoPresence.html +28 -28
- package/docs/classes/WoRelaySwitch1.html +31 -31
- package/docs/classes/WoRelaySwitch1PM.html +31 -31
- package/docs/classes/WoRemote.html +28 -28
- package/docs/classes/WoSensorTH.html +28 -28
- package/docs/classes/WoSensorTHPlus.html +28 -28
- package/docs/classes/WoSensorTHPro.html +28 -28
- package/docs/classes/WoSensorTHProCO2.html +28 -28
- package/docs/classes/WoSmartLock.html +30 -30
- package/docs/classes/WoSmartLockPro.html +31 -31
- package/docs/classes/WoStrip.html +33 -33
- 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/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 +2 -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 +2 -2
- package/docs/interfaces/BotServiceData.html +20 -5
- package/docs/interfaces/BotStatus.html +6 -6
- package/docs/interfaces/BulbCommands.html +2 -2
- package/docs/interfaces/BulbServiceData.html +21 -5
- package/docs/interfaces/BulbStatus.html +6 -6
- package/docs/interfaces/CeilingLightCommands.html +2 -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 +22 -14
- 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 +2 -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 +2 -2
- package/docs/interfaces/StripServiceData.html +21 -5
- package/docs/interfaces/StripStatus.html +6 -6
- package/docs/interfaces/SwitchBotConfig.html +15 -15
- 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/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 +1 -1
- package/todo/PYSWITCHBOT_COMPARISON.md +484 -0
- package/todo/README.md +68 -0
- package/todo/completed.md +65 -0
- package/todo/todo.md +369 -0
- package/PRODUCTION_READY.md +0 -135
package/todo/todo.md
ADDED
|
@@ -0,0 +1,369 @@
|
|
|
1
|
+
# TODO: pySwitchBot Feature Parity Roadmap
|
|
2
|
+
|
|
3
|
+
Implementation tasks to achieve feature parity with pySwitchBot.
|
|
4
|
+
|
|
5
|
+
Last Updated: March 7, 2026
|
|
6
|
+
Source: [PYSWITCHBOT_COMPARISON.md](../PYSWITCHBOT_COMPARISON.md)
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
## ๐
Phase 2: Command Enhancement (Q2 2026)
|
|
11
|
+
|
|
12
|
+
### ๐ค Bot (WoHand) Commands
|
|
13
|
+
|
|
14
|
+
- [ ] **Task 2.1**: Add `setMode(mode: 'switch' | 'press')` command
|
|
15
|
+
- Switch mode: Toggle on/off
|
|
16
|
+
- Press mode: Momentary press
|
|
17
|
+
- Command: `0x57 0x0F 0x47 0x01 MODE` (MODE: 0x00=press, 0x01=switch)
|
|
18
|
+
|
|
19
|
+
- [ ] **Task 2.2**: Add `setLongPress(duration: number)` command
|
|
20
|
+
- Configure press duration (1-255 deciseconds)
|
|
21
|
+
- Command: `0x57 0x0F 0x47 0x03 DURATION`
|
|
22
|
+
|
|
23
|
+
- [ ] **Task 2.3**: Add direct arm control
|
|
24
|
+
- `handUp()` - Raise arm
|
|
25
|
+
- `handDown()` - Lower arm
|
|
26
|
+
- More precise than toggle
|
|
27
|
+
|
|
28
|
+
### ๐ Lock Commands
|
|
29
|
+
|
|
30
|
+
- [ ] **Task 4.1**: Add `unlockWithoutUnlatch()` command
|
|
31
|
+
- EU firmware feature
|
|
32
|
+
- Unlocks without unlatching door
|
|
33
|
+
- Command: Different from standard unlock
|
|
34
|
+
|
|
35
|
+
- [ ] **Task 4.2**: Implement notification handling
|
|
36
|
+
- Subscribe to lock notifications
|
|
37
|
+
- Real-time status updates
|
|
38
|
+
- Handle unsolicited notifications
|
|
39
|
+
|
|
40
|
+
- [ ] **Task 4.3**: Add smart lock state detection
|
|
41
|
+
- Check current state before sending command
|
|
42
|
+
- Avoid unnecessary unlock/lock commands
|
|
43
|
+
- Return early if already in target state
|
|
44
|
+
|
|
45
|
+
- [ ] **Task 4.4**: Add `getLockInfo()` command
|
|
46
|
+
- Get detailed lock configuration
|
|
47
|
+
- Battery, firmware, settings
|
|
48
|
+
- Command: `0x57 0x02`
|
|
49
|
+
|
|
50
|
+
### ๐ก Light (Bulb/Strip) Commands
|
|
51
|
+
|
|
52
|
+
- [ ] **Task 6.1**: Add effect presets (20+ effects)
|
|
53
|
+
- Christmas, Halloween, Sunset, Rainbow, etc.
|
|
54
|
+
- Command: `0x57 0x0F 0x47 0x01 EFFECT_ID 0xFF SPEED 0x00 0x00 0x00`
|
|
55
|
+
- Effect IDs: 0x00-0x13 (20 effects)
|
|
56
|
+
- Speed: 0x01 (slow) to 0x64 (fast)
|
|
57
|
+
|
|
58
|
+
- [ ] **Task 6.2**: Add RGBIC segmented control
|
|
59
|
+
- Control individual LED segments
|
|
60
|
+
- RGBIC-specific effects
|
|
61
|
+
- Multi-zone color control
|
|
62
|
+
|
|
63
|
+
- [ ] **Task 6.3**: Add color temperature with min/max
|
|
64
|
+
- `setColorTemp(minTemp: number, maxTemp: number, temp: number)`
|
|
65
|
+
- Command: `0x57 0x0F 0x47 0x01 0x17 BRIGHTNESS MIN_KEL MAX_KEL TEMP`
|
|
66
|
+
|
|
67
|
+
### โก Relay Switch Commands
|
|
68
|
+
|
|
69
|
+
- [ ] **Task 5.1**: Add `toggle()` command
|
|
70
|
+
- Toggle current state
|
|
71
|
+
- Command: `0x57 0x0F 0x50 0x01 0x01 0x02`
|
|
72
|
+
|
|
73
|
+
- [ ] **Task 5.2**: Implement power monitoring
|
|
74
|
+
- `getBasicInfo()` - Returns voltage, current, power, energy
|
|
75
|
+
- Parse response: 11 bytes with power data at specific offsets
|
|
76
|
+
- Command: `0x57 0x02`
|
|
77
|
+
|
|
78
|
+
- [ ] **Task 5.3**: Add channel-specific control (2PM model)
|
|
79
|
+
- `setChannel1(state: boolean)`
|
|
80
|
+
- `setChannel2(state: boolean)`
|
|
81
|
+
- Detect 2PM vs 1PM model
|
|
82
|
+
|
|
83
|
+
### โจ Advanced Features
|
|
84
|
+
|
|
85
|
+
- [ ] **Task 21.1**: Implement sequence device pattern
|
|
86
|
+
- `SequenceDevice` base class
|
|
87
|
+
- Monitor `sequence_number` from advertisements
|
|
88
|
+
- Auto-trigger `update()` when sequence changes
|
|
89
|
+
- Use for: locks, relay switches, vacuums, air purifiers
|
|
90
|
+
|
|
91
|
+
- [ ] **Task 21.2**: Add override state during connection pattern
|
|
92
|
+
- `DeviceOverrideStateDuringConnection` base class
|
|
93
|
+
- Ignore advertisement data while connected
|
|
94
|
+
- Prevents stale data issues
|
|
95
|
+
- Use for: bot, plugs
|
|
96
|
+
|
|
97
|
+
---
|
|
98
|
+
|
|
99
|
+
## ๐
Phase 3: New Devices (Q3 2026)
|
|
100
|
+
|
|
101
|
+
### ๐งน Vacuum Cleaners
|
|
102
|
+
|
|
103
|
+
- [ ] **Task 12.1**: K10+ Vacuum
|
|
104
|
+
- [ ] **Task 12.2**: K10+ Pro Vacuum
|
|
105
|
+
- [ ] **Task 12.3**: K10+ Pro Combo Vacuum
|
|
106
|
+
- [ ] **Task 12.4**: K11+ Vacuum
|
|
107
|
+
- [ ] **Task 12.5**: K20 Vacuum
|
|
108
|
+
- [ ] **Task 12.6**: S10 Vacuum
|
|
109
|
+
- [ ] **Task 12.7**: S20 Vacuum
|
|
110
|
+
|
|
111
|
+
#### Vacuum Commands
|
|
112
|
+
- [ ] **Task 9.2**: Add basic vacuum commands
|
|
113
|
+
- `cleanUp(protocolVersion: number)` - Start cleaning
|
|
114
|
+
- `returnToDock(protocolVersion: number)` - Return to base
|
|
115
|
+
- Support protocol versions 1 and 2
|
|
116
|
+
|
|
117
|
+
- [ ] **Task 9.3**: Add vacuum status getters
|
|
118
|
+
- Battery level
|
|
119
|
+
- Work status (cleaning, returning, docked, etc.)
|
|
120
|
+
- Dustbin status
|
|
121
|
+
- Network status
|
|
122
|
+
|
|
123
|
+
### ๐ Lock Variants
|
|
124
|
+
|
|
125
|
+
- [ ] **Task 13.1**: Lock Lite
|
|
126
|
+
- [ ] **Task 13.2**: Lock Vision
|
|
127
|
+
- [ ] **Task 13.3**: Lock Vision Pro
|
|
128
|
+
- [ ] **Task 13.4**: Lock Pro WiFi
|
|
129
|
+
|
|
130
|
+
### โก Power & Climate
|
|
131
|
+
|
|
132
|
+
- [ ] **Task 14.1**: Relay Switch 2PM
|
|
133
|
+
- [ ] **Task 14.2**: Garage Door Opener (relay variant)
|
|
134
|
+
- [ ] **Task 15.2**: Circulator Fan (Battery/USB)
|
|
135
|
+
- [ ] **Task 15.3**: Smart Thermostat Radiator
|
|
136
|
+
- [ ] **Task 15.4**: Climate Panel
|
|
137
|
+
|
|
138
|
+
### ๐ก Lighting Variants
|
|
139
|
+
|
|
140
|
+
- [ ] **Task 16.1**: Strip Light 3
|
|
141
|
+
- [ ] **Task 16.2**: Floor Lamp
|
|
142
|
+
- [ ] **Task 16.3**: RGBICWW Strip Light
|
|
143
|
+
- [ ] **Task 16.4**: RGBICWW Floor Lamp
|
|
144
|
+
- [ ] **Task 16.5**: Art Frame
|
|
145
|
+
|
|
146
|
+
### ๐๏ธ Other Devices
|
|
147
|
+
|
|
148
|
+
- [ ] **Task 17.2**: Roller Shade
|
|
149
|
+
- [ ] **Task 17.3**: Keypad Vision
|
|
150
|
+
- [ ] **Task 17.4**: Keypad Vision Pro
|
|
151
|
+
- [ ] **Task 17.6**: HubMini Matter
|
|
152
|
+
|
|
153
|
+
---
|
|
154
|
+
|
|
155
|
+
## ๐
Phase 4: Advanced Features (Q4 2026)
|
|
156
|
+
|
|
157
|
+
### ๐จ Enhanced Device Control
|
|
158
|
+
|
|
159
|
+
- [ ] **Task 3.2**: Add Curtain 3 specific commands
|
|
160
|
+
- Support Curtain 3 model detection
|
|
161
|
+
- Implement multi-command sequences
|
|
162
|
+
- Add extended info retrieval
|
|
163
|
+
|
|
164
|
+
- [ ] **Task 3.3**: Add `getExtendedInfo()` command for curtains
|
|
165
|
+
- Returns device chain information
|
|
166
|
+
- Grouped curtain status
|
|
167
|
+
- Command: `0x57 0x0F 0x46 0x01`
|
|
168
|
+
|
|
169
|
+
- [ ] **Task 6.4**: Implement multi-command sequences for lights
|
|
170
|
+
- Send multiple commands in series
|
|
171
|
+
- Used for complex light patterns
|
|
172
|
+
- Support for Strip Light 3
|
|
173
|
+
|
|
174
|
+
### ๐ง Humidifier Commands
|
|
175
|
+
|
|
176
|
+
- [ ] **Task 7.1**: Add humidity level control
|
|
177
|
+
- `setLevel(level: number)` - Set target humidity (1-100)
|
|
178
|
+
- Command: `0x57 0x0F 0xXX 0x01 LEVEL` (XX varies by model)
|
|
179
|
+
|
|
180
|
+
- [ ] **Task 7.2**: Add mode control
|
|
181
|
+
- `setAuto()` - Automatic mode
|
|
182
|
+
- `setManual()` - Manual mode
|
|
183
|
+
- Get target humidity level
|
|
184
|
+
|
|
185
|
+
### ๐ฌ๏ธ Air Purifier Commands
|
|
186
|
+
|
|
187
|
+
- [ ] **Task 8.1**: Add preset modes
|
|
188
|
+
- Modes: `level_1`, `level_2`, `level_3`, `auto`, `sleep`, `pet`
|
|
189
|
+
- `setPresetMode(mode: string)`
|
|
190
|
+
- Command: `0x57 0x0F 0x4E 0x01 MODE_ID`
|
|
191
|
+
|
|
192
|
+
- [ ] **Task 8.2**: Add status with AQI/PM2.5
|
|
193
|
+
- Parse air quality index from response
|
|
194
|
+
- PM2.5 levels
|
|
195
|
+
- Fan speed and mode
|
|
196
|
+
|
|
197
|
+
### ๐ Encryption Enhancements
|
|
198
|
+
|
|
199
|
+
- [ ] **Task 18.4**: Add encryption for relay switches
|
|
200
|
+
- Newer relay switches require encryption
|
|
201
|
+
- Same key retrieval process as locks
|
|
202
|
+
|
|
203
|
+
- [ ] **Task 18.5**: Add encryption for air purifiers
|
|
204
|
+
- Newer air purifiers require encryption
|
|
205
|
+
- Command encryption for all control commands
|
|
206
|
+
|
|
207
|
+
- [ ] **Task 18.6**: Add encryption for light strips
|
|
208
|
+
- Newer light strips require encryption
|
|
209
|
+
- Effect commands need encryption
|
|
210
|
+
|
|
211
|
+
- [ ] **Task 18.7**: Add encryption state reset on disconnect
|
|
212
|
+
- Clear IV, cipher, encryption mode
|
|
213
|
+
- Re-initialize on next connection
|
|
214
|
+
- Handle firmware updates that change encryption
|
|
215
|
+
|
|
216
|
+
- [ ] **Task 18.8**: Implement key verification
|
|
217
|
+
- `verifyEncryptionKey()` - Test key validity
|
|
218
|
+
- Try commands with key before assuming valid
|
|
219
|
+
- Better error messages for invalid keys
|
|
220
|
+
|
|
221
|
+
### ๐ Status & Response Parsing
|
|
222
|
+
|
|
223
|
+
- [ ] **Task 10.1**: Implement passive status from advertisements
|
|
224
|
+
- Parse device state from BLE advertisements
|
|
225
|
+
- No connection needed for basic status
|
|
226
|
+
- Cache last known state
|
|
227
|
+
|
|
228
|
+
- [ ] **Task 10.2**: Add sequence number tracking
|
|
229
|
+
- Monitor `sequence_number` in advertisements
|
|
230
|
+
- Auto-trigger status update when sequence changes
|
|
231
|
+
- Implement for: locks, relay switches, vacuums, air purifiers
|
|
232
|
+
|
|
233
|
+
- [ ] **Task 10.3**: Add calibration status tracking
|
|
234
|
+
- Parse calibration bit from advertisements
|
|
235
|
+
- Track for: curtains, blind tilts
|
|
236
|
+
- Warn if device not calibrated
|
|
237
|
+
|
|
238
|
+
- [ ] **Task 10.4**: Add direction detection for covers
|
|
239
|
+
- Track `_is_opening` / `_is_closing` states
|
|
240
|
+
- Update based on position changes
|
|
241
|
+
- Help UI show proper icons
|
|
242
|
+
|
|
243
|
+
### ๐ Connection & Error Improvements
|
|
244
|
+
|
|
245
|
+
- [ ] **Task 19.1**: Add specific BLE exceptions
|
|
246
|
+
- `SwitchbotOperationError` - Operation failures
|
|
247
|
+
- `SwitchbotAuthenticationError` - Auth failures
|
|
248
|
+
- `CharacteristicMissingError` - BLE characteristic missing
|
|
249
|
+
|
|
250
|
+
- [ ] **Task 19.4**: Enhance retry logic
|
|
251
|
+
- DBus error backoff (0.25s)
|
|
252
|
+
- `BLEAK_RETRY_EXCEPTIONS` handling
|
|
253
|
+
- Better context in retry errors
|
|
254
|
+
|
|
255
|
+
- [ ] **Task 19.5**: Add response length validation
|
|
256
|
+
- Check minimum expected length
|
|
257
|
+
- Throw errors for truncated responses
|
|
258
|
+
- Include actual vs expected length in error
|
|
259
|
+
|
|
260
|
+
- [ ] **Task 20.3**: Implement command batching
|
|
261
|
+
- Queue multiple commands
|
|
262
|
+
- Send in sequence on single connection
|
|
263
|
+
- Share connection overhead
|
|
264
|
+
|
|
265
|
+
- [ ] **Task 20.4**: Add expected disconnect tracking
|
|
266
|
+
- `_expected_disconnect` flag
|
|
267
|
+
- Differentiate expected vs unexpected disconnects
|
|
268
|
+
- Better error handling for unexpected disconnects
|
|
269
|
+
|
|
270
|
+
- [ ] **Task 20.5**: Implement notification handling
|
|
271
|
+
- Per-command notification futures
|
|
272
|
+
- Timeout handling (5s default)
|
|
273
|
+
- Log unsolicited notifications
|
|
274
|
+
|
|
275
|
+
- [ ] **Task 20.6**: Add characteristic caching
|
|
276
|
+
- Cache read/write characteristics
|
|
277
|
+
- Clear cache on characteristic missing error
|
|
278
|
+
- Avoid repeated characteristic discovery
|
|
279
|
+
|
|
280
|
+
### ๐ฏ Advanced Patterns
|
|
281
|
+
|
|
282
|
+
- [ ] **Task 21.3**: Add multi-command support
|
|
283
|
+
- `sendMultipleCommands()` - Send series, return if any succeed
|
|
284
|
+
- `sendCommandSequence()` - Send series, must all succeed
|
|
285
|
+
- Used for Curtain 3 and newer devices
|
|
286
|
+
|
|
287
|
+
- [ ] **Task 21.4**: Implement basic settings command
|
|
288
|
+
- `getBasicInfo()` - Universal settings retrieval
|
|
289
|
+
- Returns: battery, firmware, device-specific settings
|
|
290
|
+
- Command: `0x57 0x02`
|
|
291
|
+
|
|
292
|
+
- [ ] **Task 21.5**: Add mode setting commands
|
|
293
|
+
- Universal mode setting command: `0x57 0x03`
|
|
294
|
+
- Extended settings command
|
|
295
|
+
- Per-device mode enums
|
|
296
|
+
|
|
297
|
+
- [ ] **Task 21.6**: Add passive polling
|
|
298
|
+
- `PASSIVE_POLL_INTERVAL = 60 * 60 * 24` (24 hours)
|
|
299
|
+
- `pollNeeded()` method
|
|
300
|
+
- Auto-poll inactive devices periodically
|
|
301
|
+
|
|
302
|
+
- [ ] **Task 21.7**: Implement cloud device fetching
|
|
303
|
+
- `getDevices()` - Fetch devices from SwitchBot account
|
|
304
|
+
- Auto-populate model cache from cloud
|
|
305
|
+
- Handle regional APIs (US/CN/EU)
|
|
306
|
+
|
|
307
|
+
---
|
|
308
|
+
|
|
309
|
+
## ๐ Medium Priority Enhancements
|
|
310
|
+
|
|
311
|
+
### Discovery & Advertisement
|
|
312
|
+
|
|
313
|
+
- [ ] **Task 1.4**: Enhance advertisement data structure
|
|
314
|
+
- Add `rawAdvData` field
|
|
315
|
+
- Add `isEncrypted` flag
|
|
316
|
+
- Add `modelFriendlyName` field
|
|
317
|
+
|
|
318
|
+
- [ ] **Task 1.5**: Add advertisement data merging
|
|
319
|
+
- Preserve old values when new data is None
|
|
320
|
+
- Recursive dict merging for nested structures
|
|
321
|
+
- Implement `_merge_data()` helper
|
|
322
|
+
|
|
323
|
+
### Relay Switch Additional Features
|
|
324
|
+
|
|
325
|
+
- [ ] **Task 5.4**: Add time/energy tracking
|
|
326
|
+
- `getCurrentTimeAndStartTime()` - For energy calculations
|
|
327
|
+
- Command: `0x57 0x0F 0x51 0x01 0x05 0x01 0x00 0x00 0x00`
|
|
328
|
+
|
|
329
|
+
- [ ] **Task 5.5**: Add garage door opener support
|
|
330
|
+
- Variant of relay switch
|
|
331
|
+
- Specific command sequences
|
|
332
|
+
- Model: SwitchBot Relay Switch (garage mode)
|
|
333
|
+
|
|
334
|
+
### Status Parsing
|
|
335
|
+
|
|
336
|
+
- [ ] **Task 11.1**: Add byte-by-byte response validation
|
|
337
|
+
- Check response length
|
|
338
|
+
- Validate specific byte positions
|
|
339
|
+
- Compare against expected value sets: `{1}`, `{1, 5}`, `{1, 6}`
|
|
340
|
+
|
|
341
|
+
---
|
|
342
|
+
|
|
343
|
+
## ๐ฏ Success Metrics
|
|
344
|
+
|
|
345
|
+
- **Feature Parity**: 90%+ of pySwitchBot commands implemented
|
|
346
|
+
- **Device Coverage**: 95%+ of SwitchBot device types supported
|
|
347
|
+
- **Status Accuracy**: Advertisement-based status for all devices
|
|
348
|
+
- **Connection Efficiency**: 50% reduction in connection overhead via batching
|
|
349
|
+
- **Error Clarity**: Specific error types for all failure modes
|
|
350
|
+
|
|
351
|
+
---
|
|
352
|
+
|
|
353
|
+
## ๐ Notes
|
|
354
|
+
|
|
355
|
+
### Task Completion Process
|
|
356
|
+
1. Move completed task from this file to `completed.md`
|
|
357
|
+
2. Add completion date and any notes
|
|
358
|
+
3. Update "Last Updated" timestamp
|
|
359
|
+
4. Reference any relevant PRs or commits
|
|
360
|
+
|
|
361
|
+
### Priority Levels
|
|
362
|
+
- **High Priority**: Core functionality, user-facing features
|
|
363
|
+
- **Medium Priority**: Enhancements, optimizations
|
|
364
|
+
- **Low Priority**: Nice-to-have features
|
|
365
|
+
|
|
366
|
+
### Reference
|
|
367
|
+
- Full comparison details: [PYSWITCHBOT_COMPARISON.md](../PYSWITCHBOT_COMPARISON.md)
|
|
368
|
+
- pySwitchBot Repository: https://github.com/Danielhiversen/pySwitchbot
|
|
369
|
+
- SwitchBot BLE API: https://github.com/OpenWonderLabs/SwitchBotAPI-BLE
|
package/PRODUCTION_READY.md
DELETED
|
@@ -1,135 +0,0 @@
|
|
|
1
|
-
# Production Readiness Status - v4.0.0
|
|
2
|
-
|
|
3
|
-
## โ
Completed Production Enhancements
|
|
4
|
-
|
|
5
|
-
### ๐ฆ Code Quality
|
|
6
|
-
|
|
7
|
-
- โ
**Build**: TypeScript compilation passes with zero errors
|
|
8
|
-
- โ
**Tests**: 40/40 tests passing (5 test suites)
|
|
9
|
-
- โ
**Lint**: ESLint passes with @antfu/eslint-config rules
|
|
10
|
-
- โ
**Type Safety**: Full TypeScript coverage with strict mode
|
|
11
|
-
- โ
**ES Modules**: Native ES2022 module implementation
|
|
12
|
-
|
|
13
|
-
### ๐ฏ Error Handling
|
|
14
|
-
|
|
15
|
-
- โ
**Custom Error Classes**: 9 specific error types for better debugging
|
|
16
|
-
- `SwitchBotError` (base)
|
|
17
|
-
- `BLENotAvailableError`
|
|
18
|
-
- `APINotAvailableError`
|
|
19
|
-
- `DeviceNotFoundError`
|
|
20
|
-
- `CommandFailedError`
|
|
21
|
-
- `ConnectionTimeoutError`
|
|
22
|
-
- `DiscoveryError`
|
|
23
|
-
- `APIError`
|
|
24
|
-
- `ValidationError`
|
|
25
|
-
- โ
**Error Codes**: Each error has a unique code for programmatic handling
|
|
26
|
-
- โ
**Error Context**: Errors include relevant context (device IDs, connection types, etc.)
|
|
27
|
-
|
|
28
|
-
### ๐ Documentation
|
|
29
|
-
|
|
30
|
-
- โ
**README**: Updated with v4 quick start and migration guide
|
|
31
|
-
- โ
**CHANGELOG**: Comprehensive v4.0.0 release notes
|
|
32
|
-
- โ
**Examples**: 6 complete usage examples
|
|
33
|
-
- `basic-usage.js` - Hybrid BLE + API mode
|
|
34
|
-
- `ble-only.js` - Linux BLE-only mode
|
|
35
|
-
- `api-only.js` - Cross-platform API mode
|
|
36
|
-
- `device-control.js` - All device types
|
|
37
|
-
- `event-handling.js` - Event listeners
|
|
38
|
-
- `typescript-usage.ts` - Type-safe usage
|
|
39
|
-
- โ
**Examples README**: Comprehensive examples documentation
|
|
40
|
-
- โ
**API Docs**: TypeDoc-generated documentation (run `npm run docs`)
|
|
41
|
-
|
|
42
|
-
### ๐งช Testing
|
|
43
|
-
|
|
44
|
-
- โ
**Unit Tests**: 5 test suites covering core functionality
|
|
45
|
-
- Export validation (v4-only, no v3 legacy)
|
|
46
|
-
- Device manager operations
|
|
47
|
-
- Error class behaviors
|
|
48
|
-
- Utility functions
|
|
49
|
-
- Device base functionality
|
|
50
|
-
- โ
**Test Coverage**: Key paths validated
|
|
51
|
-
- โ
**Vitest Config**: Proper test exclusions for .dev-archive
|
|
52
|
-
|
|
53
|
-
### ๐ง Development Tools
|
|
54
|
-
|
|
55
|
-
- โ
**ESLint**: Auto-formatting with lint:fix
|
|
56
|
-
- โ
**TypeScript**: Strict compilation settings
|
|
57
|
-
- โ
**Vitest**: Modern testing framework
|
|
58
|
-
- โ
**TypeDoc**: API documentation generation
|
|
59
|
-
- โ
**NPM Scripts**: Complete build/test/lint workflow
|
|
60
|
-
|
|
61
|
-
### ๐ฆ Package Configuration
|
|
62
|
-
|
|
63
|
-
- โ
**package.json**: Updated to v4.0.0 with correct metadata
|
|
64
|
-
- โ
**.npmignore**: Excludes test/, examples/, .dev-archive/ from npm package
|
|
65
|
-
- โ
**Engine Requirements**: Node.js ^20 || ^22 || ^24
|
|
66
|
-
- โ
**Type Exports**: Full TypeScript definitions exported
|
|
67
|
-
|
|
68
|
-
### ๐๏ธ Architecture
|
|
69
|
-
|
|
70
|
-
- โ
**Hybrid BLE/API**: Unified approach with automatic fallback
|
|
71
|
-
- โ
**Device Manager**: Centralized device access pattern
|
|
72
|
-
- โ
**Event-Driven**: EventEmitter for discovery and commands
|
|
73
|
-
- โ
**30 Device Types**: Full support for all SwitchBot devices
|
|
74
|
-
- โ
**Platform Support**:
|
|
75
|
-
- Linux: Full BLE + API
|
|
76
|
-
- Windows/macOS: API-only (graceful BLE degradation)
|
|
77
|
-
|
|
78
|
-
### ๐ Security
|
|
79
|
-
|
|
80
|
-
- โ
**Credential Handling**: Secure HMAC-SHA256 for API auth
|
|
81
|
-
- โ
**Optional Credentials**: Works in BLE-only mode without API credentials
|
|
82
|
-
- โ
**No Hardcoded Secrets**: Examples use environment variables
|
|
83
|
-
|
|
84
|
-
## ๐ Test Results
|
|
85
|
-
|
|
86
|
-
```
|
|
87
|
-
Test Files 5 passed (5)
|
|
88
|
-
Tests 40 passed (40)
|
|
89
|
-
Duration 431ms
|
|
90
|
-
```
|
|
91
|
-
|
|
92
|
-
### Test Coverage Breakdown
|
|
93
|
-
|
|
94
|
-
- โ
`v4-exports.test.ts` (3 tests) - Export validation
|
|
95
|
-
- โ
`device-manager.test.ts` (6 tests) - Device management
|
|
96
|
-
- โ
`errors.test.ts` (15 tests) - Error handling
|
|
97
|
-
- โ
`utils.test.ts` (9 tests) - Utility functions
|
|
98
|
-
- โ
`devices.test.ts` (7 tests) - Device functionality
|
|
99
|
-
|
|
100
|
-
## ๐ข Release Readiness
|
|
101
|
-
|
|
102
|
-
### Pre-Release Checklist
|
|
103
|
-
|
|
104
|
-
- โ
All tests passing
|
|
105
|
-
- โ
Build succeeds
|
|
106
|
-
- โ
Lint passes
|
|
107
|
-
- โ
Documentation complete
|
|
108
|
-
- โ
Examples working
|
|
109
|
-
- โ
CHANGELOG updated
|
|
110
|
-
- โ
README updated
|
|
111
|
-
- โ
No TODO/FIXME comments
|
|
112
|
-
- โ
Type definitions exported
|
|
113
|
-
- โ
Error handling comprehensive
|
|
114
|
-
|
|
115
|
-
### Deployment Steps
|
|
116
|
-
|
|
117
|
-
1. โ
Version bumped to 4.0.0
|
|
118
|
-
2. โ
CHANGELOG updated
|
|
119
|
-
3. โณ Tag release: `git tag v4.0.0`
|
|
120
|
-
4. โณ Push to GitHub: `git push origin latest --tags`
|
|
121
|
-
5. โณ CI will auto-publish to npm via GitHub Actions
|
|
122
|
-
|
|
123
|
-
## ๐ Ready for Production
|
|
124
|
-
|
|
125
|
-
All production readiness criteria have been met. The v4.0.0 codebase is:
|
|
126
|
-
|
|
127
|
-
- โ
**Stable**: All tests passing, no known bugs
|
|
128
|
-
- โ
**Documented**: Comprehensive docs and examples
|
|
129
|
-
- โ
**Type-Safe**: Full TypeScript definitions
|
|
130
|
-
- โ
**Tested**: 40 tests covering core functionality
|
|
131
|
-
- โ
**Clean**: Linted and formatted code
|
|
132
|
-
- โ
**Maintainable**: Clear architecture and error handling
|
|
133
|
-
- โ
**Production-Grade**: Enterprise-ready error handling and logging
|
|
134
|
-
|
|
135
|
-
**Status**: ๐ข PRODUCTION READY
|