node-switchbot 4.0.0-beta.9 → 4.0.1

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 (417) hide show
  1. package/BLE.md +215 -838
  2. package/CHANGELOG.md +163 -1438
  3. package/OpenAPI.md +169 -135
  4. package/README.md +1 -1
  5. package/dist/ble.d.ts +14 -1
  6. package/dist/ble.d.ts.map +1 -1
  7. package/dist/ble.js +241 -39
  8. package/dist/ble.js.map +1 -1
  9. package/dist/devices/base.d.ts +97 -1
  10. package/dist/devices/base.d.ts.map +1 -1
  11. package/dist/devices/base.js +204 -2
  12. package/dist/devices/base.js.map +1 -1
  13. package/dist/devices/device-override-state-during-connection.d.ts +27 -0
  14. package/dist/devices/device-override-state-during-connection.d.ts.map +1 -0
  15. package/dist/devices/device-override-state-during-connection.js +45 -0
  16. package/dist/devices/device-override-state-during-connection.js.map +1 -0
  17. package/dist/devices/index.d.ts +36 -0
  18. package/dist/devices/index.d.ts.map +1 -1
  19. package/dist/devices/index.js +36 -0
  20. package/dist/devices/index.js.map +1 -1
  21. package/dist/devices/sequence-device.d.ts +52 -0
  22. package/dist/devices/sequence-device.d.ts.map +1 -0
  23. package/dist/devices/sequence-device.js +91 -0
  24. package/dist/devices/sequence-device.js.map +1 -0
  25. package/dist/devices/wo-ai-hub.d.ts +9 -0
  26. package/dist/devices/wo-ai-hub.d.ts.map +1 -0
  27. package/dist/devices/wo-ai-hub.js +25 -0
  28. package/dist/devices/wo-ai-hub.js.map +1 -0
  29. package/dist/devices/wo-air-purifier-pm25.d.ts +29 -0
  30. package/dist/devices/wo-air-purifier-pm25.d.ts.map +1 -0
  31. package/dist/devices/wo-air-purifier-pm25.js +144 -0
  32. package/dist/devices/wo-air-purifier-pm25.js.map +1 -0
  33. package/dist/devices/wo-air-purifier.d.ts +21 -4
  34. package/dist/devices/wo-air-purifier.d.ts.map +1 -1
  35. package/dist/devices/wo-air-purifier.js +111 -61
  36. package/dist/devices/wo-air-purifier.js.map +1 -1
  37. package/dist/devices/wo-art-frame.d.ts +8 -0
  38. package/dist/devices/wo-art-frame.d.ts.map +1 -0
  39. package/dist/devices/wo-art-frame.js +12 -0
  40. package/dist/devices/wo-art-frame.js.map +1 -0
  41. package/dist/devices/wo-blind-tilt.d.ts +2 -16
  42. package/dist/devices/wo-blind-tilt.d.ts.map +1 -1
  43. package/dist/devices/wo-blind-tilt.js +135 -62
  44. package/dist/devices/wo-blind-tilt.js.map +1 -1
  45. package/dist/devices/wo-bulb.d.ts +37 -1
  46. package/dist/devices/wo-bulb.d.ts.map +1 -1
  47. package/dist/devices/wo-bulb.js +196 -51
  48. package/dist/devices/wo-bulb.js.map +1 -1
  49. package/dist/devices/wo-candle-warmer-lamp.d.ts +25 -0
  50. package/dist/devices/wo-candle-warmer-lamp.d.ts.map +1 -0
  51. package/dist/devices/wo-candle-warmer-lamp.js +81 -0
  52. package/dist/devices/wo-candle-warmer-lamp.js.map +1 -0
  53. package/dist/devices/wo-circulator-fan.d.ts +8 -0
  54. package/dist/devices/wo-circulator-fan.d.ts.map +1 -0
  55. package/dist/devices/wo-circulator-fan.js +12 -0
  56. package/dist/devices/wo-circulator-fan.js.map +1 -0
  57. package/dist/devices/wo-climate-panel.d.ts +8 -0
  58. package/dist/devices/wo-climate-panel.d.ts.map +1 -0
  59. package/dist/devices/wo-climate-panel.js +12 -0
  60. package/dist/devices/wo-climate-panel.js.map +1 -0
  61. package/dist/devices/wo-contact.d.ts +1 -1
  62. package/dist/devices/wo-contact.d.ts.map +1 -1
  63. package/dist/devices/wo-contact.js +19 -35
  64. package/dist/devices/wo-contact.js.map +1 -1
  65. package/dist/devices/wo-curtain.d.ts +17 -1
  66. package/dist/devices/wo-curtain.d.ts.map +1 -1
  67. package/dist/devices/wo-curtain.js +119 -27
  68. package/dist/devices/wo-curtain.js.map +1 -1
  69. package/dist/devices/wo-floor-lamp.d.ts +8 -0
  70. package/dist/devices/wo-floor-lamp.d.ts.map +1 -0
  71. package/dist/devices/wo-floor-lamp.js +12 -0
  72. package/dist/devices/wo-floor-lamp.js.map +1 -0
  73. package/dist/devices/wo-garage-door-opener.d.ts +8 -0
  74. package/dist/devices/wo-garage-door-opener.d.ts.map +1 -0
  75. package/dist/devices/wo-garage-door-opener.js +12 -0
  76. package/dist/devices/wo-garage-door-opener.js.map +1 -0
  77. package/dist/devices/wo-hand.d.ts +22 -6
  78. package/dist/devices/wo-hand.d.ts.map +1 -1
  79. package/dist/devices/wo-hand.js +55 -39
  80. package/dist/devices/wo-hand.js.map +1 -1
  81. package/dist/devices/wo-hub2.d.ts +1 -1
  82. package/dist/devices/wo-hub2.d.ts.map +1 -1
  83. package/dist/devices/wo-hub2.js +17 -33
  84. package/dist/devices/wo-hub2.js.map +1 -1
  85. package/dist/devices/wo-hubmini-matter.d.ts +8 -0
  86. package/dist/devices/wo-hubmini-matter.d.ts.map +1 -0
  87. package/dist/devices/wo-hubmini-matter.js +12 -0
  88. package/dist/devices/wo-hubmini-matter.js.map +1 -0
  89. package/dist/devices/wo-humi.d.ts +18 -2
  90. package/dist/devices/wo-humi.d.ts.map +1 -1
  91. package/dist/devices/wo-humi.js +60 -36
  92. package/dist/devices/wo-humi.js.map +1 -1
  93. package/dist/devices/wo-humi2.d.ts.map +1 -1
  94. package/dist/devices/wo-humi2.js.map +1 -1
  95. package/dist/devices/wo-keypad-vision-pro.d.ts +18 -0
  96. package/dist/devices/wo-keypad-vision-pro.d.ts.map +1 -0
  97. package/dist/devices/wo-keypad-vision-pro.js +15 -0
  98. package/dist/devices/wo-keypad-vision-pro.js.map +1 -0
  99. package/dist/devices/wo-keypad-vision.d.ts +8 -0
  100. package/dist/devices/wo-keypad-vision.d.ts.map +1 -0
  101. package/dist/devices/wo-keypad-vision.js +12 -0
  102. package/dist/devices/wo-keypad-vision.js.map +1 -0
  103. package/dist/devices/wo-keypad.d.ts +1 -1
  104. package/dist/devices/wo-keypad.d.ts.map +1 -1
  105. package/dist/devices/wo-keypad.js +14 -30
  106. package/dist/devices/wo-keypad.js.map +1 -1
  107. package/dist/devices/wo-leak.d.ts +1 -1
  108. package/dist/devices/wo-leak.d.ts.map +1 -1
  109. package/dist/devices/wo-leak.js +15 -31
  110. package/dist/devices/wo-leak.js.map +1 -1
  111. package/dist/devices/wo-lock-lite.d.ts +7 -0
  112. package/dist/devices/wo-lock-lite.d.ts.map +1 -0
  113. package/dist/devices/wo-lock-lite.js +11 -0
  114. package/dist/devices/wo-lock-lite.js.map +1 -0
  115. package/dist/devices/wo-lock-pro-wifi.d.ts +7 -0
  116. package/dist/devices/wo-lock-pro-wifi.d.ts.map +1 -0
  117. package/dist/devices/wo-lock-pro-wifi.js +11 -0
  118. package/dist/devices/wo-lock-pro-wifi.js.map +1 -0
  119. package/dist/devices/wo-lock-pro.d.ts +12 -3
  120. package/dist/devices/wo-lock-pro.d.ts.map +1 -1
  121. package/dist/devices/wo-lock-pro.js +83 -37
  122. package/dist/devices/wo-lock-pro.js.map +1 -1
  123. package/dist/devices/wo-lock-vision-pro.d.ts +7 -0
  124. package/dist/devices/wo-lock-vision-pro.d.ts.map +1 -0
  125. package/dist/devices/wo-lock-vision-pro.js +11 -0
  126. package/dist/devices/wo-lock-vision-pro.js.map +1 -0
  127. package/dist/devices/wo-lock-vision.d.ts +7 -0
  128. package/dist/devices/wo-lock-vision.d.ts.map +1 -0
  129. package/dist/devices/wo-lock-vision.js +11 -0
  130. package/dist/devices/wo-lock-vision.js.map +1 -0
  131. package/dist/devices/wo-lock.d.ts +8 -3
  132. package/dist/devices/wo-lock.d.ts.map +1 -1
  133. package/dist/devices/wo-lock.js +75 -36
  134. package/dist/devices/wo-lock.js.map +1 -1
  135. package/dist/devices/wo-pan-tilt-cam-plus-3k.d.ts +21 -0
  136. package/dist/devices/wo-pan-tilt-cam-plus-3k.d.ts.map +1 -0
  137. package/dist/devices/wo-pan-tilt-cam-plus-3k.js +87 -0
  138. package/dist/devices/wo-pan-tilt-cam-plus-3k.js.map +1 -0
  139. package/dist/devices/wo-plug-mini-us.d.ts +3 -3
  140. package/dist/devices/wo-plug-mini-us.d.ts.map +1 -1
  141. package/dist/devices/wo-plug-mini-us.js +25 -35
  142. package/dist/devices/wo-plug-mini-us.js.map +1 -1
  143. package/dist/devices/wo-presence.d.ts +1 -1
  144. package/dist/devices/wo-presence.d.ts.map +1 -1
  145. package/dist/devices/wo-presence.js +17 -33
  146. package/dist/devices/wo-presence.js.map +1 -1
  147. package/dist/devices/wo-relay-switch-1.d.ts +19 -3
  148. package/dist/devices/wo-relay-switch-1.d.ts.map +1 -1
  149. package/dist/devices/wo-relay-switch-1.js +90 -42
  150. package/dist/devices/wo-relay-switch-1.js.map +1 -1
  151. package/dist/devices/wo-relay-switch-2pm.d.ts +21 -0
  152. package/dist/devices/wo-relay-switch-2pm.d.ts.map +1 -0
  153. package/dist/devices/wo-relay-switch-2pm.js +37 -0
  154. package/dist/devices/wo-relay-switch-2pm.js.map +1 -0
  155. package/dist/devices/wo-remote-with-screen.d.ts +9 -0
  156. package/dist/devices/wo-remote-with-screen.d.ts.map +1 -0
  157. package/dist/devices/wo-remote-with-screen.js +22 -0
  158. package/dist/devices/wo-remote-with-screen.js.map +1 -0
  159. package/dist/devices/wo-remote.d.ts +1 -1
  160. package/dist/devices/wo-remote.d.ts.map +1 -1
  161. package/dist/devices/wo-remote.js +13 -29
  162. package/dist/devices/wo-remote.js.map +1 -1
  163. package/dist/devices/wo-rgbic-bulb.d.ts +29 -0
  164. package/dist/devices/wo-rgbic-bulb.d.ts.map +1 -0
  165. package/dist/devices/wo-rgbic-bulb.js +84 -0
  166. package/dist/devices/wo-rgbic-bulb.js.map +1 -0
  167. package/dist/devices/wo-rgbic-neon-wire-rope-light.d.ts +29 -0
  168. package/dist/devices/wo-rgbic-neon-wire-rope-light.d.ts.map +1 -0
  169. package/dist/devices/wo-rgbic-neon-wire-rope-light.js +113 -0
  170. package/dist/devices/wo-rgbic-neon-wire-rope-light.js.map +1 -0
  171. package/dist/devices/wo-rgbicww-floor-lamp.d.ts +8 -0
  172. package/dist/devices/wo-rgbicww-floor-lamp.d.ts.map +1 -0
  173. package/dist/devices/wo-rgbicww-floor-lamp.js +12 -0
  174. package/dist/devices/wo-rgbicww-floor-lamp.js.map +1 -0
  175. package/dist/devices/wo-rgbicww-strip-light.d.ts +8 -0
  176. package/dist/devices/wo-rgbicww-strip-light.d.ts.map +1 -0
  177. package/dist/devices/wo-rgbicww-strip-light.js +12 -0
  178. package/dist/devices/wo-rgbicww-strip-light.js.map +1 -0
  179. package/dist/devices/wo-roller-shade.d.ts +8 -0
  180. package/dist/devices/wo-roller-shade.d.ts.map +1 -0
  181. package/dist/devices/wo-roller-shade.js +12 -0
  182. package/dist/devices/wo-roller-shade.js.map +1 -0
  183. package/dist/devices/wo-sensor-th.d.ts +1 -1
  184. package/dist/devices/wo-sensor-th.d.ts.map +1 -1
  185. package/dist/devices/wo-sensor-th.js +18 -34
  186. package/dist/devices/wo-sensor-th.js.map +1 -1
  187. package/dist/devices/wo-smart-thermostat-radiator.d.ts +8 -0
  188. package/dist/devices/wo-smart-thermostat-radiator.d.ts.map +1 -0
  189. package/dist/devices/wo-smart-thermostat-radiator.js +12 -0
  190. package/dist/devices/wo-smart-thermostat-radiator.js.map +1 -0
  191. package/dist/devices/wo-strip-light-3.d.ts +8 -0
  192. package/dist/devices/wo-strip-light-3.d.ts.map +1 -0
  193. package/dist/devices/wo-strip-light-3.js +12 -0
  194. package/dist/devices/wo-strip-light-3.js.map +1 -0
  195. package/dist/devices/wo-vacuum-k10-plus.d.ts +7 -0
  196. package/dist/devices/wo-vacuum-k10-plus.d.ts.map +1 -0
  197. package/dist/devices/wo-vacuum-k10-plus.js +11 -0
  198. package/dist/devices/wo-vacuum-k10-plus.js.map +1 -0
  199. package/dist/devices/wo-vacuum-k10-pro-combo.d.ts +7 -0
  200. package/dist/devices/wo-vacuum-k10-pro-combo.d.ts.map +1 -0
  201. package/dist/devices/wo-vacuum-k10-pro-combo.js +11 -0
  202. package/dist/devices/wo-vacuum-k10-pro-combo.js.map +1 -0
  203. package/dist/devices/wo-vacuum-k10-pro.d.ts +7 -0
  204. package/dist/devices/wo-vacuum-k10-pro.d.ts.map +1 -0
  205. package/dist/devices/wo-vacuum-k10-pro.js +11 -0
  206. package/dist/devices/wo-vacuum-k10-pro.js.map +1 -0
  207. package/dist/devices/wo-vacuum-k11-plus.d.ts +7 -0
  208. package/dist/devices/wo-vacuum-k11-plus.d.ts.map +1 -0
  209. package/dist/devices/wo-vacuum-k11-plus.js +11 -0
  210. package/dist/devices/wo-vacuum-k11-plus.js.map +1 -0
  211. package/dist/devices/wo-vacuum-k20.d.ts +7 -0
  212. package/dist/devices/wo-vacuum-k20.d.ts.map +1 -0
  213. package/dist/devices/wo-vacuum-k20.js +11 -0
  214. package/dist/devices/wo-vacuum-k20.js.map +1 -0
  215. package/dist/devices/wo-vacuum-s10.d.ts +7 -0
  216. package/dist/devices/wo-vacuum-s10.d.ts.map +1 -0
  217. package/dist/devices/wo-vacuum-s10.js +11 -0
  218. package/dist/devices/wo-vacuum-s10.js.map +1 -0
  219. package/dist/devices/wo-vacuum-s20.d.ts +7 -0
  220. package/dist/devices/wo-vacuum-s20.d.ts.map +1 -0
  221. package/dist/devices/wo-vacuum-s20.js +11 -0
  222. package/dist/devices/wo-vacuum-s20.js.map +1 -0
  223. package/dist/devices/wo-vacuum.d.ts +44 -0
  224. package/dist/devices/wo-vacuum.d.ts.map +1 -0
  225. package/dist/devices/wo-vacuum.js +143 -0
  226. package/dist/devices/wo-vacuum.js.map +1 -0
  227. package/dist/devices/wo-water-detector.d.ts +9 -0
  228. package/dist/devices/wo-water-detector.d.ts.map +1 -0
  229. package/dist/devices/wo-water-detector.js +20 -0
  230. package/dist/devices/wo-water-detector.js.map +1 -0
  231. package/dist/errors.d.ts +20 -0
  232. package/dist/errors.d.ts.map +1 -1
  233. package/dist/errors.js +31 -1
  234. package/dist/errors.js.map +1 -1
  235. package/dist/index.d.ts +4 -2
  236. package/dist/index.d.ts.map +1 -1
  237. package/dist/index.js +3 -1
  238. package/dist/index.js.map +1 -1
  239. package/dist/settings.d.ts +25 -0
  240. package/dist/settings.d.ts.map +1 -1
  241. package/dist/settings.js +86 -6
  242. package/dist/settings.js.map +1 -1
  243. package/dist/switchbot.d.ts +1 -0
  244. package/dist/switchbot.d.ts.map +1 -1
  245. package/dist/switchbot.js +152 -34
  246. package/dist/switchbot.js.map +1 -1
  247. package/dist/types/ble.d.ts +6 -0
  248. package/dist/types/ble.d.ts.map +1 -1
  249. package/dist/types/ble.js.map +1 -1
  250. package/dist/types/device.d.ts +81 -2
  251. package/dist/types/device.d.ts.map +1 -1
  252. package/dist/types/index.d.ts +18 -0
  253. package/dist/types/index.d.ts.map +1 -1
  254. package/dist/types/index.js.map +1 -1
  255. package/dist/utils/fallback-handler.js +0 -1
  256. package/dist/utils/fallback-handler.js.map +1 -1
  257. package/dist/utils/index.d.ts +21 -1
  258. package/dist/utils/index.d.ts.map +1 -1
  259. package/dist/utils/index.js +49 -0
  260. package/dist/utils/index.js.map +1 -1
  261. package/dist/utils/relay-encryption.d.ts +10 -0
  262. package/dist/utils/relay-encryption.d.ts.map +1 -0
  263. package/dist/utils/relay-encryption.js +23 -0
  264. package/dist/utils/relay-encryption.js.map +1 -0
  265. package/dist/utils/retry.d.ts.map +1 -1
  266. package/dist/utils/retry.js +49 -6
  267. package/dist/utils/retry.js.map +1 -1
  268. package/package.json +32 -16
  269. package/.gitattributes +0 -2
  270. package/.github/copilot-instructions.md +0 -179
  271. package/.github/dependabot.yml +0 -17
  272. package/.github/labeler.yml +0 -38
  273. package/.github/npm-version-script-esm.js +0 -97
  274. package/.github/workflows/beta-release.yml +0 -52
  275. package/.github/workflows/release.yml +0 -71
  276. package/.github/workflows/stale.yml +0 -12
  277. package/branding/Node_x_SwitchBot.svg +0 -8
  278. package/branding/icon.png +0 -0
  279. package/branding/switchbot.png +0 -0
  280. package/docs/.nojekyll +0 -1
  281. package/docs/assets/hierarchy.js +0 -1
  282. package/docs/assets/highlight.css +0 -85
  283. package/docs/assets/icons.js +0 -18
  284. package/docs/assets/icons.svg +0 -1
  285. package/docs/assets/main.js +0 -60
  286. package/docs/assets/navigation.js +0 -1
  287. package/docs/assets/search.js +0 -1
  288. package/docs/assets/style.css +0 -1633
  289. package/docs/classes/APIError.html +0 -6
  290. package/docs/classes/APINotAvailableError.html +0 -4
  291. package/docs/classes/BLEConnection.html +0 -21
  292. package/docs/classes/BLENotAvailableError.html +0 -4
  293. package/docs/classes/BLEScanner.html +0 -17
  294. package/docs/classes/CommandFailedError.html +0 -6
  295. package/docs/classes/ConnectionTimeoutError.html +0 -5
  296. package/docs/classes/DeviceManager.html +0 -25
  297. package/docs/classes/DeviceNotFoundError.html +0 -4
  298. package/docs/classes/DiscoveryError.html +0 -5
  299. package/docs/classes/OpenAPIClient.html +0 -66
  300. package/docs/classes/SwitchBot.html +0 -22
  301. package/docs/classes/SwitchBotDevice.html +0 -56
  302. package/docs/classes/SwitchBotError.html +0 -4
  303. package/docs/classes/ValidationError.html +0 -5
  304. package/docs/classes/WoAirPurifier.html +0 -63
  305. package/docs/classes/WoAirPurifierTable.html +0 -64
  306. package/docs/classes/WoBlindTilt.html +0 -67
  307. package/docs/classes/WoBulb.html +0 -65
  308. package/docs/classes/WoCeilingLight.html +0 -66
  309. package/docs/classes/WoContact.html +0 -55
  310. package/docs/classes/WoCurtain.html +0 -63
  311. package/docs/classes/WoHand.html +0 -69
  312. package/docs/classes/WoHub2.html +0 -55
  313. package/docs/classes/WoHub3.html +0 -56
  314. package/docs/classes/WoHumi.html +0 -63
  315. package/docs/classes/WoHumi2.html +0 -64
  316. package/docs/classes/WoIOSensorTH.html +0 -56
  317. package/docs/classes/WoKeypad.html +0 -56
  318. package/docs/classes/WoLeak.html +0 -55
  319. package/docs/classes/WoPlugMiniJP.html +0 -62
  320. package/docs/classes/WoPlugMiniUS.html +0 -61
  321. package/docs/classes/WoPresence.html +0 -55
  322. package/docs/classes/WoRelaySwitch1.html +0 -61
  323. package/docs/classes/WoRelaySwitch1PM.html +0 -62
  324. package/docs/classes/WoRemote.html +0 -56
  325. package/docs/classes/WoSensorTH.html +0 -55
  326. package/docs/classes/WoSensorTHPlus.html +0 -56
  327. package/docs/classes/WoSensorTHPro.html +0 -56
  328. package/docs/classes/WoSensorTHProCO2.html +0 -56
  329. package/docs/classes/WoSmartLock.html +0 -59
  330. package/docs/classes/WoSmartLockPro.html +0 -61
  331. package/docs/classes/WoStrip.html +0 -66
  332. package/docs/enums/LogLevel.html +0 -7
  333. package/docs/enums/SwitchBotBLEModel.html +0 -40
  334. package/docs/enums/SwitchBotBLEModelName.html +0 -40
  335. package/docs/functions/updateBaseURL.html +0 -3
  336. package/docs/hierarchy.html +0 -1
  337. package/docs/index.html +0 -55
  338. package/docs/interfaces/APICommandRequest.html +0 -5
  339. package/docs/interfaces/APICommandResponse.html +0 -5
  340. package/docs/interfaces/APIDevice.html +0 -18
  341. package/docs/interfaces/APIDeviceStatus.html +0 -36
  342. package/docs/interfaces/APIErrorResponse.html +0 -5
  343. package/docs/interfaces/APIResponse.html +0 -5
  344. package/docs/interfaces/AirPurifierCommands.html +0 -5
  345. package/docs/interfaces/AirPurifierServiceData.html +0 -29
  346. package/docs/interfaces/AirPurifierStatus.html +0 -17
  347. package/docs/interfaces/BLEAdvertisement.html +0 -7
  348. package/docs/interfaces/BLEScanOptions.html +0 -10
  349. package/docs/interfaces/BLEServiceData.html +0 -27
  350. package/docs/interfaces/BlindTiltCommands.html +0 -7
  351. package/docs/interfaces/BlindTiltServiceData.html +0 -30
  352. package/docs/interfaces/BlindTiltStatus.html +0 -15
  353. package/docs/interfaces/BotCommands.html +0 -4
  354. package/docs/interfaces/BotServiceData.html +0 -27
  355. package/docs/interfaces/BotStatus.html +0 -14
  356. package/docs/interfaces/BulbCommands.html +0 -6
  357. package/docs/interfaces/BulbServiceData.html +0 -35
  358. package/docs/interfaces/BulbStatus.html +0 -16
  359. package/docs/interfaces/CeilingLightCommands.html +0 -6
  360. package/docs/interfaces/CeilingLightServiceData.html +0 -35
  361. package/docs/interfaces/CeilingLightStatus.html +0 -16
  362. package/docs/interfaces/CommandResult.html +0 -12
  363. package/docs/interfaces/ContactServiceData.html +0 -30
  364. package/docs/interfaces/ContactStatus.html +0 -15
  365. package/docs/interfaces/CurtainCommands.html +0 -5
  366. package/docs/interfaces/CurtainServiceData.html +0 -31
  367. package/docs/interfaces/CurtainStatus.html +0 -17
  368. package/docs/interfaces/DeviceInfo.html +0 -36
  369. package/docs/interfaces/DeviceListResponse.html +0 -4
  370. package/docs/interfaces/DeviceStatus.html +0 -12
  371. package/docs/interfaces/DiscoveryOptions.html +0 -14
  372. package/docs/interfaces/HubServiceData.html +0 -31
  373. package/docs/interfaces/HubStatus.html +0 -15
  374. package/docs/interfaces/HumidifierCommands.html +0 -5
  375. package/docs/interfaces/HumidifierServiceData.html +0 -31
  376. package/docs/interfaces/HumidifierStatus.html +0 -18
  377. package/docs/interfaces/KeypadStatus.html +0 -13
  378. package/docs/interfaces/LeakServiceData.html +0 -28
  379. package/docs/interfaces/LeakStatus.html +0 -13
  380. package/docs/interfaces/LockCommands.html +0 -3
  381. package/docs/interfaces/LockServiceData.html +0 -29
  382. package/docs/interfaces/LockStatus.html +0 -15
  383. package/docs/interfaces/MeterServiceData.html +0 -30
  384. package/docs/interfaces/MeterStatus.html +0 -15
  385. package/docs/interfaces/MotionServiceData.html +0 -30
  386. package/docs/interfaces/MotionStatus.html +0 -14
  387. package/docs/interfaces/PlugCommands.html +0 -4
  388. package/docs/interfaces/PlugServiceData.html +0 -33
  389. package/docs/interfaces/PlugStatus.html +0 -16
  390. package/docs/interfaces/PresenceServiceData.html +0 -29
  391. package/docs/interfaces/PresenceStatus.html +0 -14
  392. package/docs/interfaces/RelaySwitchCommands.html +0 -4
  393. package/docs/interfaces/RelaySwitchServiceData.html +0 -30
  394. package/docs/interfaces/RelaySwitchStatus.html +0 -16
  395. package/docs/interfaces/RemoteStatus.html +0 -12
  396. package/docs/interfaces/SceneListResponse.html +0 -3
  397. package/docs/interfaces/StripCommands.html +0 -6
  398. package/docs/interfaces/StripServiceData.html +0 -35
  399. package/docs/interfaces/StripStatus.html +0 -16
  400. package/docs/interfaces/SwitchBotConfig.html +0 -30
  401. package/docs/interfaces/WebhookConfig.html +0 -4
  402. package/docs/interfaces/WebhookDetails.html +0 -7
  403. package/docs/interfaces/WebhookQueryResponse.html +0 -5
  404. package/docs/interfaces/WebhookSetupResponse.html +0 -5
  405. package/docs/media/BLE.md +0 -1259
  406. package/docs/media/OpenAPI.md +0 -186
  407. package/docs/modules.html +0 -1
  408. package/docs/types/ConnectionType.html +0 -2
  409. package/docs/types/PhysicalDeviceType.html +0 -2
  410. package/docs/types/VirtualDeviceType.html +0 -2
  411. package/docs/variables/urls.html +0 -1
  412. package/tmp-switchbot-scan.mjs +0 -79
  413. package/todo/PYSWITCHBOT_COMPARISON.md +0 -484
  414. package/todo/README.md +0 -68
  415. package/todo/completed.md +0 -65
  416. package/todo/todo.md +0 -369
  417. package/tsconfig.build.json +0 -17
