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.
Files changed (162) hide show
  1. package/dist/api.d.ts +3 -3
  2. package/dist/api.d.ts.map +1 -1
  3. package/dist/api.js +9 -6
  4. package/dist/api.js.map +1 -1
  5. package/dist/ble.d.ts +32 -1
  6. package/dist/ble.d.ts.map +1 -1
  7. package/dist/ble.js +262 -15
  8. package/dist/ble.js.map +1 -1
  9. package/dist/devices/base.d.ts +3 -0
  10. package/dist/devices/base.d.ts.map +1 -1
  11. package/dist/devices/base.js +45 -10
  12. package/dist/devices/base.js.map +1 -1
  13. package/dist/devices/wo-curtain.d.ts +3 -3
  14. package/dist/devices/wo-curtain.d.ts.map +1 -1
  15. package/dist/devices/wo-curtain.js +12 -9
  16. package/dist/devices/wo-curtain.js.map +1 -1
  17. package/dist/devices/wo-hand.js +1 -1
  18. package/dist/devices/wo-hand.js.map +1 -1
  19. package/dist/devices/wo-lock-pro.js +1 -1
  20. package/dist/devices/wo-lock-pro.js.map +1 -1
  21. package/dist/devices/wo-lock.js +1 -1
  22. package/dist/devices/wo-lock.js.map +1 -1
  23. package/dist/devices/wo-relay-switch-1.js +1 -1
  24. package/dist/devices/wo-relay-switch-1.js.map +1 -1
  25. package/dist/switchbot.d.ts.map +1 -1
  26. package/dist/switchbot.js +4 -2
  27. package/dist/switchbot.js.map +1 -1
  28. package/dist/types/ble.d.ts +18 -0
  29. package/dist/types/ble.d.ts.map +1 -1
  30. package/dist/types/ble.js.map +1 -1
  31. package/dist/types/device.d.ts +3 -3
  32. package/dist/types/device.d.ts.map +1 -1
  33. package/dist/types/index.d.ts +8 -0
  34. package/dist/types/index.d.ts.map +1 -1
  35. package/dist/types/index.js.map +1 -1
  36. package/docs/assets/hierarchy.js +1 -1
  37. package/docs/assets/search.js +1 -1
  38. package/docs/classes/APIError.html +2 -2
  39. package/docs/classes/APINotAvailableError.html +2 -2
  40. package/docs/classes/BLEConnection.html +14 -10
  41. package/docs/classes/BLENotAvailableError.html +2 -2
  42. package/docs/classes/BLEScanner.html +11 -9
  43. package/docs/classes/CommandFailedError.html +2 -2
  44. package/docs/classes/ConnectionTimeoutError.html +2 -2
  45. package/docs/classes/DeviceManager.html +13 -13
  46. package/docs/classes/DeviceNotFoundError.html +2 -2
  47. package/docs/classes/DiscoveryError.html +2 -2
  48. package/docs/classes/OpenAPIClient.html +24 -24
  49. package/docs/classes/SwitchBot.html +11 -11
  50. package/docs/classes/SwitchBotDevice.html +28 -28
  51. package/docs/classes/SwitchBotError.html +2 -2
  52. package/docs/classes/ValidationError.html +2 -2
  53. package/docs/classes/WoAirPurifier.html +32 -32
  54. package/docs/classes/WoAirPurifierTable.html +32 -32
  55. package/docs/classes/WoBlindTilt.html +34 -34
  56. package/docs/classes/WoBulb.html +33 -33
  57. package/docs/classes/WoCeilingLight.html +33 -33
  58. package/docs/classes/WoContact.html +28 -28
  59. package/docs/classes/WoCurtain.html +32 -32
  60. package/docs/classes/WoHand.html +34 -34
  61. package/docs/classes/WoHub2.html +28 -28
  62. package/docs/classes/WoHub3.html +28 -28
  63. package/docs/classes/WoHumi.html +32 -32
  64. package/docs/classes/WoHumi2.html +32 -32
  65. package/docs/classes/WoIOSensorTH.html +28 -28
  66. package/docs/classes/WoKeypad.html +28 -28
  67. package/docs/classes/WoLeak.html +28 -28
  68. package/docs/classes/WoPlugMiniJP.html +31 -31
  69. package/docs/classes/WoPlugMiniUS.html +31 -31
  70. package/docs/classes/WoPresence.html +28 -28
  71. package/docs/classes/WoRelaySwitch1.html +31 -31
  72. package/docs/classes/WoRelaySwitch1PM.html +31 -31
  73. package/docs/classes/WoRemote.html +28 -28
  74. package/docs/classes/WoSensorTH.html +28 -28
  75. package/docs/classes/WoSensorTHPlus.html +28 -28
  76. package/docs/classes/WoSensorTHPro.html +28 -28
  77. package/docs/classes/WoSensorTHProCO2.html +28 -28
  78. package/docs/classes/WoSmartLock.html +30 -30
  79. package/docs/classes/WoSmartLockPro.html +31 -31
  80. package/docs/classes/WoStrip.html +33 -33
  81. package/docs/enums/LogLevel.html +2 -2
  82. package/docs/enums/SwitchBotBLEModel.html +2 -2
  83. package/docs/enums/SwitchBotBLEModelName.html +2 -2
  84. package/docs/functions/updateBaseURL.html +1 -1
  85. package/docs/hierarchy.html +1 -1
  86. package/docs/interfaces/APICommandRequest.html +2 -2
  87. package/docs/interfaces/APICommandResponse.html +2 -2
  88. package/docs/interfaces/APIDevice.html +2 -2
  89. package/docs/interfaces/APIDeviceStatus.html +2 -2
  90. package/docs/interfaces/APIErrorResponse.html +2 -2
  91. package/docs/interfaces/APIResponse.html +2 -2
  92. package/docs/interfaces/AirPurifierCommands.html +2 -2
  93. package/docs/interfaces/AirPurifierServiceData.html +20 -5
  94. package/docs/interfaces/AirPurifierStatus.html +7 -7
  95. package/docs/interfaces/BLEAdvertisement.html +2 -2
  96. package/docs/interfaces/BLEScanOptions.html +5 -5
  97. package/docs/interfaces/BLEServiceData.html +22 -5
  98. package/docs/interfaces/BlindTiltCommands.html +2 -2
  99. package/docs/interfaces/BlindTiltServiceData.html +21 -5
  100. package/docs/interfaces/BlindTiltStatus.html +6 -6
  101. package/docs/interfaces/BotCommands.html +2 -2
  102. package/docs/interfaces/BotServiceData.html +20 -5
  103. package/docs/interfaces/BotStatus.html +6 -6
  104. package/docs/interfaces/BulbCommands.html +2 -2
  105. package/docs/interfaces/BulbServiceData.html +21 -5
  106. package/docs/interfaces/BulbStatus.html +6 -6
  107. package/docs/interfaces/CeilingLightCommands.html +2 -2
  108. package/docs/interfaces/CeilingLightServiceData.html +21 -5
  109. package/docs/interfaces/CeilingLightStatus.html +6 -6
  110. package/docs/interfaces/CommandResult.html +6 -6
  111. package/docs/interfaces/ContactServiceData.html +22 -5
  112. package/docs/interfaces/ContactStatus.html +6 -6
  113. package/docs/interfaces/CurtainCommands.html +2 -2
  114. package/docs/interfaces/CurtainServiceData.html +22 -5
  115. package/docs/interfaces/CurtainStatus.html +6 -6
  116. package/docs/interfaces/DeviceInfo.html +22 -14
  117. package/docs/interfaces/DeviceListResponse.html +2 -2
  118. package/docs/interfaces/DeviceStatus.html +6 -6
  119. package/docs/interfaces/DiscoveryOptions.html +7 -7
  120. package/docs/interfaces/HubServiceData.html +22 -5
  121. package/docs/interfaces/HubStatus.html +6 -6
  122. package/docs/interfaces/HumidifierCommands.html +2 -2
  123. package/docs/interfaces/HumidifierServiceData.html +23 -6
  124. package/docs/interfaces/HumidifierStatus.html +6 -6
  125. package/docs/interfaces/KeypadStatus.html +6 -6
  126. package/docs/interfaces/LeakServiceData.html +22 -5
  127. package/docs/interfaces/LeakStatus.html +6 -6
  128. package/docs/interfaces/LockCommands.html +2 -2
  129. package/docs/interfaces/LockServiceData.html +20 -6
  130. package/docs/interfaces/LockStatus.html +6 -6
  131. package/docs/interfaces/MeterServiceData.html +22 -5
  132. package/docs/interfaces/MeterStatus.html +6 -6
  133. package/docs/interfaces/MotionServiceData.html +22 -5
  134. package/docs/interfaces/MotionStatus.html +6 -6
  135. package/docs/interfaces/PlugCommands.html +2 -2
  136. package/docs/interfaces/PlugServiceData.html +21 -5
  137. package/docs/interfaces/PlugStatus.html +6 -6
  138. package/docs/interfaces/PresenceServiceData.html +22 -5
  139. package/docs/interfaces/PresenceStatus.html +6 -6
  140. package/docs/interfaces/RelaySwitchCommands.html +2 -2
  141. package/docs/interfaces/RelaySwitchServiceData.html +21 -5
  142. package/docs/interfaces/RelaySwitchStatus.html +6 -6
  143. package/docs/interfaces/RemoteStatus.html +6 -6
  144. package/docs/interfaces/SceneListResponse.html +2 -2
  145. package/docs/interfaces/StripCommands.html +2 -2
  146. package/docs/interfaces/StripServiceData.html +21 -5
  147. package/docs/interfaces/StripStatus.html +6 -6
  148. package/docs/interfaces/SwitchBotConfig.html +15 -15
  149. package/docs/interfaces/WebhookConfig.html +2 -2
  150. package/docs/interfaces/WebhookDetails.html +2 -2
  151. package/docs/interfaces/WebhookQueryResponse.html +2 -2
  152. package/docs/interfaces/WebhookSetupResponse.html +2 -2
  153. package/docs/types/ConnectionType.html +1 -1
  154. package/docs/types/PhysicalDeviceType.html +1 -1
  155. package/docs/types/VirtualDeviceType.html +1 -1
  156. package/docs/variables/urls.html +1 -1
  157. package/package.json +1 -1
  158. package/todo/PYSWITCHBOT_COMPARISON.md +484 -0
  159. package/todo/README.md +68 -0
  160. package/todo/completed.md +65 -0
  161. package/todo/todo.md +369 -0
  162. 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
@@ -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