node-switchbot 4.0.0-beta.1 โ†’ 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.
Files changed (246) hide show
  1. package/.github/copilot-instructions.md +19 -5
  2. package/BLE.md +117 -4
  3. package/CHANGELOG.md +45 -0
  4. package/README.md +7 -1
  5. package/dist/api.d.ts +3 -3
  6. package/dist/api.d.ts.map +1 -1
  7. package/dist/api.js +9 -6
  8. package/dist/api.js.map +1 -1
  9. package/dist/ble.d.ts +38 -4
  10. package/dist/ble.d.ts.map +1 -1
  11. package/dist/ble.js +409 -53
  12. package/dist/ble.js.map +1 -1
  13. package/dist/devices/base.d.ts +83 -5
  14. package/dist/devices/base.d.ts.map +1 -1
  15. package/dist/devices/base.js +371 -34
  16. package/dist/devices/base.js.map +1 -1
  17. package/dist/devices/device-override-state-during-connection.d.ts +27 -0
  18. package/dist/devices/device-override-state-during-connection.d.ts.map +1 -0
  19. package/dist/devices/device-override-state-during-connection.js +45 -0
  20. package/dist/devices/device-override-state-during-connection.js.map +1 -0
  21. package/dist/devices/index.d.ts +4 -0
  22. package/dist/devices/index.d.ts.map +1 -1
  23. package/dist/devices/index.js +4 -0
  24. package/dist/devices/index.js.map +1 -1
  25. package/dist/devices/sequence-device.d.ts +36 -0
  26. package/dist/devices/sequence-device.d.ts.map +1 -0
  27. package/dist/devices/sequence-device.js +75 -0
  28. package/dist/devices/sequence-device.js.map +1 -0
  29. package/dist/devices/wo-air-purifier.d.ts +2 -2
  30. package/dist/devices/wo-air-purifier.d.ts.map +1 -1
  31. package/dist/devices/wo-air-purifier.js +2 -2
  32. package/dist/devices/wo-air-purifier.js.map +1 -1
  33. package/dist/devices/wo-bulb.d.ts +10 -0
  34. package/dist/devices/wo-bulb.d.ts.map +1 -1
  35. package/dist/devices/wo-bulb.js +69 -0
  36. package/dist/devices/wo-bulb.js.map +1 -1
  37. package/dist/devices/wo-curtain.d.ts +3 -3
  38. package/dist/devices/wo-curtain.d.ts.map +1 -1
  39. package/dist/devices/wo-curtain.js +12 -9
  40. package/dist/devices/wo-curtain.js.map +1 -1
  41. package/dist/devices/wo-hand.d.ts +53 -2
  42. package/dist/devices/wo-hand.d.ts.map +1 -1
  43. package/dist/devices/wo-hand.js +121 -3
  44. package/dist/devices/wo-hand.js.map +1 -1
  45. package/dist/devices/wo-lock-pro.d.ts +11 -2
  46. package/dist/devices/wo-lock-pro.d.ts.map +1 -1
  47. package/dist/devices/wo-lock-pro.js +65 -3
  48. package/dist/devices/wo-lock-pro.js.map +1 -1
  49. package/dist/devices/wo-lock.d.ts +7 -2
  50. package/dist/devices/wo-lock.d.ts.map +1 -1
  51. package/dist/devices/wo-lock.js +58 -3
  52. package/dist/devices/wo-lock.js.map +1 -1
  53. package/dist/devices/wo-plug-mini-us.d.ts +2 -2
  54. package/dist/devices/wo-plug-mini-us.d.ts.map +1 -1
  55. package/dist/devices/wo-plug-mini-us.js +2 -2
  56. package/dist/devices/wo-plug-mini-us.js.map +1 -1
  57. package/dist/devices/wo-relay-switch-1.d.ts +4 -2
  58. package/dist/devices/wo-relay-switch-1.d.ts.map +1 -1
  59. package/dist/devices/wo-relay-switch-1.js +36 -4
  60. package/dist/devices/wo-relay-switch-1.js.map +1 -1
  61. package/dist/devices/wo-relay-switch-2pm.d.ts +21 -0
  62. package/dist/devices/wo-relay-switch-2pm.d.ts.map +1 -0
  63. package/dist/devices/wo-relay-switch-2pm.js +39 -0
  64. package/dist/devices/wo-relay-switch-2pm.js.map +1 -0
  65. package/dist/devices/wo-rgbic-bulb.d.ts +29 -0
  66. package/dist/devices/wo-rgbic-bulb.d.ts.map +1 -0
  67. package/dist/devices/wo-rgbic-bulb.js +84 -0
  68. package/dist/devices/wo-rgbic-bulb.js.map +1 -0
  69. package/dist/index.d.ts +2 -0
  70. package/dist/index.d.ts.map +1 -1
  71. package/dist/index.js +2 -0
  72. package/dist/index.js.map +1 -1
  73. package/dist/settings.d.ts +17 -0
  74. package/dist/settings.d.ts.map +1 -1
  75. package/dist/settings.js +18 -1
  76. package/dist/settings.js.map +1 -1
  77. package/dist/switchbot.d.ts.map +1 -1
  78. package/dist/switchbot.js +31 -8
  79. package/dist/switchbot.js.map +1 -1
  80. package/dist/types/ble.d.ts +20 -1
  81. package/dist/types/ble.d.ts.map +1 -1
  82. package/dist/types/ble.js.map +1 -1
  83. package/dist/types/device.d.ts +30 -3
  84. package/dist/types/device.d.ts.map +1 -1
  85. package/dist/types/index.d.ts +22 -0
  86. package/dist/types/index.d.ts.map +1 -1
  87. package/dist/types/index.js.map +1 -1
  88. package/dist/utils/bot-ble.d.ts +36 -0
  89. package/dist/utils/bot-ble.d.ts.map +1 -0
  90. package/dist/utils/bot-ble.js +109 -0
  91. package/dist/utils/bot-ble.js.map +1 -0
  92. package/dist/utils/circuit-breaker.d.ts +98 -0
  93. package/dist/utils/circuit-breaker.d.ts.map +1 -0
  94. package/dist/utils/circuit-breaker.js +187 -0
  95. package/dist/utils/circuit-breaker.js.map +1 -0
  96. package/dist/utils/connection-tracker.d.ts +66 -0
  97. package/dist/utils/connection-tracker.d.ts.map +1 -0
  98. package/dist/utils/connection-tracker.js +184 -0
  99. package/dist/utils/connection-tracker.js.map +1 -0
  100. package/dist/utils/fallback-handler.d.ts +68 -0
  101. package/dist/utils/fallback-handler.d.ts.map +1 -0
  102. package/dist/utils/fallback-handler.js +131 -0
  103. package/dist/utils/fallback-handler.js.map +1 -0
  104. package/dist/utils/index.d.ts +10 -0
  105. package/dist/utils/index.d.ts.map +1 -1
  106. package/dist/utils/index.js +41 -4
  107. package/dist/utils/index.js.map +1 -1
  108. package/dist/utils/retry.d.ts +55 -0
  109. package/dist/utils/retry.d.ts.map +1 -0
  110. package/dist/utils/retry.js +95 -0
  111. package/dist/utils/retry.js.map +1 -0
  112. package/docs/assets/hierarchy.js +1 -1
  113. package/docs/assets/navigation.js +1 -1
  114. package/docs/assets/search.js +1 -1
  115. package/docs/classes/APIError.html +2 -2
  116. package/docs/classes/APINotAvailableError.html +2 -2
  117. package/docs/classes/BLEConnection.html +16 -10
  118. package/docs/classes/BLENotAvailableError.html +2 -2
  119. package/docs/classes/BLEScanner.html +11 -9
  120. package/docs/classes/CommandFailedError.html +2 -2
  121. package/docs/classes/ConnectionTimeoutError.html +2 -2
  122. package/docs/classes/DeviceManager.html +13 -13
  123. package/docs/classes/DeviceNotFoundError.html +2 -2
  124. package/docs/classes/DeviceOverrideStateDuringConnection.html +56 -0
  125. package/docs/classes/DiscoveryError.html +2 -2
  126. package/docs/classes/OpenAPIClient.html +24 -24
  127. package/docs/classes/SequenceDevice.html +58 -0
  128. package/docs/classes/SwitchBot.html +11 -11
  129. package/docs/classes/SwitchBotDevice.html +43 -15
  130. package/docs/classes/SwitchBotError.html +2 -2
  131. package/docs/classes/ValidationError.html +2 -2
  132. package/docs/classes/WoAirPurifier.html +48 -18
  133. package/docs/classes/WoAirPurifierTable.html +48 -18
  134. package/docs/classes/WoBlindTilt.html +48 -20
  135. package/docs/classes/WoBulb.html +52 -19
  136. package/docs/classes/WoCeilingLight.html +52 -19
  137. package/docs/classes/WoContact.html +42 -14
  138. package/docs/classes/WoCurtain.html +46 -18
  139. package/docs/classes/WoHand.html +63 -19
  140. package/docs/classes/WoHub2.html +42 -14
  141. package/docs/classes/WoHub3.html +42 -14
  142. package/docs/classes/WoHumi.html +46 -18
  143. package/docs/classes/WoHumi2.html +46 -18
  144. package/docs/classes/WoIOSensorTH.html +42 -14
  145. package/docs/classes/WoKeypad.html +42 -14
  146. package/docs/classes/WoLeak.html +42 -14
  147. package/docs/classes/WoPlugMiniJP.html +45 -17
  148. package/docs/classes/WoPlugMiniUS.html +45 -17
  149. package/docs/classes/WoPresence.html +42 -14
  150. package/docs/classes/WoRelaySwitch1.html +47 -17
  151. package/docs/classes/WoRelaySwitch1PM.html +47 -17
  152. package/docs/classes/WoRemote.html +42 -14
  153. package/docs/classes/WoSensorTH.html +42 -14
  154. package/docs/classes/WoSensorTHPlus.html +42 -14
  155. package/docs/classes/WoSensorTHPro.html +42 -14
  156. package/docs/classes/WoSensorTHProCO2.html +42 -14
  157. package/docs/classes/WoSmartLock.html +49 -16
  158. package/docs/classes/WoSmartLockPro.html +52 -17
  159. package/docs/classes/WoStrip.html +52 -19
  160. package/docs/enums/LogLevel.html +2 -2
  161. package/docs/enums/SwitchBotBLEModel.html +2 -2
  162. package/docs/enums/SwitchBotBLEModelName.html +2 -2
  163. package/docs/functions/updateBaseURL.html +1 -1
  164. package/docs/hierarchy.html +1 -1
  165. package/docs/index.html +2 -2
  166. package/docs/interfaces/APICommandRequest.html +2 -2
  167. package/docs/interfaces/APICommandResponse.html +2 -2
  168. package/docs/interfaces/APIDevice.html +2 -2
  169. package/docs/interfaces/APIDeviceStatus.html +2 -2
  170. package/docs/interfaces/APIErrorResponse.html +2 -2
  171. package/docs/interfaces/APIResponse.html +2 -2
  172. package/docs/interfaces/AirPurifierCommands.html +2 -2
  173. package/docs/interfaces/AirPurifierServiceData.html +20 -5
  174. package/docs/interfaces/AirPurifierStatus.html +7 -7
  175. package/docs/interfaces/BLEAdvertisement.html +3 -2
  176. package/docs/interfaces/BLEScanOptions.html +5 -5
  177. package/docs/interfaces/BLEServiceData.html +22 -5
  178. package/docs/interfaces/BlindTiltCommands.html +2 -2
  179. package/docs/interfaces/BlindTiltServiceData.html +21 -5
  180. package/docs/interfaces/BlindTiltStatus.html +6 -6
  181. package/docs/interfaces/BotCommands.html +6 -2
  182. package/docs/interfaces/BotServiceData.html +20 -5
  183. package/docs/interfaces/BotStatus.html +6 -6
  184. package/docs/interfaces/BulbCommands.html +4 -2
  185. package/docs/interfaces/BulbServiceData.html +21 -5
  186. package/docs/interfaces/BulbStatus.html +6 -6
  187. package/docs/interfaces/CeilingLightCommands.html +4 -2
  188. package/docs/interfaces/CeilingLightServiceData.html +21 -5
  189. package/docs/interfaces/CeilingLightStatus.html +6 -6
  190. package/docs/interfaces/CommandResult.html +6 -6
  191. package/docs/interfaces/ContactServiceData.html +22 -5
  192. package/docs/interfaces/ContactStatus.html +6 -6
  193. package/docs/interfaces/CurtainCommands.html +2 -2
  194. package/docs/interfaces/CurtainServiceData.html +22 -5
  195. package/docs/interfaces/CurtainStatus.html +6 -6
  196. package/docs/interfaces/DeviceInfo.html +23 -13
  197. package/docs/interfaces/DeviceListResponse.html +2 -2
  198. package/docs/interfaces/DeviceStatus.html +6 -6
  199. package/docs/interfaces/DiscoveryOptions.html +7 -7
  200. package/docs/interfaces/HubServiceData.html +22 -5
  201. package/docs/interfaces/HubStatus.html +6 -6
  202. package/docs/interfaces/HumidifierCommands.html +2 -2
  203. package/docs/interfaces/HumidifierServiceData.html +23 -6
  204. package/docs/interfaces/HumidifierStatus.html +6 -6
  205. package/docs/interfaces/KeypadStatus.html +6 -6
  206. package/docs/interfaces/LeakServiceData.html +22 -5
  207. package/docs/interfaces/LeakStatus.html +6 -6
  208. package/docs/interfaces/LockCommands.html +6 -2
  209. package/docs/interfaces/LockServiceData.html +20 -6
  210. package/docs/interfaces/LockStatus.html +6 -6
  211. package/docs/interfaces/MeterServiceData.html +22 -5
  212. package/docs/interfaces/MeterStatus.html +6 -6
  213. package/docs/interfaces/MotionServiceData.html +22 -5
  214. package/docs/interfaces/MotionStatus.html +6 -6
  215. package/docs/interfaces/PlugCommands.html +2 -2
  216. package/docs/interfaces/PlugServiceData.html +21 -5
  217. package/docs/interfaces/PlugStatus.html +6 -6
  218. package/docs/interfaces/PresenceServiceData.html +22 -5
  219. package/docs/interfaces/PresenceStatus.html +6 -6
  220. package/docs/interfaces/RelaySwitchCommands.html +2 -2
  221. package/docs/interfaces/RelaySwitchServiceData.html +21 -5
  222. package/docs/interfaces/RelaySwitchStatus.html +6 -6
  223. package/docs/interfaces/RemoteStatus.html +6 -6
  224. package/docs/interfaces/SceneListResponse.html +2 -2
  225. package/docs/interfaces/StripCommands.html +4 -2
  226. package/docs/interfaces/StripServiceData.html +21 -5
  227. package/docs/interfaces/StripStatus.html +6 -6
  228. package/docs/interfaces/SwitchBotConfig.html +21 -9
  229. package/docs/interfaces/WebhookConfig.html +2 -2
  230. package/docs/interfaces/WebhookDetails.html +2 -2
  231. package/docs/interfaces/WebhookQueryResponse.html +2 -2
  232. package/docs/interfaces/WebhookSetupResponse.html +2 -2
  233. package/docs/media/BLE.md +117 -4
  234. package/docs/modules.html +1 -1
  235. package/docs/types/ConnectionType.html +1 -1
  236. package/docs/types/PhysicalDeviceType.html +1 -1
  237. package/docs/types/VirtualDeviceType.html +1 -1
  238. package/docs/variables/urls.html +1 -1
  239. package/package.json +11 -7
  240. package/tmp-switchbot-scan.mjs +79 -0
  241. package/todo/PYSWITCHBOT_COMPARISON.md +484 -0
  242. package/todo/README.md +68 -0
  243. package/todo/completed.md +134 -0
  244. package/todo/todo.md +296 -0
  245. package/tsconfig.build.json +17 -0
  246. package/PRODUCTION_READY.md +0 -135