@@ -1 +1 @@
1
- {"version":3,"file":"wo-relay-switch-1.d.ts","sourceRoot":"","sources":["../../src/devices/wo-relay-switch-1.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAA;AAGhF,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAA;AAE3C;;GAEG;AACH,qBAAa,cAAe,SAAQ,eAAgB,YAAW,mBAAmB;IAChF;;OAEG;IACG,MAAM,IAAI,OAAO,CAAC,OAAO,CAAC;IAQhC;;OAEG;IACG,OAAO,IAAI,OAAO,CAAC,OAAO,CAAC;IAQjC;;OAEG;IACG,MAAM,IAAI,OAAO,CAAC,OAAO,CAAC;IAQhC;;OAEG;IACG,SAAS,IAAI,OAAO,CAAC,iBAAiB,CAAC;CAmC9C"}
1
+ {"version":3,"file":"wo-relay-switch-1.d.ts","sourceRoot":"","sources":["../../src/devices/wo-relay-switch-1.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAA;AAEhF,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AAKpC,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AAErD;;GAEG;AACH,qBAAa,cAAe,SAAQ,cAAe,YAAW,mBAAmB;IAC/E;;OAEG;IACH,OAAO,CAAC,eAAe;IAIvB;;OAEG;IACH,SAAS,CAAC,mBAAmB,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,MAAM,EAAE,GAAG,MAAM;IAStE;;;OAGG;IACG,mBAAmB,IAAI,OAAO,CAAC,OAAO,CAAC;IAiB7C,OAAO,CAAC,uBAAuB;YAmBjB,uBAAuB;IAiBrC;;OAEG;IACG,MAAM,IAAI,OAAO,CAAC,OAAO,CAAC;IAMhC;;OAEG;IACG,OAAO,IAAI,OAAO,CAAC,OAAO,CAAC;IAMjC;;OAEG;IACG,MAAM,IAAI,OAAO,CAAC,OAAO,CAAC;IAMhC;;OAEG;IACG,SAAS,IAAI,OAAO,CAAC,iBAAiB,CAAC;CAuB9C"}
@@ -1,70 +1,118 @@
1
- /* Copyright(C) 2024-2026, donavanbecker (https://github.com/donavanbecker). All rights reserved.
2
- *
3
- * devices/wo-relay-switch-1.ts: SwitchBot v4.0.0 - Relay Switch 1 Device
4
- */
1
+ import { Buffer } from 'node:buffer';
5
2
  import { DEVICE_COMMANDS } from '../settings.js';
6
- import { SwitchBotDevice } from './base.js';
3
+ import { validateResponseLength } from '../utils/index.js';
4
+ import { encryptRelayCommandIfNeeded } from '../utils/relay-encryption.js';
5
+ import { SequenceDevice } from './sequence-device.js';
7
6
  /**
8
7
  * Relay Switch 1 Device (1-channel)
9
8
  */
10
- export class WoRelaySwitch1 extends SwitchBotDevice {
9
+ export class WoRelaySwitch1 extends SequenceDevice {
10
+ /**
11
+ * Returns true if this relay switch requires BLE encryption (encryptionKey present)
12
+ */
13
+ needsEncryption() {
14
+ return !!this.info.encryptionKey;
15
+ }
16
+ /**
17
+ * Encrypts a command if encryption is required for this device
18
+ */
19
+ maybeEncryptCommand(cmd) {
20
+ // Convert readonly arrays to mutable arrays for compatibility
21
+ const arr = Buffer.isBuffer(cmd) ? cmd : Buffer.from([...cmd]);
22
+ if (!this.needsEncryption()) {
23
+ return arr;
24
+ }
25
+ return encryptRelayCommandIfNeeded(arr, this.info.encryptionKey, this.info.encryptionIV);
26
+ }
27
+ /**
28
+ * Verifies the BLE encryption key by attempting a status read with encryption.
29
+ * Throws an error if the key is invalid or the device rejects the command.
30
+ */
31
+ async verifyEncryptionKey() {
32
+ if (!this.needsEncryption()) {
33
+ throw new Error('No encryptionKey set for this device');
34
+ }
35
+ try {
36
+ // Try to get status with encryption; if the key is wrong, device will reject or return invalid data
37
+ const command = this.maybeEncryptCommand([...DEVICE_COMMANDS.COMMON.POWER_ON]);
38
+ const result = await this.sendCommand(command, 'verifyEncryptionKey');
39
+ if (!result.success) {
40
+ throw new Error('Encryption key verification failed: device did not accept encrypted command');
41
+ }
42
+ return true;
43
+ }
44
+ catch (err) {
45
+ throw new Error(`Encryption key verification failed: ${err?.message || err}`);
46
+ }
47
+ }
48
+ parseRelayPowerResponse(buffer) {
49
+ validateResponseLength(buffer, 11, 'WoRelaySwitch1:parseRelayPowerResponse');
50
+ // Best-effort parsing aligned with relay basic-info responses.
51
+ const voltageRaw = buffer.readUInt16BE(5);
52
+ const currentRaw = buffer.readUInt16BE(7);
53
+ const energyRaw = buffer.readUInt16BE(9);
54
+ return {
55
+ voltage: voltageRaw / 10,
56
+ electricCurrent: currentRaw / 100,
57
+ electricityOfDay: energyRaw / 100,
58
+ };
59
+ }
60
+ async getRelayPowerMonitoring() {
61
+ if (!this.hasBLE()) {
62
+ return {};
63
+ }
64
+ const result = await this.sendBLECommand(DEVICE_COMMANDS.RELAY.GET_BASIC_INFO);
65
+ if (!result.success || !result.data || !Buffer.isBuffer(result.data)) {
66
+ return {};
67
+ }
68
+ return this.parseRelayPowerResponse(result.data);
69
+ }
11
70
  /**
12
71
  * Turn on
13
72
  */
14
73
  async turnOn() {
15
- const result = await this.sendCommand(DEVICE_COMMANDS.COMMON.POWER_ON, 'turnOn');
74
+ const command = this.maybeEncryptCommand([...DEVICE_COMMANDS.COMMON.POWER_ON]);
75
+ const result = await this.sendCommand(command, 'turnOn');
16
76
  return result.success;
17
77
  }
18
78
  /**
19
79
  * Turn off
20
80
  */
21
81
  async turnOff() {
22
- const result = await this.sendCommand(DEVICE_COMMANDS.COMMON.POWER_OFF, 'turnOff');
82
+ const command = this.maybeEncryptCommand([...DEVICE_COMMANDS.COMMON.POWER_OFF]);
83
+ const result = await this.sendCommand(command, 'turnOff');
23
84
  return result.success;
24
85
  }
25
86
  /**
26
87
  * Toggle power
27
88
  */
28
89
  async toggle() {
29
- const result = await this.sendCommand(DEVICE_COMMANDS.PLUG.TOGGLE, 'toggle');
90
+ const command = this.maybeEncryptCommand([...DEVICE_COMMANDS.PLUG.TOGGLE]);
91
+ const result = await this.sendCommand(command, 'toggle');
30
92
  return result.success;
31
93
  }
32
94
  /**
33
- * Get device status
95
+ * Get device status (BLE-first, API-fallback)
34
96
  */
35
97
  async getStatus() {
36
- try {
37
- // Try API first if available
38
- if (this.hasAPI()) {
39
- const apiStatus = await this.getAPIStatus();
40
- return {
41
- deviceId: this.info.id,
42
- connectionType: 'api',
43
- power: apiStatus.power || 'off',
44
- voltage: apiStatus.voltage,
45
- electricCurrent: apiStatus.electricCurrent,
46
- electricityOfDay: apiStatus.electricityOfDay,
47
- version: apiStatus.version,
48
- updatedAt: new Date(),
49
- };
50
- }
51
- // Fallback to BLE
52
- if (this.hasBLE()) {
53
- const bleData = await this.getBLEStatus().catch(() => this.normalizeBLEStatusData(undefined));
54
- return {
55
- deviceId: this.info.id,
56
- connectionType: 'ble',
57
- power: bleData.state ? 'on' : 'off',
58
- voltage: bleData.voltage,
59
- updatedAt: new Date(),
60
- };
61
- }
62
- throw new Error('No connection method available');
63
- }
64
- catch (error) {
65
- this.logger.error('Failed to get status', error);
66
- throw error;
67
- }
98
+ return this.getStatusWithFallback(bleData => ({
99
+ deviceId: this.info.id,
100
+ connectionType: 'ble',
101
+ power: bleData.state ? 'on' : 'off',
102
+ voltage: bleData.voltage,
103
+ electricCurrent: bleData.electricCurrent,
104
+ electricityOfDay: bleData.electricityOfDay,
105
+ updatedAt: new Date(),
106
+ }), apiStatus => ({
107
+ deviceId: this.info.id,
108
+ connectionType: 'api',
109
+ power: apiStatus.power || 'off',
110
+ voltage: apiStatus.voltage,
111
+ electricCurrent: apiStatus.electricCurrent,
112
+ electricityOfDay: apiStatus.electricityOfDay,
113
+ version: apiStatus.version,
114
+ updatedAt: new Date(),
115
+ }));
68
116
  }
69
117
  }
70
118
  //# sourceMappingURL=wo-relay-switch-1.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"wo-relay-switch-1.js","sourceRoot":"","sources":["../../src/devices/wo-relay-switch-1.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAA;AAChD,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAA;AAE3C;;GAEG;AACH,MAAM,OAAO,cAAe,SAAQ,eAAe;IACjD;;OAEG;IACH,KAAK,CAAC,MAAM;QACV,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,WAAW,CACnC,eAAe,CAAC,MAAM,CAAC,QAAQ,EAC/B,QAAQ,CACT,CAAA;QACD,OAAO,MAAM,CAAC,OAAO,CAAA;IACvB,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,OAAO;QACX,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,WAAW,CACnC,eAAe,CAAC,MAAM,CAAC,SAAS,EAChC,SAAS,CACV,CAAA;QACD,OAAO,MAAM,CAAC,OAAO,CAAA;IACvB,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,MAAM;QAC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AAK,EAAE,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK;YACnC,OAAO,EAAE,OAAO,CAAC,OAAO;YACxB,eAAe,EAAE,OAAO,CAAC,eAAe;YACxC,gBAAgB,EAAE,OAAO,CAAC,gBAAgB;YAC1C,SAAS,EAAE,IAAI,IAAI,EAAE;SACtB,CAAC,EACF,SAAS,CAAC,EAAE,CAAC,CAAC;YACZ,QAAQ,EAAE,IAAI,CAAC,IAAI,CAAC,EAAE;YACtB,cAAc,EAAE,KAAK;YACrB,KAAK,EAAE,SAAS,CAAC,KAAK,IAAI,KAAK;YAC/B,OAAO,EAAE,SAAS,CAAC,OAAO;YAC1B,eAAe,EAAE,SAAS,CAAC,eAAe;YAC1C,gBAAgB,EAAE,SAAS,CAAC,gBAAgB;YAC5C,OAAO,EAAE,SAAS,CAAC,OAAO;YAC1B,SAAS,EAAE,IAAI,IAAI,EAAE;SACtB,CAAC,CACH,CAAA;IACH,CAAC;CACF"}
@@ -0,0 +1,21 @@
1
+ import type { RelaySwitchChannelCommands, RelaySwitchStatus } from '../types/device.js';
2
+ import { WoRelaySwitch1 } from './wo-relay-switch-1.js';
3
+ /**
4
+ * Relay Switch 2PM Device (2-channel with power monitoring)
5
+ * Extends Relay Switch 1 with channel-specific control
6
+ */
7
+ export declare class WoRelaySwitch2PM extends WoRelaySwitch1 implements RelaySwitchChannelCommands {
8
+ /**
9
+ * Set channel 1 state
10
+ */
11
+ setChannel1(state: boolean): Promise<boolean>;
12
+ /**
13
+ * Set channel 2 state
14
+ */
15
+ setChannel2(state: boolean): Promise<boolean>;
16
+ /**
17
+ * Get device status (inherited, same as 1PM)
18
+ */
19
+ getStatus(): Promise<RelaySwitchStatus>;
20
+ }
21
+ //# sourceMappingURL=wo-relay-switch-2pm.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wo-relay-switch-2pm.d.ts","sourceRoot":"","sources":["../../src/devices/wo-relay-switch-2pm.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,0BAA0B,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAA;AAGvF,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAA;AAEvD;;;GAGG;AACH,qBAAa,gBAAiB,SAAQ,cAAe,YAAW,0BAA0B;IACxF;;OAEG;IACG,WAAW,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;IAOnD;;OAEG;IACG,WAAW,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;IAOnD;;OAEG;IACG,SAAS,IAAI,OAAO,CAAC,iBAAiB,CAAC;CAG9C"}
@@ -0,0 +1,37 @@
1
+ /* Copyright(C) 2024-2026, donavanbecker (https://github.com/donavanbecker). All rights reserved.
2
+ *
3
+ * devices/wo-relay-switch-2pm.ts: SwitchBot v4.0.0 - Relay Switch 2PM Device
4
+ */
5
+ import { DEVICE_COMMANDS } from '../settings.js';
6
+ import { WoRelaySwitch1 } from './wo-relay-switch-1.js';
7
+ /**
8
+ * Relay Switch 2PM Device (2-channel with power monitoring)
9
+ * Extends Relay Switch 1 with channel-specific control
10
+ */
11
+ export class WoRelaySwitch2PM extends WoRelaySwitch1 {
12
+ /**
13
+ * Set channel 1 state
14
+ */
15
+ async setChannel1(state) {
16
+ const raw = state ? DEVICE_COMMANDS.RELAY.CHANNEL1_ON : DEVICE_COMMANDS.RELAY.CHANNEL1_OFF;
17
+ const command = this.maybeEncryptCommand([...raw]);
18
+ const result = await this.sendCommand(command, `setChannel1:${state}`);
19
+ return result.success;
20
+ }
21
+ /**
22
+ * Set channel 2 state
23
+ */
24
+ async setChannel2(state) {
25
+ const raw = state ? DEVICE_COMMANDS.RELAY.CHANNEL2_ON : DEVICE_COMMANDS.RELAY.CHANNEL2_OFF;
26
+ const command = this.maybeEncryptCommand([...raw]);
27
+ const result = await this.sendCommand(command, `setChannel2:${state}`);
28
+ return result.success;
29
+ }
30
+ /**
31
+ * Get device status (inherited, same as 1PM)
32
+ */
33
+ async getStatus() {
34
+ return super.getStatus();
35
+ }
36
+ }
37
+ //# sourceMappingURL=wo-relay-switch-2pm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wo-relay-switch-2pm.js","sourceRoot":"","sources":["../../src/devices/wo-relay-switch-2pm.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAA;AAChD,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAA;AAEvD;;;GAGG;AACH,MAAM,OAAO,gBAAiB,SAAQ,cAAc;IAClD;;OAEG;IACH,KAAK,CAAC,WAAW,CAAC,KAAc;QAC9B,MAAM,GAAG,GAAG,KAAK,CAAC,CAAC,CAAC,eAAe,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC,CAAC,eAAe,CAAC,KAAK,CAAC,YAAY,CAAA;QAC1F,MAAM,OAAO,GAAG,IAAI,CAAC,mBAAmB,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC,CAAA;QAClD,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,WAAW,CAAC,OAAO,EAAE,eAAe,KAAK,EAAE,CAAC,CAAA;QACtE,OAAO,MAAM,CAAC,OAAO,CAAA;IACvB,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,WAAW,CAAC,KAAc;QAC9B,MAAM,GAAG,GAAG,KAAK,CAAC,CAAC,CAAC,eAAe,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC,CAAC,eAAe,CAAC,KAAK,CAAC,YAAY,CAAA;QAC1F,MAAM,OAAO,GAAG,IAAI,CAAC,mBAAmB,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC,CAAA;QAClD,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,WAAW,CAAC,OAAO,EAAE,eAAe,KAAK,EAAE,CAAC,CAAA;QACtE,OAAO,MAAM,CAAC,OAAO,CAAA;IACvB,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,SAAS;QACb,OAAO,KAAK,CAAC,SAAS,EAAE,CAAA;IAC1B,CAAC;CACF"}
@@ -0,0 +1,9 @@
1
+ import type { DeviceStatus } from '../types/index.js';
2
+ import { SwitchBotDevice } from './base.js';
3
+ export declare class WoRemoteWithScreen extends SwitchBotDevice {
4
+ /**
5
+ * Get device status (BLE-first, API-fallback)
6
+ */
7
+ getStatus(): Promise<DeviceStatus>;
8
+ }
9
+ //# sourceMappingURL=wo-remote-with-screen.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wo-remote-with-screen.d.ts","sourceRoot":"","sources":["../../src/devices/wo-remote-with-screen.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAErD,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAA;AAE3C,qBAAa,kBAAmB,SAAQ,eAAe;IACrD;;OAEG;IACG,SAAS,IAAI,OAAO,CAAC,YAAY,CAAC;CAkBzC"}
@@ -0,0 +1,22 @@
1
+ import { SwitchBotDevice } from './base.js';
2
+ export class WoRemoteWithScreen extends SwitchBotDevice {
3
+ /**
4
+ * Get device status (BLE-first, API-fallback)
5
+ */
6
+ async getStatus() {
7
+ return this.getStatusWithFallback(bleData => ({
8
+ deviceId: this.info.id,
9
+ connectionType: 'ble',
10
+ updatedAt: new Date(),
11
+ battery: bleData.battery,
12
+ version: bleData.version,
13
+ }), apiStatus => ({
14
+ deviceId: this.info.id,
15
+ connectionType: 'api',
16
+ updatedAt: new Date(),
17
+ battery: apiStatus.battery,
18
+ version: apiStatus.version,
19
+ }));
20
+ }
21
+ }
22
+ //# sourceMappingURL=wo-remote-with-screen.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wo-remote-with-screen.js","sourceRoot":"","sources":["../../src/devices/wo-remote-with-screen.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAA;AAE3C,MAAM,OAAO,kBAAmB,SAAQ,eAAe;IACrD;;OAEG;IACH,KAAK,CAAC,SAAS;QACb,OAAO,IAAI,CAAC,qBAAqB,CAC/B,OAAO,CAAC,EAAE,CAAC,CAAC;YACV,QAAQ,EAAE,IAAI,CAAC,IAAI,CAAC,EAAE;YACtB,cAAc,EAAE,KAAK;YACrB,SAAS,EAAE,IAAI,IAAI,EAAE;YACrB,OAAO,EAAE,OAAO,CAAC,OAAO;YACxB,OAAO,EAAE,OAAO,CAAC,OAAO;SACzB,CAAC,EACF,SAAS,CAAC,EAAE,CAAC,CAAC;YACZ,QAAQ,EAAE,IAAI,CAAC,IAAI,CAAC,EAAE;YACtB,cAAc,EAAE,KAAK;YACrB,SAAS,EAAE,IAAI,IAAI,EAAE;YACrB,OAAO,EAAE,SAAS,CAAC,OAAO;YAC1B,OAAO,EAAE,SAAS,CAAC,OAAO;SAC3B,CAAC,CACH,CAAA;IACH,CAAC;CACF"}
@@ -6,7 +6,7 @@ import { SwitchBotDevice } from './base.js';
6
6
  */
7
7
  export declare class WoRemote extends SwitchBotDevice {
8
8
  /**
9
- * Get device status
9
+ * Get device status (BLE-first, API-fallback)
10
10
  */
11
11
  getStatus(): Promise<RemoteStatus>;
12
12
  }
@@ -1 +1 @@
1
- {"version":3,"file":"wo-remote.d.ts","sourceRoot":"","sources":["../../src/devices/wo-remote.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AAEtD,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAA;AAE3C;;;GAGG;AACH,qBAAa,QAAS,SAAQ,eAAe;IAC3C;;OAEG;IACG,SAAS,IAAI,OAAO,CAAC,YAAY,CAAC;CA+BzC"}
1
+ {"version":3,"file":"wo-remote.d.ts","sourceRoot":"","sources":["../../src/devices/wo-remote.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AAEtD,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAA;AAE3C;;;GAGG;AACH,qBAAa,QAAS,SAAQ,eAAe;IAC3C;;OAEG;IACG,SAAS,IAAI,OAAO,CAAC,YAAY,CAAC;CAiBzC"}
@@ -9,37 +9,21 @@ import { SwitchBotDevice } from './base.js';
9
9
  */
10
10
  export class WoRemote extends SwitchBotDevice {
11
11
  /**
12
- * Get device status
12
+ * Get device status (BLE-first, API-fallback)
13
13
  */
14
14
  async getStatus() {
15
- try {
16
- // Try API first if available
17
- if (this.hasAPI()) {
18
- const apiStatus = await this.getAPIStatus();
19
- return {
20
- deviceId: this.info.id,
21
- connectionType: 'api',
22
- battery: apiStatus.battery,
23
- version: apiStatus.version,
24
- updatedAt: new Date(),
25
- };
26
- }
27
- // Fallback to BLE
28
- if (this.hasBLE()) {
29
- const bleData = await this.getBLEStatus();
30
- return {
31
- deviceId: this.info.id,
32
- connectionType: 'ble',
33
- battery: bleData.battery,
34
- updatedAt: new Date(),
35
- };
36
- }
37
- throw new Error('No connection method available');
38
- }
39
- catch (error) {
40
- this.logger.error('Failed to get status', error);
41
- throw error;
42
- }
15
+ return this.getStatusWithFallback(bleData => ({
16
+ deviceId: this.info.id,
17
+ connectionType: 'ble',
18
+ battery: bleData.battery,
19
+ updatedAt: new Date(),
20
+ }), apiStatus => ({
21
+ deviceId: this.info.id,
22
+ connectionType: 'api',
23
+ battery: apiStatus.battery,
24
+ version: apiStatus.version,
25
+ updatedAt: new Date(),
26
+ }));
43
27
  }
44
28
  }
45
29
  //# sourceMappingURL=wo-remote.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"wo-remote.js","sourceRoot":"","sources":["../../src/devices/wo-remote.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAA;AAE3C;;;GAGG;AACH,MAAM,OAAO,QAAS,SAAQ,eAAe;IAC3C;;OAEG;IACH,KAAK,CAAC,SAAS;QACb,IAAI,CAAC;YACH,6BAA6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AK;YACrB,OAAO,EAAE,OAAO,CAAC,OAAO;YACxB,SAAS,EAAE,IAAI,IAAI,EAAE;SACtB,CAAC,EACF,SAAS,CAAC,EAAE,CAAC,CAAC;YACZ,QAAQ,EAAE,IAAI,CAAC,IAAI,CAAC,EAAE;YACtB,cAAc,EAAE,KAAK;YACrB,OAAO,EAAE,SAAS,CAAC,OAAO;YAC1B,OAAO,EAAE,SAAS,CAAC,OAAO;YAC1B,SAAS,EAAE,IAAI,IAAI,EAAE;SACtB,CAAC,CACH,CAAA;IACH,CAAC;CACF"}
@@ -0,0 +1,29 @@
1
+ import type { RGBICBulbCommands, RGBICBulbStatus } from '../types/device.js';
2
+ import { WoBulb } from './wo-bulb.js';
3
+ /**
4
+ * RGBIC Bulb Device with segmented/multi-zone color control
5
+ * Supports individual LED segment control for addressable RGB+IC strips
6
+ */
7
+ export declare class WoRGBICBulb extends WoBulb implements RGBICBulbCommands {
8
+ private static readonly RGBIC_EFFECTS;
9
+ /**
10
+ * Set color for individual LED segment
11
+ * @param segmentId - Segment identifier (0-based index)
12
+ * @param red - Red value (0-255)
13
+ * @param green - Green value (0-255)
14
+ * @param blue - Blue value (0-255)
15
+ */
16
+ setSegmentColor(segmentId: number, red: number, green: number, blue: number): Promise<boolean>;
17
+ /**
18
+ * Set effect for individual LED segment
19
+ * @param segmentId - Segment identifier (0-based index)
20
+ * @param effectName - Effect name from RGBIC_EFFECTS
21
+ * @param speed - Effect speed (1-100, default: 50)
22
+ */
23
+ setSegmentEffect(segmentId: number, effectName: string, speed?: number): Promise<boolean>;
24
+ /**
25
+ * Get device status (inherited from WoBulb, centralized fallback)
26
+ */
27
+ getStatus(): Promise<RGBICBulbStatus>;
28
+ }
29
+ //# sourceMappingURL=wo-rgbic-bulb.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wo-rgbic-bulb.d.ts","sourceRoot":"","sources":["../../src/devices/wo-rgbic-bulb.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAA;AAG5E,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AAErC;;;GAGG;AACH,qBAAa,WAAY,SAAQ,MAAO,YAAW,iBAAiB;IAClE,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,aAAa,CA4BpC;IAED;;;;;;OAMG;IACG,eAAe,CAAC,SAAS,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAkBpG;;;;;OAKG;IACG,gBAAgB,CAAC,SAAS,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,KAAK,SAAK,GAAG,OAAO,CAAC,OAAO,CAAC;IAoB3F;;OAEG;IACG,SAAS,IAAI,OAAO,CAAC,eAAe,CAAC;CAG5C"}
@@ -0,0 +1,84 @@
1
+ /* Copyright(C) 2024-2026, donavanbecker (https://github.com/donavanbecker). All rights reserved.
2
+ *
3
+ * devices/wo-rgbic-bulb.ts: SwitchBot v4.0.0 - RGBIC Color Bulb with Segmented Control
4
+ */
5
+ import { clamp } from '../utils/index.js';
6
+ import { WoBulb } from './wo-bulb.js';
7
+ /**
8
+ * RGBIC Bulb Device with segmented/multi-zone color control
9
+ * Supports individual LED segment control for addressable RGB+IC strips
10
+ */
11
+ export class WoRGBICBulb extends WoBulb {
12
+ static RGBIC_EFFECTS = {
13
+ // Standard effects (compatible with WoBulb)
14
+ christmas: 0x00,
15
+ candle: 0x01,
16
+ halloween: 0x02,
17
+ sunset: 0x03,
18
+ party: 0x04,
19
+ reading: 0x05,
20
+ rainbow: 0x06,
21
+ forest: 0x07,
22
+ ocean: 0x08,
23
+ spring: 0x09,
24
+ summer: 0x0A,
25
+ autumn: 0x0B,
26
+ winter: 0x0C,
27
+ aurora: 0x0D,
28
+ meteor: 0x0E,
29
+ firework: 0x0F,
30
+ breathe: 0x10,
31
+ pulse: 0x11,
32
+ flicker: 0x12,
33
+ pet: 0x13,
34
+ // RGBIC-specific effects
35
+ segment_cycle: 0x20,
36
+ segment_wave: 0x21,
37
+ segment_chase: 0x22,
38
+ segment_strobe: 0x23,
39
+ segment_twinkle: 0x24,
40
+ };
41
+ /**
42
+ * Set color for individual LED segment
43
+ * @param segmentId - Segment identifier (0-based index)
44
+ * @param red - Red value (0-255)
45
+ * @param green - Green value (0-255)
46
+ * @param blue - Blue value (0-255)
47
+ */
48
+ async setSegmentColor(segmentId, red, green, blue) {
49
+ const segId = clamp(segmentId, 0, 255);
50
+ const r = clamp(red, 0, 255);
51
+ const g = clamp(green, 0, 255);
52
+ const b = clamp(blue, 0, 255);
53
+ // Command format for segment color: varies by device
54
+ // Using extended command format: 0x57 0x0F 0x47 0x01 0x13 SEG_ID R G B
55
+ const bleCommand = [0x57, 0x0F, 0x47, 0x01, 0x13, segId, r, g, b];
56
+ const result = await this.sendCommand(bleCommand, 'setSegmentColor', `seg${segId}:${r}:${g}:${b}`);
57
+ return result.success;
58
+ }
59
+ /**
60
+ * Set effect for individual LED segment
61
+ * @param segmentId - Segment identifier (0-based index)
62
+ * @param effectName - Effect name from RGBIC_EFFECTS
63
+ * @param speed - Effect speed (1-100, default: 50)
64
+ */
65
+ async setSegmentEffect(segmentId, effectName, speed = 50) {
66
+ const effectId = WoRGBICBulb.RGBIC_EFFECTS[effectName.toLowerCase()];
67
+ if (effectId === undefined) {
68
+ throw new Error(`Unsupported RGBIC effect: ${effectName}`);
69
+ }
70
+ const segId = clamp(segmentId, 0, 255);
71
+ const effectSpeed = clamp(speed, 1, 100);
72
+ // Command format for segment effect: 0x57 0x0F 0x47 0x01 0x14 SEG_ID EFFECT_ID SPEED
73
+ const bleCommand = [0x57, 0x0F, 0x47, 0x01, 0x14, segId, effectId, effectSpeed];
74
+ const result = await this.sendCommand(bleCommand, 'setSegmentEffect', `seg${segId}:${effectName}:${effectSpeed}`);
75
+ return result.success;
76
+ }
77
+ /**
78
+ * Get device status (inherited from WoBulb, centralized fallback)
79
+ */
80
+ async getStatus() {
81
+ return super.getStatus();
82
+ }
83
+ }
84
+ //# sourceMappingURL=wo-rgbic-bulb.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wo-rgbic-bulb.js","sourceRoot":"","sources":["../../src/devices/wo-rgbic-bulb.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AACzC,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AAErC;;;GAGG;AACH,MAAM,OAAO,WAAY,SAAQ,MAAM;IAC7B,MAAM,CAAU,aAAa,GAA2B;QAC9D,4CAA4C;QAC5C,SAAS,EAAE,IAAI;QACf,MAAM,EAAE,IAAI;QACZ,SAAS,EAAE,IAAI;QACf,MAAM,EAAE,IAAI;QACZ,KAAK,EAAE,IAAI;QACX,OAAO,EAAE,IAAI;QACb,OAAO,EAAE,IAAI;QACb,MAAM,EAAE,IAAI;QACZ,KAAK,EAAE,IAAI;QACX,MAAM,EAAE,IAAI;QACZ,MAAM,EAAE,IAAI;QACZ,MAAM,EAAE,IAAI;QACZ,MAAM,EAAE,IAAI;QACZ,MAAM,EAAE,IAAI;QACZ,MAAM,EAAE,IAAI;QACZ,QAAQ,EAAE,IAAI;QACd,OAAO,EAAE,IAAI;QACb,KAAK,EAAE,IAAI;QACX,OAAO,EAAE,IAAI;QACb,GAAG,EAAE,IAAI;QACT,yBAAyB;QACzB,aAAa,EAAE,IAAI;QACnB,YAAY,EAAE,IAAI;QAClB,aAAa,EAAE,IAAI;QACnB,cAAc,EAAE,IAAI;QACpB,eAAe,EAAE,IAAI;KACtB,CAAA;IAED;;;;;;OAMG;IACH,KAAK,CAAC,eAAe,CAAC,SAAiB,EAAE,GAAW,EAAE,KAAa,EAAE,IAAY;QAC/E,MAAM,KAAK,GAAG,KAAK,CAAC,SAAS,EAAE,CAAC,EAAE,GAAG,CAAC,CAAA;QACtC,MAAM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,CAAC,WAAW,CACnC,UAAU,EACV,kBAAkB,EAClB,MAAM,KAAK,IAAI,UAAU,IAAI,WAAW,EAAE,CAC3C,CAAA;QACD,OAAO,MAAM,CAAC,OAAO,CAAA;IACvB,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,SAAS;QACb,OAAO,KAAK,CAAC,SAAS,EAAE,CAAA;IAC1B,CAAC"}
@@ -0,0 +1,29 @@
1
+ import type { RGBICBulbStatus } from '../types/device.js';
2
+ import { SwitchBotDevice } from './base.js';
3
+ export declare class WoRGBICNeonWireRopeLight extends SwitchBotDevice {
4
+ /**
5
+ * Get device status (BLE-first/API-fallback, centralized)
6
+ */
7
+ getStatus(): Promise<RGBICBulbStatus>;
8
+ /**
9
+ * Turn on the neon wire rope light
10
+ */
11
+ turnOn(): Promise<boolean>;
12
+ /**
13
+ * Turn off the neon wire rope light
14
+ */
15
+ turnOff(): Promise<boolean>;
16
+ /**
17
+ * Set brightness (1-100)
18
+ */
19
+ setBrightness(level: number): Promise<boolean>;
20
+ /**
21
+ * Set color (RGB)
22
+ */
23
+ setColor(red: number, green: number, blue: number): Promise<boolean>;
24
+ /**
25
+ * Set color temperature (Kelvin)
26
+ */
27
+ setColorTemperature(temperature: number): Promise<boolean>;
28
+ }
29
+ //# sourceMappingURL=wo-rgbic-neon-wire-rope-light.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wo-rgbic-neon-wire-rope-light.d.ts","sourceRoot":"","sources":["../../src/devices/wo-rgbic-neon-wire-rope-light.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAA;AAIzD,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAA;AAE3C,qBAAa,wBAAyB,SAAQ,eAAe;IAC3D;;OAEG;IACG,SAAS,IAAI,OAAO,CAAC,eAAe,CAAC;IAuB3C;;OAEG;IACG,MAAM,IAAI,OAAO,CAAC,OAAO,CAAC;IAehC;;OAEG;IACG,OAAO,IAAI,OAAO,CAAC,OAAO,CAAC;IAejC;;OAEG;IACG,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAgBpD;;OAEG;IACG,QAAQ,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAe1E;;OAEG;IACG,mBAAmB,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;CAcjE"}
@@ -0,0 +1,113 @@
1
+ import { Buffer } from 'node:buffer';
2
+ import { SwitchBotDevice } from './base.js';
3
+ export class WoRGBICNeonWireRopeLight extends SwitchBotDevice {
4
+ /**
5
+ * Get device status (BLE-first/API-fallback, centralized)
6
+ */
7
+ async getStatus() {
8
+ return this.getStatusWithFallback(bleData => ({
9
+ deviceId: this.info.id,
10
+ connectionType: 'ble',
11
+ updatedAt: new Date(),
12
+ power: bleData.state ? 'on' : 'off',
13
+ brightness: bleData.brightness,
14
+ colorTemperature: bleData.colorTemperature,
15
+ color: bleData.red !== undefined ? { r: bleData.red, g: bleData.green, b: bleData.blue } : undefined,
16
+ }), apiStatus => ({
17
+ deviceId: this.info.id,
18
+ connectionType: 'api',
19
+ updatedAt: new Date(),
20
+ power: apiStatus.power,
21
+ brightness: apiStatus.brightness,
22
+ colorTemperature: apiStatus.colorTemperature,
23
+ color: apiStatus.color,
24
+ }));
25
+ }
26
+ /**
27
+ * Turn on the neon wire rope light
28
+ */
29
+ async turnOn() {
30
+ if (this.hasBLE()) {
31
+ const command = Buffer.from([0x57, 0x01, 0x01]);
32
+ const result = await this.sendCommand(command, 'turnOn');
33
+ if (result.success) {
34
+ return true;
35
+ }
36
+ }
37
+ if (this.hasAPI()) {
38
+ const result = await this.sendAPICommand('turnOn');
39
+ return result.success;
40
+ }
41
+ throw new Error('No connection method available');
42
+ }
43
+ /**
44
+ * Turn off the neon wire rope light
45
+ */
46
+ async turnOff() {
47
+ if (this.hasBLE()) {
48
+ const command = Buffer.from([0x57, 0x01, 0x02]);
49
+ const result = await this.sendCommand(command, 'turnOff');
50
+ if (result.success) {
51
+ return true;
52
+ }
53
+ }
54
+ if (this.hasAPI()) {
55
+ const result = await this.sendAPICommand('turnOff');
56
+ return result.success;
57
+ }
58
+ throw new Error('No connection method available');
59
+ }
60
+ /**
61
+ * Set brightness (1-100)
62
+ */
63
+ async setBrightness(level) {
64
+ const clamped = Math.max(1, Math.min(100, level));
65
+ if (this.hasBLE()) {
66
+ const command = Buffer.from([0x57, 0x02, clamped]);
67
+ const result = await this.sendCommand(command, 'setBrightness', clamped);
68
+ if (result.success) {
69
+ return true;
70
+ }
71
+ }
72
+ if (this.hasAPI()) {
73
+ const result = await this.sendAPICommand('setBrightness', clamped);
74
+ return result.success;
75
+ }
76
+ throw new Error('No connection method available');
77
+ }
78
+ /**
79
+ * Set color (RGB)
80
+ */
81
+ async setColor(red, green, blue) {
82
+ if (this.hasBLE()) {
83
+ const command = Buffer.from([0x57, 0x03, red, green, blue]);
84
+ const result = await this.sendCommand(command, 'setColor', { red, green, blue });
85
+ if (result.success) {
86
+ return true;
87
+ }
88
+ }
89
+ if (this.hasAPI()) {
90
+ const result = await this.sendAPICommand('setColor', { red, green, blue });
91
+ return result.success;
92
+ }
93
+ throw new Error('No connection method available');
94
+ }
95
+ /**
96
+ * Set color temperature (Kelvin)
97
+ */
98
+ async setColorTemperature(temperature) {
99
+ if (this.hasBLE()) {
100
+ const command = Buffer.from([0x57, 0x04, temperature & 0xFF, (temperature >> 8) & 0xFF]);
101
+ const result = await this.sendCommand(command, 'setColorTemperature', temperature);
102
+ if (result.success) {
103
+ return true;
104
+ }
105
+ }
106
+ if (this.hasAPI()) {
107
+ const result = await this.sendAPICommand('setColorTemperature', temperature);
108
+ return result.success;
109
+ }
110
+ throw new Error('No connection method available');
111
+ }
112
+ }
113
+ //# sourceMappingURL=wo-rgbic-neon-wire-rope-light.js.map