package/todo/todo.md ADDED
@@ -0,0 +1,296 @@
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
+ ### ๐Ÿ”’ Lock Commands
15
+
16
+ ### ๐Ÿ’ก Light (Bulb/Strip) Commands
17
+
18
+ ### โšก Relay Switch Commands
19
+
20
+ ### โœจ Advanced Features
21
+
22
+ - โœ… Phase 2 completed. See `todo/completed.md` for completed task details.
23
+
24
+ ---
25
+
26
+ ## ๐Ÿ“… Phase 3: New Devices (Q3 2026)
27
+
28
+ ### ๐Ÿงน Vacuum Cleaners
29
+
30
+ - [ ] **Task 12.1**: K10+ Vacuum
31
+ - [ ] **Task 12.2**: K10+ Pro Vacuum
32
+ - [ ] **Task 12.3**: K10+ Pro Combo Vacuum
33
+ - [ ] **Task 12.4**: K11+ Vacuum
34
+ - [ ] **Task 12.5**: K20 Vacuum
35
+ - [ ] **Task 12.6**: S10 Vacuum
36
+ - [ ] **Task 12.7**: S20 Vacuum
37
+
38
+ #### Vacuum Commands
39
+ - [ ] **Task 9.2**: Add basic vacuum commands
40
+ - `cleanUp(protocolVersion: number)` - Start cleaning
41
+ - `returnToDock(protocolVersion: number)` - Return to base
42
+ - Support protocol versions 1 and 2
43
+
44
+ - [ ] **Task 9.3**: Add vacuum status getters
45
+ - Battery level
46
+ - Work status (cleaning, returning, docked, etc.)
47
+ - Dustbin status
48
+ - Network status
49
+
50
+ ### ๐Ÿ” Lock Variants
51
+
52
+ - [ ] **Task 13.1**: Lock Lite
53
+ - [ ] **Task 13.2**: Lock Vision
54
+ - [ ] **Task 13.3**: Lock Vision Pro
55
+ - [ ] **Task 13.4**: Lock Pro WiFi
56
+
57
+ ### โšก Power & Climate
58
+
59
+ - [ ] **Task 14.1**: Relay Switch 2PM
60
+ - [ ] **Task 14.2**: Garage Door Opener (relay variant)
61
+ - [ ] **Task 15.2**: Circulator Fan (Battery/USB)
62
+ - [ ] **Task 15.3**: Smart Thermostat Radiator
63
+ - [ ] **Task 15.4**: Climate Panel
64
+
65
+ ### ๐Ÿ’ก Lighting Variants
66
+
67
+ - [ ] **Task 16.1**: Strip Light 3
68
+ - [ ] **Task 16.2**: Floor Lamp
69
+ - [ ] **Task 16.3**: RGBICWW Strip Light
70
+ - [ ] **Task 16.4**: RGBICWW Floor Lamp
71
+ - [ ] **Task 16.5**: Art Frame
72
+
73
+ ### ๐ŸŽ›๏ธ Other Devices
74
+
75
+ - [ ] **Task 17.2**: Roller Shade
76
+ - [ ] **Task 17.3**: Keypad Vision
77
+ - [ ] **Task 17.4**: Keypad Vision Pro
78
+ - [ ] **Task 17.6**: HubMini Matter
79
+
80
+ ---
81
+
82
+ ## ๐Ÿ“… Phase 4: Advanced Features (Q4 2026)
83
+
84
+ ### ๐ŸŽจ Enhanced Device Control
85
+
86
+ - [ ] **Task 3.2**: Add Curtain 3 specific commands
87
+ - Support Curtain 3 model detection
88
+ - Implement multi-command sequences
89
+ - Add extended info retrieval
90
+
91
+ - [ ] **Task 3.3**: Add `getExtendedInfo()` command for curtains
92
+ - Returns device chain information
93
+ - Grouped curtain status
94
+ - Command: `0x57 0x0F 0x46 0x01`
95
+
96
+ - [ ] **Task 6.4**: Implement multi-command sequences for lights
97
+ - Send multiple commands in series
98
+ - Used for complex light patterns
99
+ - Support for Strip Light 3
100
+
101
+ ### ๐Ÿ’ง Humidifier Commands
102
+
103
+ - [ ] **Task 7.1**: Add humidity level control
104
+ - `setLevel(level: number)` - Set target humidity (1-100)
105
+ - Command: `0x57 0x0F 0xXX 0x01 LEVEL` (XX varies by model)
106
+
107
+ - [ ] **Task 7.2**: Add mode control
108
+ - `setAuto()` - Automatic mode
109
+ - `setManual()` - Manual mode
110
+ - Get target humidity level
111
+
112
+ ### ๐ŸŒฌ๏ธ Air Purifier Commands
113
+
114
+ - [ ] **Task 8.1**: Add preset modes
115
+ - Modes: `level_1`, `level_2`, `level_3`, `auto`, `sleep`, `pet`
116
+ - `setPresetMode(mode: string)`
117
+ - Command: `0x57 0x0F 0x4E 0x01 MODE_ID`
118
+
119
+ - [ ] **Task 8.2**: Add status with AQI/PM2.5
120
+ - Parse air quality index from response
121
+ - PM2.5 levels
122
+ - Fan speed and mode
123
+
124
+ ### ๐Ÿ” Encryption Enhancements
125
+
126
+ - [ ] **Task 18.4**: Add encryption for relay switches
127
+ - Newer relay switches require encryption
128
+ - Same key retrieval process as locks
129
+
130
+ - [ ] **Task 18.5**: Add encryption for air purifiers
131
+ - Newer air purifiers require encryption
132
+ - Command encryption for all control commands
133
+
134
+ - [ ] **Task 18.6**: Add encryption for light strips
135
+ - Newer light strips require encryption
136
+ - Effect commands need encryption
137
+
138
+ - [ ] **Task 18.7**: Add encryption state reset on disconnect
139
+ - Clear IV, cipher, encryption mode
140
+ - Re-initialize on next connection
141
+ - Handle firmware updates that change encryption
142
+
143
+ - [ ] **Task 18.8**: Implement key verification
144
+ - `verifyEncryptionKey()` - Test key validity
145
+ - Try commands with key before assuming valid
146
+ - Better error messages for invalid keys
147
+
148
+ ### ๐Ÿ“Š Status & Response Parsing
149
+
150
+ - [ ] **Task 10.1**: Implement passive status from advertisements
151
+ - Parse device state from BLE advertisements
152
+ - No connection needed for basic status
153
+ - Cache last known state
154
+
155
+ - [ ] **Task 10.2**: Add sequence number tracking
156
+ - Monitor `sequence_number` in advertisements
157
+ - Auto-trigger status update when sequence changes
158
+ - Implement for: locks, relay switches, vacuums, air purifiers
159
+
160
+ - [ ] **Task 10.3**: Add calibration status tracking
161
+ - Parse calibration bit from advertisements
162
+ - Track for: curtains, blind tilts
163
+ - Warn if device not calibrated
164
+
165
+ - [ ] **Task 10.4**: Add direction detection for covers
166
+ - Track `_is_opening` / `_is_closing` states
167
+ - Update based on position changes
168
+ - Help UI show proper icons
169
+
170
+ ### ๐Ÿ”— Connection & Error Improvements
171
+
172
+ - [ ] **Task 19.1**: Add specific BLE exceptions
173
+ - `SwitchbotOperationError` - Operation failures
174
+ - `SwitchbotAuthenticationError` - Auth failures
175
+ - `CharacteristicMissingError` - BLE characteristic missing
176
+
177
+ - [ ] **Task 19.4**: Enhance retry logic
178
+ - DBus error backoff (0.25s)
179
+ - `BLEAK_RETRY_EXCEPTIONS` handling
180
+ - Better context in retry errors
181
+
182
+ - [ ] **Task 19.5**: Add response length validation
183
+ - Check minimum expected length
184
+ - Throw errors for truncated responses
185
+ - Include actual vs expected length in error
186
+
187
+ - [ ] **Task 20.3**: Implement command batching
188
+ - Queue multiple commands
189
+ - Send in sequence on single connection
190
+ - Share connection overhead
191
+
192
+ - [ ] **Task 20.4**: Add expected disconnect tracking
193
+ - `_expected_disconnect` flag
194
+ - Differentiate expected vs unexpected disconnects
195
+ - Better error handling for unexpected disconnects
196
+
197
+ - [ ] **Task 20.5**: Implement notification handling
198
+ - Per-command notification futures
199
+ - Timeout handling (5s default)
200
+ - Log unsolicited notifications
201
+
202
+ - [ ] **Task 20.6**: Add characteristic caching
203
+ - Cache read/write characteristics
204
+ - Clear cache on characteristic missing error
205
+ - Avoid repeated characteristic discovery
206
+
207
+ ### ๐ŸŽฏ Advanced Patterns
208
+
209
+ - [ ] **Task 21.3**: Add multi-command support
210
+ - `sendMultipleCommands()` - Send series, return if any succeed
211
+ - `sendCommandSequence()` - Send series, must all succeed
212
+ - Used for Curtain 3 and newer devices
213
+
214
+ - [ ] **Task 21.4**: Implement basic settings command
215
+ - `getBasicInfo()` - Universal settings retrieval
216
+ - Returns: battery, firmware, device-specific settings
217
+ - Command: `0x57 0x02`
218
+
219
+ - [ ] **Task 21.5**: Add mode setting commands
220
+ - Universal mode setting command: `0x57 0x03`
221
+ - Extended settings command
222
+ - Per-device mode enums
223
+
224
+ - [ ] **Task 21.6**: Add passive polling
225
+ - `PASSIVE_POLL_INTERVAL = 60 * 60 * 24` (24 hours)
226
+ - `pollNeeded()` method
227
+ - Auto-poll inactive devices periodically
228
+
229
+ - [ ] **Task 21.7**: Implement cloud device fetching
230
+ - `getDevices()` - Fetch devices from SwitchBot account
231
+ - Auto-populate model cache from cloud
232
+ - Handle regional APIs (US/CN/EU)
233
+
234
+ ---
235
+
236
+ ## ๐Ÿ“ˆ Medium Priority Enhancements
237
+
238
+ ### Discovery & Advertisement
239
+
240
+ - [ ] **Task 1.4**: Enhance advertisement data structure
241
+ - Add `rawAdvData` field
242
+ - Add `isEncrypted` flag
243
+ - Add `modelFriendlyName` field
244
+
245
+ - [ ] **Task 1.5**: Add advertisement data merging
246
+ - Preserve old values when new data is None
247
+ - Recursive dict merging for nested structures
248
+ - Implement `_merge_data()` helper
249
+
250
+ ### Relay Switch Additional Features
251
+
252
+ - [ ] **Task 5.4**: Add time/energy tracking
253
+ - `getCurrentTimeAndStartTime()` - For energy calculations
254
+ - Command: `0x57 0x0F 0x51 0x01 0x05 0x01 0x00 0x00 0x00`
255
+
256
+ - [ ] **Task 5.5**: Add garage door opener support
257
+ - Variant of relay switch
258
+ - Specific command sequences
259
+ - Model: SwitchBot Relay Switch (garage mode)
260
+
261
+ ### Status Parsing
262
+
263
+ - [ ] **Task 11.1**: Add byte-by-byte response validation
264
+ - Check response length
265
+ - Validate specific byte positions
266
+ - Compare against expected value sets: `{1}`, `{1, 5}`, `{1, 6}`
267
+
268
+ ---
269
+
270
+ ## ๐ŸŽฏ Success Metrics
271
+
272
+ - **Feature Parity**: 90%+ of pySwitchBot commands implemented
273
+ - **Device Coverage**: 95%+ of SwitchBot device types supported
274
+ - **Status Accuracy**: Advertisement-based status for all devices
275
+ - **Connection Efficiency**: 50% reduction in connection overhead via batching
276
+ - **Error Clarity**: Specific error types for all failure modes
277
+
278
+ ---
279
+
280
+ ## ๐Ÿ“ Notes
281
+
282
+ ### Task Completion Process
283
+ 1. Move completed task from this file to `completed.md`
284
+ 2. Add completion date and any notes
285
+ 3. Update "Last Updated" timestamp
286
+ 4. Reference any relevant PRs or commits
287
+
288
+ ### Priority Levels
289
+ - **High Priority**: Core functionality, user-facing features
290
+ - **Medium Priority**: Enhancements, optimizations
291
+ - **Low Priority**: Nice-to-have features
292
+
293
+ ### Reference
294
+ - Full comparison details: [PYSWITCHBOT_COMPARISON.md](../PYSWITCHBOT_COMPARISON.md)
295
+ - pySwitchBot Repository: https://github.com/Danielhiversen/pySwitchbot
296
+ - SwitchBot BLE API: https://github.com/OpenWonderLabs/SwitchBotAPI-BLE
@@ -0,0 +1,17 @@
1
+ {
2
+ "extends": "./tsconfig.json",
3
+ "compilerOptions": {
4
+ "rootDir": "src"
5
+ },
6
+ "include": [
7
+ "src/**/*"
8
+ ],
9
+ "exclude": [
10
+ "test",
11
+ "**/*.spec.ts",
12
+ "**/*.test.ts",
13
+ ".dev-archive/**/*",
14
+ "dist",
15
+ "node_modules"
16
+ ]
17
+ }
@@ -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