node-switchbot 3.6.5 → 4.0.0-beta.0

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 (548) hide show
  1. package/.github/npm-version-script-esm.js +97 -0
  2. package/CHANGELOG.md +586 -0
  3. package/PRODUCTION_READY.md +135 -0
  4. package/README.md +92 -0
  5. package/dist/api.d.ts +130 -0
  6. package/dist/api.d.ts.map +1 -0
  7. package/dist/api.js +286 -0
  8. package/dist/api.js.map +1 -0
  9. package/dist/ble.d.ts +116 -0
  10. package/dist/ble.d.ts.map +1 -0
  11. package/dist/ble.js +430 -0
  12. package/dist/ble.js.map +1 -0
  13. package/dist/devices/base.d.ts +146 -0
  14. package/dist/devices/base.d.ts.map +1 -0
  15. package/dist/devices/base.js +324 -0
  16. package/dist/devices/base.js.map +1 -0
  17. package/dist/devices/index.d.ts +30 -0
  18. package/dist/devices/index.d.ts.map +1 -0
  19. package/dist/devices/index.js +34 -0
  20. package/dist/devices/index.js.map +1 -0
  21. package/dist/devices/wo-air-purifier-table.d.ts +8 -0
  22. package/dist/devices/wo-air-purifier-table.d.ts.map +1 -0
  23. package/dist/devices/wo-air-purifier-table.js +12 -0
  24. package/dist/devices/wo-air-purifier-table.js.map +1 -0
  25. package/dist/devices/wo-air-purifier.d.ts +28 -0
  26. package/dist/devices/wo-air-purifier.d.ts.map +1 -0
  27. package/dist/devices/wo-air-purifier.js +105 -0
  28. package/dist/devices/wo-air-purifier.js.map +1 -0
  29. package/dist/devices/wo-blind-tilt.d.ts +36 -0
  30. package/dist/devices/wo-blind-tilt.d.ts.map +1 -0
  31. package/dist/devices/wo-blind-tilt.js +95 -0
  32. package/dist/devices/wo-blind-tilt.js.map +1 -0
  33. package/dist/devices/wo-bulb.d.ts +32 -0
  34. package/dist/devices/wo-bulb.d.ts.map +1 -0
  35. package/dist/devices/wo-bulb.js +109 -0
  36. package/dist/devices/wo-bulb.js.map +1 -0
  37. package/dist/devices/wo-ceiling-light.d.ts +8 -0
  38. package/dist/devices/wo-ceiling-light.d.ts.map +1 -0
  39. package/dist/devices/wo-ceiling-light.js +12 -0
  40. package/dist/devices/wo-ceiling-light.js.map +1 -0
  41. package/dist/devices/wo-contact.d.ts +12 -0
  42. package/dist/devices/wo-contact.d.ts.map +1 -0
  43. package/dist/devices/wo-contact.js +50 -0
  44. package/dist/devices/wo-contact.js.map +1 -0
  45. package/dist/devices/wo-curtain.d.ts +28 -0
  46. package/dist/devices/wo-curtain.d.ts.map +1 -0
  47. package/dist/devices/wo-curtain.js +82 -0
  48. package/dist/devices/wo-curtain.js.map +1 -0
  49. package/dist/devices/wo-hand.d.ts +24 -0
  50. package/dist/devices/wo-hand.d.ts.map +1 -0
  51. package/dist/devices/wo-hand.js +70 -0
  52. package/dist/devices/wo-hand.js.map +1 -0
  53. package/dist/devices/wo-hub2.d.ts +12 -0
  54. package/dist/devices/wo-hub2.d.ts.map +1 -0
  55. package/dist/devices/wo-hub2.js +48 -0
  56. package/dist/devices/wo-hub2.js.map +1 -0
  57. package/dist/devices/wo-hub3.d.ts +8 -0
  58. package/dist/devices/wo-hub3.d.ts.map +1 -0
  59. package/dist/devices/wo-hub3.js +12 -0
  60. package/dist/devices/wo-hub3.js.map +1 -0
  61. package/dist/devices/wo-humi.d.ts +28 -0
  62. package/dist/devices/wo-humi.d.ts.map +1 -0
  63. package/dist/devices/wo-humi.js +91 -0
  64. package/dist/devices/wo-humi.js.map +1 -0
  65. package/dist/devices/wo-humi2.d.ts +8 -0
  66. package/dist/devices/wo-humi2.d.ts.map +1 -0
  67. package/dist/devices/wo-humi2.js +12 -0
  68. package/dist/devices/wo-humi2.js.map +1 -0
  69. package/dist/devices/wo-io-sensor-th.d.ts +8 -0
  70. package/dist/devices/wo-io-sensor-th.d.ts.map +1 -0
  71. package/dist/devices/wo-io-sensor-th.js +12 -0
  72. package/dist/devices/wo-io-sensor-th.js.map +1 -0
  73. package/dist/devices/wo-keypad.d.ts +13 -0
  74. package/dist/devices/wo-keypad.d.ts.map +1 -0
  75. package/dist/devices/wo-keypad.js +46 -0
  76. package/dist/devices/wo-keypad.js.map +1 -0
  77. package/dist/devices/wo-leak.d.ts +12 -0
  78. package/dist/devices/wo-leak.d.ts.map +1 -0
  79. package/dist/devices/wo-leak.js +46 -0
  80. package/dist/devices/wo-leak.js.map +1 -0
  81. package/dist/devices/wo-lock-pro.d.ts +24 -0
  82. package/dist/devices/wo-lock-pro.d.ts.map +1 -0
  83. package/dist/devices/wo-lock-pro.js +72 -0
  84. package/dist/devices/wo-lock-pro.js.map +1 -0
  85. package/dist/devices/wo-lock.d.ts +20 -0
  86. package/dist/devices/wo-lock.d.ts.map +1 -0
  87. package/dist/devices/wo-lock.js +64 -0
  88. package/dist/devices/wo-lock.js.map +1 -0
  89. package/dist/devices/wo-plug-mini-jp.d.ts +8 -0
  90. package/dist/devices/wo-plug-mini-jp.d.ts.map +1 -0
  91. package/dist/devices/wo-plug-mini-jp.js +12 -0
  92. package/dist/devices/wo-plug-mini-jp.js.map +1 -0
  93. package/dist/devices/wo-plug-mini-us.d.ts +24 -0
  94. package/dist/devices/wo-plug-mini-us.d.ts.map +1 -0
  95. package/dist/devices/wo-plug-mini-us.js +70 -0
  96. package/dist/devices/wo-plug-mini-us.js.map +1 -0
  97. package/dist/devices/wo-presence.d.ts +12 -0
  98. package/dist/devices/wo-presence.d.ts.map +1 -0
  99. package/dist/devices/wo-presence.js +48 -0
  100. package/dist/devices/wo-presence.js.map +1 -0
  101. package/dist/devices/wo-relay-switch-1.d.ts +24 -0
  102. package/dist/devices/wo-relay-switch-1.d.ts.map +1 -0
  103. package/dist/devices/wo-relay-switch-1.js +70 -0
  104. package/dist/devices/wo-relay-switch-1.js.map +1 -0
  105. package/dist/devices/wo-relay-switch-1pm.d.ts +8 -0
  106. package/dist/devices/wo-relay-switch-1pm.d.ts.map +1 -0
  107. package/dist/devices/wo-relay-switch-1pm.js +12 -0
  108. package/dist/devices/wo-relay-switch-1pm.js.map +1 -0
  109. package/dist/devices/wo-remote.d.ts +13 -0
  110. package/dist/devices/wo-remote.d.ts.map +1 -0
  111. package/dist/devices/wo-remote.js +45 -0
  112. package/dist/devices/wo-remote.js.map +1 -0
  113. package/dist/devices/wo-sensor-th-plus.d.ts +8 -0
  114. package/dist/devices/wo-sensor-th-plus.d.ts.map +1 -0
  115. package/dist/devices/wo-sensor-th-plus.js +12 -0
  116. package/dist/devices/wo-sensor-th-plus.js.map +1 -0
  117. package/dist/devices/wo-sensor-th-pro-co2.d.ts +8 -0
  118. package/dist/devices/wo-sensor-th-pro-co2.d.ts.map +1 -0
  119. package/dist/devices/wo-sensor-th-pro-co2.js +12 -0
  120. package/dist/devices/wo-sensor-th-pro-co2.js.map +1 -0
  121. package/dist/devices/wo-sensor-th-pro.d.ts +8 -0
  122. package/dist/devices/wo-sensor-th-pro.d.ts.map +1 -0
  123. package/dist/devices/wo-sensor-th-pro.js +12 -0
  124. package/dist/devices/wo-sensor-th-pro.js.map +1 -0
  125. package/dist/devices/wo-sensor-th.d.ts +12 -0
  126. package/dist/devices/wo-sensor-th.d.ts.map +1 -0
  127. package/dist/devices/wo-sensor-th.js +49 -0
  128. package/dist/devices/wo-sensor-th.js.map +1 -0
  129. package/dist/devices/wo-strip.d.ts +8 -0
  130. package/dist/devices/wo-strip.d.ts.map +1 -0
  131. package/dist/devices/wo-strip.js +12 -0
  132. package/dist/devices/wo-strip.js.map +1 -0
  133. package/dist/errors.d.ts +63 -0
  134. package/dist/errors.d.ts.map +1 -0
  135. package/dist/errors.js +103 -0
  136. package/dist/errors.js.map +1 -0
  137. package/dist/index.d.ts +10 -6
  138. package/dist/index.d.ts.map +1 -1
  139. package/dist/index.js +9 -10
  140. package/dist/index.js.map +1 -1
  141. package/dist/settings.d.ts +126 -47
  142. package/dist/settings.d.ts.map +1 -1
  143. package/dist/settings.js +214 -64
  144. package/dist/settings.js.map +1 -1
  145. package/dist/switchbot.d.ts +80 -0
  146. package/dist/switchbot.d.ts.map +1 -0
  147. package/dist/switchbot.js +376 -0
  148. package/dist/switchbot.js.map +1 -0
  149. package/dist/types/api.d.ts +187 -0
  150. package/dist/types/api.d.ts.map +1 -0
  151. package/dist/types/api.js +6 -0
  152. package/dist/types/api.js.map +1 -0
  153. package/dist/types/ble.d.ts +246 -343
  154. package/dist/types/ble.d.ts.map +1 -1
  155. package/dist/types/ble.js +94 -1
  156. package/dist/types/ble.js.map +1 -1
  157. package/dist/types/device.d.ts +209 -0
  158. package/dist/types/device.d.ts.map +1 -0
  159. package/dist/types/device.js +6 -0
  160. package/dist/types/device.js.map +1 -0
  161. package/dist/types/index.d.ts +115 -0
  162. package/dist/types/index.d.ts.map +1 -0
  163. package/dist/types/index.js +19 -0
  164. package/dist/types/index.js.map +1 -0
  165. package/dist/utils/index.d.ts +97 -0
  166. package/dist/utils/index.d.ts.map +1 -0
  167. package/dist/utils/index.js +206 -0
  168. package/dist/utils/index.js.map +1 -0
  169. package/docs/assets/hierarchy.js +1 -1
  170. package/docs/assets/highlight.css +20 -6
  171. package/docs/assets/icons.js +1 -1
  172. package/docs/assets/icons.svg +1 -1
  173. package/docs/assets/main.js +2 -2
  174. package/docs/assets/navigation.js +1 -1
  175. package/docs/assets/search.js +1 -1
  176. package/docs/assets/style.css +3 -3
  177. package/docs/classes/APIError.html +6 -0
  178. package/docs/classes/APINotAvailableError.html +4 -0
  179. package/docs/classes/BLEConnection.html +17 -0
  180. package/docs/classes/BLENotAvailableError.html +4 -0
  181. package/docs/classes/BLEScanner.html +15 -0
  182. package/docs/classes/CommandFailedError.html +6 -0
  183. package/docs/classes/ConnectionTimeoutError.html +5 -0
  184. package/docs/classes/DeviceManager.html +25 -0
  185. package/docs/classes/DeviceNotFoundError.html +4 -0
  186. package/docs/classes/DiscoveryError.html +5 -0
  187. package/docs/classes/OpenAPIClient.html +66 -0
  188. package/docs/classes/SwitchBot.html +21 -0
  189. package/docs/classes/SwitchBotDevice.html +28 -0
  190. package/docs/classes/SwitchBotError.html +4 -0
  191. package/docs/classes/ValidationError.html +5 -0
  192. package/docs/classes/WoAirPurifier.html +32 -80
  193. package/docs/classes/WoAirPurifierTable.html +36 -83
  194. package/docs/classes/WoBlindTilt.html +34 -73
  195. package/docs/classes/WoBulb.html +33 -85
  196. package/docs/classes/WoCeilingLight.html +38 -107
  197. package/docs/classes/WoContact.html +27 -52
  198. package/docs/classes/WoCurtain.html +32 -69
  199. package/docs/classes/WoHand.html +30 -59
  200. package/docs/classes/WoHub2.html +27 -52
  201. package/docs/classes/WoHub3.html +28 -52
  202. package/docs/classes/WoHumi.html +33 -65
  203. package/docs/classes/WoHumi2.html +36 -67
  204. package/docs/classes/WoIOSensorTH.html +28 -53
  205. package/docs/classes/WoKeypad.html +28 -52
  206. package/docs/classes/WoLeak.html +27 -53
  207. package/docs/classes/WoPlugMiniJP.html +34 -78
  208. package/docs/classes/WoPlugMiniUS.html +30 -75
  209. package/docs/classes/WoPresence.html +27 -60
  210. package/docs/classes/WoRelaySwitch1.html +31 -55
  211. package/docs/classes/WoRelaySwitch1PM.html +34 -57
  212. package/docs/classes/WoRemote.html +28 -52
  213. package/docs/classes/WoSensorTH.html +27 -46
  214. package/docs/classes/WoSensorTHPlus.html +28 -46
  215. package/docs/classes/WoSensorTHPro.html +28 -46
  216. package/docs/classes/WoSensorTHProCO2.html +28 -46
  217. package/docs/classes/WoSmartLock.html +29 -111
  218. package/docs/classes/WoSmartLockPro.html +31 -111
  219. package/docs/classes/WoStrip.html +38 -94
  220. package/docs/enums/LogLevel.html +4 -7
  221. package/docs/enums/SwitchBotBLEModel.html +11 -5
  222. package/docs/enums/SwitchBotBLEModelName.html +13 -6
  223. package/docs/functions/updateBaseURL.html +3 -3
  224. package/docs/hierarchy.html +1 -1
  225. package/docs/index.html +40 -6
  226. package/docs/interfaces/APICommandRequest.html +5 -0
  227. package/docs/interfaces/APICommandResponse.html +5 -0
  228. package/docs/interfaces/APIDevice.html +18 -0
  229. package/docs/interfaces/APIDeviceStatus.html +36 -0
  230. package/docs/interfaces/APIErrorResponse.html +5 -0
  231. package/docs/interfaces/APIResponse.html +5 -0
  232. package/docs/interfaces/AirPurifierCommands.html +5 -0
  233. package/docs/interfaces/AirPurifierServiceData.html +14 -0
  234. package/docs/interfaces/AirPurifierStatus.html +17 -0
  235. package/docs/interfaces/BLEAdvertisement.html +6 -0
  236. package/docs/interfaces/BLEScanOptions.html +10 -0
  237. package/docs/interfaces/BLEServiceData.html +10 -0
  238. package/docs/interfaces/BlindTiltCommands.html +7 -0
  239. package/docs/interfaces/BlindTiltServiceData.html +14 -0
  240. package/docs/interfaces/BlindTiltStatus.html +15 -0
  241. package/docs/interfaces/BotCommands.html +4 -0
  242. package/docs/interfaces/BotServiceData.html +12 -0
  243. package/docs/interfaces/BotStatus.html +14 -0
  244. package/docs/interfaces/BulbCommands.html +6 -0
  245. package/docs/interfaces/BulbServiceData.html +19 -0
  246. package/docs/interfaces/BulbStatus.html +16 -0
  247. package/docs/interfaces/CeilingLightCommands.html +6 -0
  248. package/docs/interfaces/CeilingLightServiceData.html +19 -0
  249. package/docs/interfaces/CeilingLightStatus.html +16 -0
  250. package/docs/interfaces/CommandResult.html +12 -0
  251. package/docs/interfaces/ContactServiceData.html +13 -0
  252. package/docs/interfaces/ContactStatus.html +15 -0
  253. package/docs/interfaces/CurtainCommands.html +5 -0
  254. package/docs/interfaces/CurtainServiceData.html +14 -0
  255. package/docs/interfaces/CurtainStatus.html +17 -0
  256. package/docs/interfaces/DeviceInfo.html +26 -0
  257. package/docs/interfaces/DeviceListResponse.html +4 -0
  258. package/docs/interfaces/DeviceStatus.html +12 -0
  259. package/docs/interfaces/DiscoveryOptions.html +14 -0
  260. package/docs/interfaces/HubServiceData.html +14 -0
  261. package/docs/interfaces/HubStatus.html +15 -0
  262. package/docs/interfaces/HumidifierCommands.html +5 -0
  263. package/docs/interfaces/HumidifierServiceData.html +14 -0
  264. package/docs/interfaces/HumidifierStatus.html +18 -0
  265. package/docs/interfaces/KeypadStatus.html +13 -0
  266. package/docs/interfaces/LeakServiceData.html +11 -0
  267. package/docs/interfaces/LeakStatus.html +13 -0
  268. package/docs/interfaces/LockCommands.html +3 -0
  269. package/docs/interfaces/LockServiceData.html +15 -0
  270. package/docs/interfaces/LockStatus.html +15 -0
  271. package/docs/interfaces/MeterServiceData.html +13 -0
  272. package/docs/interfaces/MeterStatus.html +15 -0
  273. package/docs/interfaces/MotionServiceData.html +13 -0
  274. package/docs/interfaces/MotionStatus.html +14 -0
  275. package/docs/interfaces/PlugCommands.html +4 -0
  276. package/docs/interfaces/PlugServiceData.html +17 -0
  277. package/docs/interfaces/PlugStatus.html +16 -0
  278. package/docs/interfaces/PresenceServiceData.html +12 -0
  279. package/docs/interfaces/PresenceStatus.html +14 -0
  280. package/docs/interfaces/RelaySwitchCommands.html +4 -0
  281. package/docs/interfaces/RelaySwitchServiceData.html +14 -0
  282. package/docs/interfaces/RelaySwitchStatus.html +16 -0
  283. package/docs/interfaces/RemoteStatus.html +12 -0
  284. package/docs/interfaces/SceneListResponse.html +3 -0
  285. package/docs/interfaces/StripCommands.html +6 -0
  286. package/docs/interfaces/StripServiceData.html +19 -0
  287. package/docs/interfaces/StripStatus.html +16 -0
  288. package/docs/interfaces/SwitchBotConfig.html +18 -0
  289. package/docs/interfaces/WebhookConfig.html +4 -0
  290. package/docs/interfaces/WebhookDetails.html +7 -0
  291. package/docs/interfaces/WebhookQueryResponse.html +5 -0
  292. package/docs/interfaces/WebhookSetupResponse.html +5 -0
  293. package/docs/modules.html +1 -1
  294. package/docs/types/ConnectionType.html +2 -0
  295. package/docs/types/PhysicalDeviceType.html +2 -0
  296. package/docs/types/VirtualDeviceType.html +2 -0
  297. package/docs/variables/urls.html +1 -1
  298. package/package.json +11 -20
  299. package/.github/scripts/npm-version-script-esm-auto.js +0 -207
  300. package/dist/device.d.ts +0 -1577
  301. package/dist/device.d.ts.map +0 -1
  302. package/dist/device.js +0 -3493
  303. package/dist/device.js.map +0 -1
  304. package/dist/device.test.d.ts +0 -2
  305. package/dist/device.test.d.ts.map +0 -1
  306. package/dist/device.test.js +0 -255
  307. package/dist/device.test.js.map +0 -1
  308. package/dist/index.test.d.ts +0 -2
  309. package/dist/index.test.d.ts.map +0 -1
  310. package/dist/index.test.js +0 -14
  311. package/dist/index.test.js.map +0 -1
  312. package/dist/parameter-checker.d.ts +0 -91
  313. package/dist/parameter-checker.d.ts.map +0 -1
  314. package/dist/parameter-checker.js +0 -262
  315. package/dist/parameter-checker.js.map +0 -1
  316. package/dist/parameter-checker.test.d.ts +0 -2
  317. package/dist/parameter-checker.test.d.ts.map +0 -1
  318. package/dist/parameter-checker.test.js +0 -56
  319. package/dist/parameter-checker.test.js.map +0 -1
  320. package/dist/settings.test.d.ts +0 -2
  321. package/dist/settings.test.d.ts.map +0 -1
  322. package/dist/settings.test.js +0 -61
  323. package/dist/settings.test.js.map +0 -1
  324. package/dist/switchbot-ble.d.ts +0 -89
  325. package/dist/switchbot-ble.d.ts.map +0 -1
  326. package/dist/switchbot-ble.js +0 -319
  327. package/dist/switchbot-ble.js.map +0 -1
  328. package/dist/switchbot-ble.test.d.ts +0 -2
  329. package/dist/switchbot-ble.test.d.ts.map +0 -1
  330. package/dist/switchbot-ble.test.js +0 -32
  331. package/dist/switchbot-ble.test.js.map +0 -1
  332. package/dist/switchbot-openapi.d.ts +0 -139
  333. package/dist/switchbot-openapi.d.ts.map +0 -1
  334. package/dist/switchbot-openapi.js +0 -375
  335. package/dist/switchbot-openapi.js.map +0 -1
  336. package/dist/switchbot-openapi.test.d.ts +0 -2
  337. package/dist/switchbot-openapi.test.d.ts.map +0 -1
  338. package/dist/switchbot-openapi.test.js +0 -36
  339. package/dist/switchbot-openapi.test.js.map +0 -1
  340. package/dist/types/ble-guards.d.ts +0 -12
  341. package/dist/types/ble-guards.d.ts.map +0 -1
  342. package/dist/types/ble-guards.js +0 -10
  343. package/dist/types/ble-guards.js.map +0 -1
  344. package/dist/types/ble-guards.test.d.ts +0 -2
  345. package/dist/types/ble-guards.test.d.ts.map +0 -1
  346. package/dist/types/ble-guards.test.js +0 -62
  347. package/dist/types/ble-guards.test.js.map +0 -1
  348. package/dist/types/openapi.d.ts +0 -635
  349. package/dist/types/openapi.d.ts.map +0 -1
  350. package/dist/types/openapi.js +0 -3
  351. package/dist/types/openapi.js.map +0 -1
  352. package/docs/classes/Advertising.html +0 -21
  353. package/docs/classes/ErrorUtils.html +0 -25
  354. package/docs/classes/ParameterChecker.html +0 -69
  355. package/docs/classes/SwitchBotBLE.html +0 -39
  356. package/docs/classes/SwitchBotOpenAPI.html +0 -57
  357. package/docs/classes/SwitchbotDevice.html +0 -47
  358. package/docs/classes/ValidationUtils.html +0 -51
  359. package/docs/classes/WoSmartLockUltra.html +0 -113
  360. package/docs/enums/SwitchBotBLEModelFriendlyName.html +0 -39
  361. package/docs/enums/SwitchBotModel.html +0 -52
  362. package/docs/interfaces/AdvertisementData.html +0 -3
  363. package/docs/interfaces/Chars.html +0 -4
  364. package/docs/interfaces/ColorLightServiceDataBase.html +0 -17
  365. package/docs/interfaces/ErrorObject.html +0 -3
  366. package/docs/interfaces/LockBaseServiceData.html +0 -15
  367. package/docs/interfaces/NobleTypes.html +0 -3
  368. package/docs/interfaces/Params.html +0 -6
  369. package/docs/interfaces/PlugMiniServiceDataBase.html +0 -12
  370. package/docs/interfaces/Rule.html +0 -9
  371. package/docs/interfaces/ServiceData.html +0 -2
  372. package/docs/interfaces/SwitchBotBLEDevice.html +0 -27
  373. package/docs/interfaces/SwitchBotScanner.html +0 -6
  374. package/docs/interfaces/TemperatureServiceDataBase.html +0 -10
  375. package/docs/interfaces/WebhookDetail.html +0 -6
  376. package/docs/interfaces/ad.html +0 -5
  377. package/docs/interfaces/body.html +0 -3
  378. package/docs/interfaces/bodyChange.html +0 -4
  379. package/docs/interfaces/deleteWebhookResponse.html +0 -4
  380. package/docs/interfaces/device.html +0 -7
  381. package/docs/interfaces/deviceList.html +0 -2
  382. package/docs/interfaces/deviceStatus.html +0 -7
  383. package/docs/interfaces/deviceStatusRequest.html +0 -4
  384. package/docs/interfaces/deviceWebhook.html +0 -4
  385. package/docs/interfaces/deviceWebhookContext.html +0 -4
  386. package/docs/interfaces/devices.html +0 -4
  387. package/docs/interfaces/infraredRemoteList.html +0 -2
  388. package/docs/interfaces/irdevice.html +0 -5
  389. package/docs/interfaces/pushRequest.html +0 -5
  390. package/docs/interfaces/pushResponse.html +0 -5
  391. package/docs/interfaces/pushResponseBody.html +0 -3
  392. package/docs/interfaces/queryWebhookResponse.html +0 -4
  393. package/docs/interfaces/setupWebhookResponse.html +0 -4
  394. package/docs/interfaces/updateWebhookResponse.html +0 -4
  395. package/docs/interfaces/webhookRequest.html +0 -4
  396. package/docs/types/BLEDeviceServiceData.html +0 -1
  397. package/docs/types/IndoorCam.html +0 -1
  398. package/docs/types/MacAddress.html +0 -1
  399. package/docs/types/airPurifier.html +0 -1
  400. package/docs/types/airPurifierPM25WebhookContext.html +0 -1
  401. package/docs/types/airPurifierServiceData.html +0 -1
  402. package/docs/types/airPurifierStatus.html +0 -1
  403. package/docs/types/airPurifierTable.html +0 -1
  404. package/docs/types/airPurifierTablePM25WebhookContext.html +0 -1
  405. package/docs/types/airPurifierTableServiceData.html +0 -1
  406. package/docs/types/airPurifierTableStatus.html +0 -1
  407. package/docs/types/airPurifierTableVOC.html +0 -1
  408. package/docs/types/airPurifierTableVOCStatus.html +0 -1
  409. package/docs/types/airPurifierTableVOCWebhookContext.html +0 -1
  410. package/docs/types/airPurifierTableWebhookContext.html +0 -1
  411. package/docs/types/airPurifierVOC.html +0 -1
  412. package/docs/types/airPurifierVOCStatus.html +0 -1
  413. package/docs/types/airPurifierVOCWebhookContext.html +0 -1
  414. package/docs/types/airPurifierWebhookContext.html +0 -1
  415. package/docs/types/batteryCirculatorFan.html +0 -1
  416. package/docs/types/batteryCirculatorFanServiceData.html +0 -1
  417. package/docs/types/batteryCirculatorFanStatus.html +0 -1
  418. package/docs/types/batteryCirculatorFanWebhookContext.html +0 -1
  419. package/docs/types/blindTilt.html +0 -1
  420. package/docs/types/blindTiltServiceData.html +0 -1
  421. package/docs/types/blindTiltStatus.html +0 -1
  422. package/docs/types/blindTiltWebhookContext.html +0 -1
  423. package/docs/types/bot.html +0 -1
  424. package/docs/types/botServiceData.html +0 -1
  425. package/docs/types/botStatus.html +0 -1
  426. package/docs/types/botWebhookContext.html +0 -1
  427. package/docs/types/ceilingLight.html +0 -1
  428. package/docs/types/ceilingLightPro.html +0 -1
  429. package/docs/types/ceilingLightProServiceData.html +0 -1
  430. package/docs/types/ceilingLightProStatus.html +0 -1
  431. package/docs/types/ceilingLightProWebhookContext.html +0 -1
  432. package/docs/types/ceilingLightServiceData.html +0 -1
  433. package/docs/types/ceilingLightStatus.html +0 -1
  434. package/docs/types/ceilingLightWebhookContext.html +0 -1
  435. package/docs/types/circulatorFanStatus.html +0 -1
  436. package/docs/types/circulatorFanWebhookContext.html +0 -1
  437. package/docs/types/colorBulb.html +0 -1
  438. package/docs/types/colorBulbServiceData.html +0 -1
  439. package/docs/types/colorBulbStatus.html +0 -1
  440. package/docs/types/colorBulbWebhookContext.html +0 -1
  441. package/docs/types/commandType.html +0 -2
  442. package/docs/types/contactSensor.html +0 -1
  443. package/docs/types/contactSensorServiceData.html +0 -1
  444. package/docs/types/contactSensorStatus.html +0 -1
  445. package/docs/types/contactSensorWebhookContext.html +0 -1
  446. package/docs/types/curtain.html +0 -1
  447. package/docs/types/curtain3.html +0 -1
  448. package/docs/types/curtain3ServiceData.html +0 -1
  449. package/docs/types/curtain3WebhookContext.html +0 -1
  450. package/docs/types/curtainServiceData.html +0 -1
  451. package/docs/types/curtainStatus.html +0 -1
  452. package/docs/types/curtainWebhookContext.html +0 -1
  453. package/docs/types/floorCleaningRobotS10.html +0 -1
  454. package/docs/types/floorCleaningRobotS10Status.html +0 -1
  455. package/docs/types/floorCleaningRobotS10WebhookContext.html +0 -1
  456. package/docs/types/hub2.html +0 -1
  457. package/docs/types/hub2ServiceData.html +0 -1
  458. package/docs/types/hub2Status.html +0 -1
  459. package/docs/types/hub2WebhookContext.html +0 -1
  460. package/docs/types/hub3ServiceData.html +0 -1
  461. package/docs/types/humidifier.html +0 -1
  462. package/docs/types/humidifier2ServiceData.html +0 -1
  463. package/docs/types/humidifier2Status.html +0 -1
  464. package/docs/types/humidifier2WebhookContext.html +0 -1
  465. package/docs/types/humidifierServiceData.html +0 -1
  466. package/docs/types/humidifierStatus.html +0 -1
  467. package/docs/types/humidifierWebhookContext.html +0 -1
  468. package/docs/types/indoorCameraWebhookContext.html +0 -1
  469. package/docs/types/keypad.html +0 -1
  470. package/docs/types/keypadDetectorServiceData.html +0 -1
  471. package/docs/types/keypadTouch.html +0 -1
  472. package/docs/types/keypadTouchWebhookContext.html +0 -1
  473. package/docs/types/keypadWebhookContext.html +0 -1
  474. package/docs/types/lock.html +0 -1
  475. package/docs/types/lockPro.html +0 -1
  476. package/docs/types/lockProServiceData.html +0 -1
  477. package/docs/types/lockProStatus.html +0 -1
  478. package/docs/types/lockProWebhookContext.html +0 -1
  479. package/docs/types/lockServiceData.html +0 -1
  480. package/docs/types/lockStatus.html +0 -1
  481. package/docs/types/lockWebhookContext.html +0 -1
  482. package/docs/types/meter.html +0 -1
  483. package/docs/types/meterPlus.html +0 -1
  484. package/docs/types/meterPlusServiceData.html +0 -1
  485. package/docs/types/meterPlusStatus.html +0 -1
  486. package/docs/types/meterPlusWebhookContext.html +0 -1
  487. package/docs/types/meterPro.html +0 -1
  488. package/docs/types/meterProCO2ServiceData.html +0 -1
  489. package/docs/types/meterProCO2Status.html +0 -1
  490. package/docs/types/meterProCO2WebhookContext.html +0 -1
  491. package/docs/types/meterProServiceData.html +0 -1
  492. package/docs/types/meterProStatus.html +0 -1
  493. package/docs/types/meterProWebhookContext.html +0 -1
  494. package/docs/types/meterServiceData.html +0 -1
  495. package/docs/types/meterStatus.html +0 -1
  496. package/docs/types/meterWebhookContext.html +0 -1
  497. package/docs/types/motionSensor.html +0 -1
  498. package/docs/types/motionSensorServiceData.html +0 -1
  499. package/docs/types/motionSensorStatus.html +0 -1
  500. package/docs/types/motionSensorWebhookContext.html +0 -1
  501. package/docs/types/onadvertisement.html +0 -1
  502. package/docs/types/ondiscover.html +0 -1
  503. package/docs/types/outdoorMeter.html +0 -1
  504. package/docs/types/outdoorMeterServiceData.html +0 -1
  505. package/docs/types/outdoorMeterStatus.html +0 -1
  506. package/docs/types/outdoorMeterWebhookContext.html +0 -1
  507. package/docs/types/panTiltCamWebhookContext.html +0 -1
  508. package/docs/types/pantiltCam.html +0 -1
  509. package/docs/types/pantiltCam2k.html +0 -1
  510. package/docs/types/plug.html +0 -1
  511. package/docs/types/plugMini.html +0 -1
  512. package/docs/types/plugMiniJPServiceData.html +0 -1
  513. package/docs/types/plugMiniJPWebhookContext.html +0 -1
  514. package/docs/types/plugMiniStatus.html +0 -1
  515. package/docs/types/plugMiniUSServiceData.html +0 -1
  516. package/docs/types/plugMiniUSWebhookContext.html +0 -1
  517. package/docs/types/plugStatus.html +0 -1
  518. package/docs/types/plugWebhookContext.html +0 -1
  519. package/docs/types/presenceSensor.html +0 -1
  520. package/docs/types/presenceSensorServiceData.html +0 -1
  521. package/docs/types/presenceSensorStatus.html +0 -1
  522. package/docs/types/presenceSensorWebhookContext.html +0 -1
  523. package/docs/types/relaySwitch1Context.html +0 -1
  524. package/docs/types/relaySwitch1PMContext.html +0 -1
  525. package/docs/types/relaySwitch1PMServiceData.html +0 -1
  526. package/docs/types/relaySwitch1PMStatus.html +0 -1
  527. package/docs/types/relaySwitch1ServiceData.html +0 -1
  528. package/docs/types/relaySwitch1Status.html +0 -1
  529. package/docs/types/remote.html +0 -1
  530. package/docs/types/remoteServiceData.html +0 -1
  531. package/docs/types/robotVacuumCleanerS1.html +0 -1
  532. package/docs/types/robotVacuumCleanerS1Plus.html +0 -1
  533. package/docs/types/robotVacuumCleanerS1PlusStatus.html +0 -1
  534. package/docs/types/robotVacuumCleanerS1PlusWebhookContext.html +0 -1
  535. package/docs/types/robotVacuumCleanerS1Status.html +0 -1
  536. package/docs/types/robotVacuumCleanerS1WebhookContext.html +0 -1
  537. package/docs/types/robotVacuumCleanerServiceData.html +0 -1
  538. package/docs/types/stripLight.html +0 -1
  539. package/docs/types/stripLightServiceData.html +0 -1
  540. package/docs/types/stripLightStatus.html +0 -1
  541. package/docs/types/stripLightWebhookContext.html +0 -1
  542. package/docs/types/waterLeakDetector.html +0 -1
  543. package/docs/types/waterLeakDetectorServiceData.html +0 -1
  544. package/docs/types/waterLeakDetectorStatus.html +0 -1
  545. package/docs/types/waterLeakDetectorWebhookContext.html +0 -1
  546. package/docs/variables/parameterChecker.html +0 -1
  547. package/eslint.config.js +0 -48
  548. package/typedoc.json +0 -17
package/dist/device.d.ts DELETED
@@ -1,1577 +0,0 @@
1
- import type { Characteristic, Noble, Peripheral } from '@stoprocent/noble';
2
- import type { airPurifierServiceData, airPurifierTableServiceData, batteryCirculatorFanServiceData, blindTiltServiceData, botServiceData, ceilingLightProServiceData, ceilingLightServiceData, colorBulbServiceData, contactSensorServiceData, curtain3ServiceData, curtainServiceData, hub2ServiceData, hub3ServiceData, humidifier2ServiceData, humidifierServiceData, keypadDetectorServiceData, lockProServiceData, lockServiceData, meterPlusServiceData, meterProCO2ServiceData, meterProServiceData, meterServiceData, motionSensorServiceData, outdoorMeterServiceData, plugMiniJPServiceData, plugMiniUSServiceData, presenceSensorServiceData, relaySwitch1PMServiceData, relaySwitch1ServiceData, remoteServiceData, robotVacuumCleanerServiceData, stripLightServiceData, waterLeakDetectorServiceData } from './types/ble.js';
3
- import { Buffer } from 'node:buffer';
4
- import { EventEmitter } from 'node:events';
5
- export type MacAddress = string;
6
- export interface ad {
7
- id: string;
8
- address: string;
9
- rssi: number;
10
- serviceData: airPurifierServiceData | airPurifierTableServiceData | botServiceData | colorBulbServiceData | contactSensorServiceData | curtainServiceData | curtain3ServiceData | stripLightServiceData | lockServiceData | lockProServiceData | meterServiceData | meterPlusServiceData | meterProServiceData | meterProCO2ServiceData | motionSensorServiceData | presenceSensorServiceData | outdoorMeterServiceData | plugMiniUSServiceData | plugMiniJPServiceData | blindTiltServiceData | ceilingLightServiceData | ceilingLightProServiceData | hub2ServiceData | hub3ServiceData | batteryCirculatorFanServiceData | waterLeakDetectorServiceData | humidifierServiceData | humidifier2ServiceData | robotVacuumCleanerServiceData | keypadDetectorServiceData | relaySwitch1PMServiceData | relaySwitch1ServiceData | remoteServiceData;
11
- [key: string]: unknown;
12
- }
13
- export type ondiscover = (device: SwitchbotDevice) => Promise<void> | void;
14
- export type onadvertisement = (ad: ad) => Promise<void> | void;
15
- interface DeviceInfo {
16
- Model: SwitchBotModel;
17
- BLEModel: SwitchBotBLEModel;
18
- BLEModelName: SwitchBotBLEModelName;
19
- ModelFriendlyName: SwitchBotBLEModelFriendlyName;
20
- }
21
- export declare interface SwitchBotBLEDevice {
22
- Bot: DeviceInfo;
23
- Curtain: DeviceInfo;
24
- Curtain3: DeviceInfo;
25
- Humidifier: DeviceInfo;
26
- Meter: DeviceInfo;
27
- MeterPlus: DeviceInfo;
28
- MeterPro: DeviceInfo;
29
- MeterProCO2: DeviceInfo;
30
- Hub2: DeviceInfo;
31
- Hub3: DeviceInfo;
32
- OutdoorMeter: DeviceInfo;
33
- MotionSensor: DeviceInfo;
34
- PresenceSensor: DeviceInfo;
35
- ContactSensor: DeviceInfo;
36
- ColorBulb: DeviceInfo;
37
- StripLight: DeviceInfo;
38
- PlugMiniUS: DeviceInfo;
39
- PlugMiniJP: DeviceInfo;
40
- Lock: DeviceInfo;
41
- LockPro: DeviceInfo;
42
- CeilingLight: DeviceInfo;
43
- CeilingLightPro: DeviceInfo;
44
- BlindTilt: DeviceInfo;
45
- Unknown: DeviceInfo;
46
- AirPurifier: DeviceInfo;
47
- AirPurifierTable: DeviceInfo;
48
- }
49
- export declare enum SwitchBotModel {
50
- HubMini = "W0202200",
51
- HubPlus = "SwitchBot Hub S1",
52
- Hub2 = "W3202100",
53
- Hub3 = "W3302100",
54
- Bot = "SwitchBot S1",
55
- Curtain = "W0701600",
56
- Curtain3 = "W2400000",
57
- Humidifier = "W0801800",
58
- Humidifier2 = "WXXXXXXX",
59
- Plug = "SP11",// Currently only available in Japan
60
- Meter = "SwitchBot MeterTH S1",
61
- MeterPlusJP = "W2201500",
62
- MeterPlusUS = "W2301500",
63
- MeterPro = "W4900000",
64
- MeterProCO2 = "W4900010",
65
- OutdoorMeter = "W3400010",
66
- MotionSensor = "W1101500",
67
- PresenceSensor = "W8200000",
68
- ContactSensor = "W1201500",
69
- ColorBulb = "W1401400",
70
- StripLight = "W1701100",
71
- PlugMiniUS = "W1901400/W1901401",
72
- PlugMiniJP = "W2001400/W2001401",
73
- Lock = "W1601700",
74
- LockPro = "W3500000",
75
- LockUltra = "W3600000",
76
- Keypad = "W2500010",
77
- KeypadTouch = "W2500020",
78
- K10 = "K10+",
79
- K10Pro = "K10+ Pro",
80
- WoSweeper = "WoSweeper",
81
- WoSweeperMini = "WoSweeperMini",
82
- RobotVacuumCleanerS1 = "W3011000",// Currently only available in Japan.
83
- RobotVacuumCleanerS1Plus = "W3011010",// Currently only available in Japan.
84
- RobotVacuumCleanerS10 = "W3211800",
85
- Remote = "Remote",
86
- UniversalRemote = "UniversalRemote",
87
- CeilingLight = "W2612230/W2612240",// Currently only available in Japan.
88
- CeilingLightPro = "W2612210/W2612220",// Currently only available in Japan.
89
- IndoorCam = "W1301200",
90
- PanTiltCam = "W1801200",
91
- PanTiltCam2K = "W3101100",
92
- BlindTilt = "W2701600",
93
- BatteryCirculatorFan = "W3800510",
94
- CirculatorFan = "W3800511",
95
- WaterDetector = "W4402000",
96
- RelaySwitch1 = "W5502300",
97
- RelaySwitch1PM = "W5502310",
98
- Unknown = "Unknown",
99
- AirPurifier = "W5302300",
100
- AirPurifierTable = "W5302310"
101
- }
102
- export declare enum SwitchBotBLEModel {
103
- Bot = "H",
104
- Curtain = "c",
105
- Curtain3 = "{",
106
- Humidifier = "e",
107
- Humidifier2 = "#",
108
- Meter = "T",
109
- MeterPlus = "i",
110
- MeterPro = "4",
111
- MeterProCO2 = "5",
112
- Hub2 = "v",
113
- Hub3 = "V",
114
- OutdoorMeter = "w",
115
- MotionSensor = "s",
116
- PresenceSensor = "p",
117
- ContactSensor = "d",
118
- ColorBulb = "u",
119
- StripLight = "r",
120
- PlugMiniUS = "g",
121
- PlugMiniJP = "j",// Only available in Japan.
122
- Lock = "o",
123
- LockPro = "$",
124
- LockUltra = "U",
125
- CeilingLight = "q",// Currently only available in Japan.
126
- CeilingLightPro = "n",// Currently only available in Japan.
127
- BlindTilt = "x",
128
- Leak = "&",
129
- Keypad = "y",
130
- RelaySwitch1 = ";",
131
- RelaySwitch1PM = "<",
132
- Remote = "b",
133
- Unknown = "Unknown",
134
- AirPurifier = "+",
135
- AirPurifierTable = "7"
136
- }
137
- export declare enum SwitchBotBLEModelName {
138
- Bot = "WoHand",
139
- Hub2 = "WoHub2",
140
- Hub3 = "WoHub3",
141
- ColorBulb = "WoBulb",
142
- Curtain = "WoCurtain",
143
- Curtain3 = "WoCurtain3",
144
- Humidifier = "WoHumi",
145
- Humidifier2 = "WoHumi2",
146
- Meter = "WoSensorTH",
147
- MeterPlus = "WoSensorTHPlus",
148
- MeterPro = "WoSensorTHP",
149
- MeterProCO2 = "WoSensorTHPc",
150
- Lock = "WoSmartLock",
151
- LockPro = "WoSmartLockPro",
152
- LockUltra = "WoSmartLockUltra",
153
- PresenceSensor = "WoPresence",
154
- PlugMini = "WoPlugMini",
155
- StripLight = "WoStrip",
156
- OutdoorMeter = "WoIOSensorTH",
157
- ContactSensor = "WoContact",
158
- MotionSensor = "WoMotion",
159
- BlindTilt = "WoBlindTilt",
160
- CeilingLight = "WoCeilingLight",
161
- CeilingLightPro = "WoCeilingLightPro",
162
- Leak = "WoLeakDetector",
163
- Keypad = "WoKeypad",
164
- RelaySwitch1 = "WoRelaySwitch1Plus",
165
- RelaySwitch1PM = "WoRelaySwitch1PM",
166
- Remote = "WoRemote",
167
- AirPurifier = "WoAirPurifier",
168
- AirPurifierTable = "WoAirPurifierTable",
169
- Unknown = "Unknown"
170
- }
171
- export declare enum SwitchBotBLEModelFriendlyName {
172
- Bot = "Bot",
173
- Hub2 = "Hub 2",
174
- Hub3 = "Hub 3",
175
- ColorBulb = "Color Bulb",
176
- Curtain = "Curtain",
177
- Curtain3 = "Curtain 3",
178
- Humidifier = "Humidifier",
179
- Humidifier2 = "Humidifier2",
180
- Meter = "Meter",
181
- Lock = "Lock",
182
- LockPro = "Lock Pro",
183
- LockUltra = "Lock Ultra",
184
- PlugMini = "Plug Mini",
185
- StripLight = "Strip Light",
186
- MeterPlus = "Meter Plus",
187
- MeterPro = "Meter Pro",
188
- MeterProCO2 = "Meter Pro CO2",
189
- BatteryCirculatorFan = "Battery Circulator Fan",
190
- CirculatorFan = "Circulator Fan",
191
- OutdoorMeter = "Outdoor Meter",
192
- ContactSensor = "Contact Sensor",
193
- MotionSensor = "Motion Sensor",
194
- PresenceSensor = "Presence Sensor",
195
- BlindTilt = "Blind Tilt",
196
- CeilingLight = "Ceiling Light",
197
- CeilingLightPro = "Ceiling Light Pro",
198
- Leak = "Water Detector",
199
- Keypad = "Keypad",
200
- RelaySwitch1 = "Relay Switch 1",
201
- RelaySwitch1PM = "Relay Switch 1PM",
202
- Remote = "Remote",
203
- AirPurifier = "Air Purifier",
204
- AirPurifierTable = "Air Purifier Table",
205
- Unknown = "Unknown",
206
- AirPurifierVOC = "Air Purifier VOC",
207
- AirPurifierTableVOC = "Air Purifier Table VOC",
208
- AirPurifierPM2_5 = "Air Purifier PM2.5",
209
- AirPurifierTablePM2_5 = "Air Purifier Table PM2.5"
210
- }
211
- export interface Params {
212
- duration?: number;
213
- model?: string;
214
- id?: string;
215
- quick?: boolean;
216
- noble?: Noble;
217
- }
218
- export interface ErrorObject {
219
- code: string;
220
- message: string;
221
- }
222
- export interface Chars {
223
- write: Characteristic | null;
224
- notify: Characteristic | null;
225
- device: Characteristic | null;
226
- }
227
- export interface NobleTypes {
228
- noble: Noble;
229
- peripheral: Peripheral;
230
- }
231
- export interface ServiceData {
232
- model: string;
233
- [key: string]: unknown;
234
- }
235
- export interface AdvertisementData {
236
- serviceData: Buffer | null;
237
- manufacturerData: Buffer | null;
238
- }
239
- export interface Rule {
240
- required?: boolean;
241
- min?: number;
242
- max?: number;
243
- minBytes?: number;
244
- maxBytes?: number;
245
- pattern?: RegExp;
246
- enum?: unknown[];
247
- type?: 'float' | 'integer' | 'boolean' | 'array' | 'object' | 'string';
248
- }
249
- /**
250
- * Enum for log levels.
251
- */
252
- export declare enum LogLevel {
253
- SUCCESS = "success",
254
- DEBUGSUCCESS = "debugsuccess",
255
- WARN = "warn",
256
- DEBUGWARN = "debugwarn",
257
- ERROR = "error",
258
- DEBUGERROR = "debugerror",
259
- DEBUG = "debug",
260
- INFO = "info"
261
- }
262
- /**
263
- * Utility class for comprehensive input validation with improved error messages.
264
- */
265
- export declare class ValidationUtils {
266
- /**
267
- * Validates percentage value (0-100).
268
- * @param value - The value to validate
269
- * @param paramName - The parameter name for error reporting
270
- * @throws {RangeError} When value is not within valid range
271
- * @throws {TypeError} When value is not a number
272
- */
273
- static validatePercentage(value: number, paramName?: string): void;
274
- /**
275
- * Validates RGB color value (0-255).
276
- * @param value - The color value to validate
277
- * @param colorName - The color name for error reporting
278
- * @throws {RangeError} When value is not within valid range
279
- * @throws {TypeError} When value is not a number
280
- */
281
- static validateRGB(value: number, colorName?: string): void;
282
- /**
283
- * Validates buffer and throws descriptive error.
284
- * @param buffer - The buffer to validate
285
- * @param expectedLength - Optional expected length
286
- * @param paramName - The parameter name for error reporting
287
- * @throws {TypeError} When buffer is not a Buffer
288
- * @throws {RangeError} When buffer length doesn't match expected
289
- */
290
- static validateBuffer(buffer: any, expectedLength?: number, paramName?: string): asserts buffer is Buffer;
291
- /**
292
- * Validates string input with comprehensive checks.
293
- * @param value - The value to validate
294
- * @param paramName - The parameter name for error reporting
295
- * @param minLength - Minimum required length
296
- * @param maxLength - Optional maximum length
297
- * @throws {TypeError} When value is not a string
298
- * @throws {RangeError} When string length is invalid
299
- */
300
- static validateString(value: any, paramName?: string, minLength?: number, maxLength?: number): asserts value is string;
301
- /**
302
- * Validates numeric range with enhanced checks.
303
- * @param value - The value to validate
304
- * @param min - Minimum allowed value
305
- * @param max - Maximum allowed value
306
- * @param paramName - The parameter name for error reporting
307
- * @param mustBeInteger - Whether the value must be an integer
308
- * @throws {TypeError} When value is not a number
309
- * @throws {RangeError} When value is outside valid range
310
- */
311
- static validateRange(value: number, min: number, max: number, paramName?: string, mustBeInteger?: boolean): void;
312
- /**
313
- * Validates MAC address format.
314
- * @param address - The MAC address to validate
315
- * @param paramName - The parameter name for error reporting
316
- * @throws {TypeError} When address is not a string
317
- * @throws {Error} When address format is invalid
318
- */
319
- static validateMacAddress(address: any, paramName?: string): asserts address is string;
320
- /**
321
- * Validates that a value is one of the allowed enum values.
322
- * @param value - The value to validate
323
- * @param allowedValues - Array of allowed values
324
- * @param paramName - The parameter name for error reporting
325
- * @throws {Error} When value is not in allowed values
326
- */
327
- static validateEnum<T>(value: any, allowedValues: readonly T[], paramName?: string): asserts value is T;
328
- }
329
- /**
330
- * Enhanced error handling utilities.
331
- */
332
- export declare class ErrorUtils {
333
- /**
334
- * Creates a timeout error with context.
335
- * @param operation - The operation that timed out
336
- * @param timeoutMs - The timeout duration in milliseconds
337
- * @returns A descriptive timeout error
338
- */
339
- static createTimeoutError(operation: string, timeoutMs: number): Error;
340
- /**
341
- * Creates a connection error with context.
342
- * @param deviceId - The device ID that failed to connect
343
- * @param cause - The underlying cause of the connection failure
344
- * @returns A descriptive connection error
345
- */
346
- static createConnectionError(deviceId: string, cause?: Error): Error;
347
- /**
348
- * Creates a command error with context.
349
- * @param command - The command that failed
350
- * @param deviceId - The device ID
351
- * @param cause - The underlying cause
352
- * @returns A descriptive command error
353
- */
354
- static createCommandError(command: string, deviceId: string, cause?: Error): Error;
355
- /**
356
- * Wraps an async operation with timeout and enhanced error handling.
357
- * @param operation - The async operation to wrap
358
- * @param timeoutMs - Timeout in milliseconds
359
- * @param operationName - Name of the operation for error messages
360
- * @returns Promise that resolves with the operation result or rejects with timeout
361
- */
362
- static withTimeout<T>(operation: Promise<T>, timeoutMs: number, operationName: string): Promise<T>;
363
- }
364
- /**
365
- * Represents a Switchbot Device.
366
- */
367
- export declare class SwitchbotDevice extends EventEmitter {
368
- private noble;
369
- private peripheral;
370
- private characteristics;
371
- private deviceId;
372
- private deviceAddress;
373
- private deviceModel;
374
- private deviceModelName;
375
- private deviceFriendlyName;
376
- private explicitlyConnected;
377
- private isConnected;
378
- private onNotify;
379
- private onDisconnect;
380
- private onConnect;
381
- /**
382
- * Initializes a new instance of the SwitchbotDevice class.
383
- * @param peripheral The peripheral object from noble.
384
- * @param noble The Noble object.
385
- */
386
- constructor(peripheral: NobleTypes['peripheral'], noble: Noble);
387
- /**
388
- * Logs a message with the specified log level.
389
- * @param level The severity level of the log (e.g., 'info', 'warn', 'error').
390
- * @param message The log message to be emitted.
391
- */
392
- log(level: string, message: string): Promise<void>;
393
- get id(): string;
394
- get address(): string;
395
- get model(): SwitchBotBLEModel;
396
- get modelName(): SwitchBotBLEModelName;
397
- get friendlyName(): SwitchBotBLEModelFriendlyName;
398
- get connectionState(): string;
399
- get onConnectHandler(): () => Promise<void>;
400
- set onConnectHandler(func: () => Promise<void>);
401
- get onDisconnectHandler(): () => Promise<void>;
402
- set onDisconnectHandler(func: () => Promise<void>);
403
- /**
404
- * Connects to the device.
405
- * @returns A Promise that resolves when the connection is complete.
406
- */
407
- connect(): Promise<void>;
408
- /**
409
- * Internal method to handle the connection process.
410
- * @returns A Promise that resolves when the connection is complete.
411
- */
412
- internalConnect(): Promise<void>;
413
- /**
414
- * Retrieves the device characteristics.
415
- * @returns A Promise that resolves with the device characteristics.
416
- */
417
- getCharacteristics(): Promise<Chars>;
418
- /**
419
- * Discovers the device services.
420
- * @returns A Promise that resolves with the list of services.
421
- */
422
- discoverServices(): Promise<NobleTypes['peripheral']['services']>;
423
- /**
424
- * Discovers the characteristics of a service.
425
- * @param service The service to discover characteristics for.
426
- * @returns A Promise that resolves with the list of characteristics.
427
- */
428
- private discoverCharacteristics;
429
- /**
430
- * Subscribes to the notify characteristic.
431
- * @returns A Promise that resolves when the subscription is complete.
432
- */
433
- private subscribeToNotify;
434
- /**
435
- * Unsubscribes from the notify characteristic.
436
- * @returns A Promise that resolves when the unsubscription is complete.
437
- */
438
- unsubscribeFromNotify(): Promise<void>;
439
- /**
440
- * Disconnects from the device.
441
- * @returns A Promise that resolves when the disconnection is complete.
442
- */
443
- disconnect(): Promise<void>;
444
- /**
445
- * Internal method to handle disconnection if not explicitly initiated.
446
- * @returns A Promise that resolves when the disconnection is complete.
447
- */
448
- private internalDisconnect;
449
- /**
450
- * Retrieves the device name.
451
- * @returns A Promise that resolves with the device name.
452
- */
453
- getDeviceName(): Promise<string>;
454
- /**
455
- * Sets the device name.
456
- * @param name The new device name.
457
- * @returns A Promise that resolves when the name is set.
458
- */
459
- setDeviceName(name: string): Promise<void>;
460
- /**
461
- * Sends a command to the device and awaits a response.
462
- * @param reqBuf The command buffer.
463
- * @returns A Promise that resolves with the response buffer.
464
- */
465
- command(reqBuf: Buffer): Promise<Buffer>;
466
- /**
467
- * Waits for a response from the device after sending a command.
468
- * @returns A Promise that resolves with the response buffer.
469
- */
470
- private waitForCommandResponse;
471
- /**
472
- * Reads data from a characteristic with enhanced timeout and error handling.
473
- * @param char The characteristic to read from.
474
- * @returns A Promise that resolves with the data buffer.
475
- */
476
- private readCharacteristic;
477
- /**
478
- * Writes data to a characteristic with enhanced timeout and error handling.
479
- * @param char The characteristic to write to.
480
- * @param buf The data buffer.
481
- * @returns A Promise that resolves when the write is complete.
482
- */
483
- private writeCharacteristic;
484
- }
485
- /**
486
- * Represents the advertising data parser for SwitchBot devices.
487
- */
488
- export declare class Advertising {
489
- constructor();
490
- /**
491
- * Parses the advertisement data coming from SwitchBot device.
492
- *
493
- * This function processes advertising packets received from SwitchBot devices
494
- * and extracts relevant information based on the device type.
495
- *
496
- * @param {NobleTypes['peripheral']} peripheral - The peripheral device object from noble.
497
- * @param {Function} emitLog - The function to emit log messages.
498
- * @returns {Promise<Ad | null>} - An object containing parsed data specific to the SwitchBot device type, or `null` if the device is not recognized.
499
- */
500
- static parse(peripheral: NobleTypes['peripheral'], emitLog: (level: string, message: string) => void): Promise<ad | null>;
501
- /**
502
- * Validates if the buffer is a valid Buffer object with a minimum length.
503
- *
504
- * @param {any} buffer - The buffer to validate.
505
- * @param {number} minLength - The minimum required length.
506
- * @returns {boolean} - True if the buffer is valid, false otherwise.
507
- */
508
- private static validateBuffer;
509
- /**
510
- * Parses the service data based on the device model.
511
- *
512
- * @param {string} model - The device model.
513
- * @param {Buffer} serviceData - The service data buffer.
514
- * @param {Buffer} manufacturerData - The manufacturer data buffer.
515
- * @param {Function} emitLog - The function to emit log messages.
516
- * @returns {Promise<any>} - The parsed service data.
517
- */
518
- static parseServiceData(model: string, serviceData: Buffer, manufacturerData: Buffer, emitLog: (level: string, message: string) => void): Promise<any>;
519
- /**
520
- * Formats the address of the peripheral.
521
- *
522
- * @param {NobleTypes['peripheral']} peripheral - The peripheral device object from noble.
523
- * @returns {string} - The formatted address.
524
- */
525
- private static formatAddress;
526
- }
527
- /**
528
- * Class representing a WoBlindTilt device.
529
- * @see https://github.com/OpenWonderLabs/SwitchBotAPI-BLE/blob/latest/devicetypes/curtain.md
530
- */
531
- export declare class WoBlindTilt extends SwitchbotDevice {
532
- private reverse;
533
- /**
534
- * Parses the service data and manufacturer data for the WoBlindTilt device.
535
- * @param {Buffer} serviceData - The service data buffer.
536
- * @param {Buffer} manufacturerData - The manufacturer data buffer.
537
- * @param {Function} emitLog - The function to emit log messages.
538
- * @param {boolean} [reverse] - Whether to reverse the tilt percentage.
539
- * @returns {Promise<blindTiltServiceData | null>} - The parsed data object or null if the data is invalid.
540
- */
541
- static parseServiceData(serviceData: Buffer, manufacturerData: Buffer, emitLog: (level: string, message: string) => void, reverse?: boolean): Promise<blindTiltServiceData | null>;
542
- constructor(peripheral: NobleTypes['peripheral'], noble: NobleTypes['noble']);
543
- /**
544
- * Opens the blind tilt to the fully open position.
545
- * @returns {Promise<void>}
546
- */
547
- open(): Promise<void>;
548
- /**
549
- * Closes the blind tilt up to the nearest endpoint.
550
- * @returns {Promise<void>}
551
- */
552
- closeUp(): Promise<void>;
553
- /**
554
- * Closes the blind tilt down to the nearest endpoint.
555
- * @returns {Promise<void>}
556
- */
557
- closeDown(): Promise<void>;
558
- /**
559
- * Closes the blind tilt to the nearest endpoint.
560
- * @returns {Promise<void>}
561
- */
562
- close(): Promise<void>;
563
- /**
564
- * Retrieves the current position of the blind tilt.
565
- * @returns {Promise<number>} - The current position of the blind tilt (0-100).
566
- */
567
- getPosition(): Promise<number>;
568
- /**
569
- * Retrieves the advertised value for a given key.
570
- * @param {string} key - The key for the advertised value.
571
- * @returns {Promise<number>} - The advertised value.
572
- * @private
573
- */
574
- private _getAdvValue;
575
- /**
576
- * Retrieves the basic information of the blind tilt.
577
- * @returns {Promise<object | null>} - A promise that resolves to an object containing the basic information of the blind tilt.
578
- */
579
- getBasicInfo(): Promise<object | null>;
580
- /**
581
- * Pauses the blind tilt operation.
582
- * @returns {Promise<void>}
583
- */
584
- pause(): Promise<void>;
585
- /**
586
- * Runs the blind tilt to the specified position.
587
- * @param {number} percent - The target position percentage (0-100).
588
- * @param {number} mode - The running mode (0 or 1).
589
- * @returns {Promise<void>}
590
- */
591
- runToPos(percent: number, mode: number): Promise<void>;
592
- /**
593
- * Sends a command to operate the blind tilt and handles the response.
594
- * @param {number[]} bytes - The byte array representing the command to be sent to the device.
595
- * @returns {Promise<void>}
596
- * @private
597
- */
598
- operateBlindTilt(bytes: number[]): Promise<void>;
599
- }
600
- /**
601
- * Class representing a WoBulb device.
602
- * @see https://github.com/OpenWonderLabs/SwitchBotAPI-BLE/blob/latest/devicetypes/colorbulb.md
603
- */
604
- export declare class WoBulb extends SwitchbotDevice {
605
- /**
606
- * Parses the service data for WoBulb.
607
- * @param {Buffer} serviceData - The service data buffer.
608
- * @param {Buffer} manufacturerData - The manufacturer data buffer.
609
- * @param {Function} emitLog - The function to emit log messages.
610
- * @returns {Promise<colorBulbServiceData | null>} - Parsed service data or null if invalid.
611
- */
612
- static parseServiceData(serviceData: Buffer, manufacturerData: Buffer, emitLog: (level: string, message: string) => void): Promise<colorBulbServiceData | null>;
613
- constructor(peripheral: NobleTypes['peripheral'], noble: NobleTypes['noble']);
614
- /**
615
- * Reads the state of the bulb.
616
- * @returns {Promise<boolean>} - Resolves with a boolean indicating whether the bulb is ON (true) or OFF (false).
617
- */
618
- readState(): Promise<boolean>;
619
- /**
620
- * Sets the state of the bulb.
621
- * @param {number[]} reqByteArray - The request byte array.
622
- * @returns {Promise<boolean>} - Resolves with a boolean indicating whether the operation was successful.
623
- * @private
624
- */
625
- setState(reqByteArray: number[]): Promise<boolean>;
626
- /**
627
- * Turns on the bulb.
628
- * @returns {Promise<boolean>} - Resolves with a boolean indicating whether the bulb is ON (true).
629
- */
630
- turnOn(): Promise<boolean>;
631
- /**
632
- * Turns off the bulb.
633
- * @returns {Promise<boolean>} - Resolves with a boolean indicating whether the bulb is OFF (false).
634
- */
635
- turnOff(): Promise<boolean>;
636
- /**
637
- * Sets the brightness of the bulb.
638
- * @param {number} brightness - The brightness percentage (0-100).
639
- * @returns {Promise<boolean>} - Resolves with a boolean indicating whether the operation was successful.
640
- */
641
- setBrightness(brightness: number): Promise<boolean>;
642
- /**
643
- * Sets the color temperature of the bulb.
644
- * @param {number} color_temperature - The color temperature percentage (0-100).
645
- * @returns {Promise<boolean>} - Resolves with a boolean indicating whether the operation was successful.
646
- */
647
- setColorTemperature(color_temperature: number): Promise<boolean>;
648
- /**
649
- * Sets the RGB color of the bulb.
650
- * @param {number} brightness - The brightness percentage (0-100).
651
- * @param {number} red - The red color value (0-255).
652
- * @param {number} green - The green color value (0-255).
653
- * @param {number} blue - The blue color value (0-255).
654
- * @returns {Promise<boolean>} - Resolves with a boolean indicating whether the operation was successful.
655
- */
656
- setRGB(brightness: number, red: number, green: number, blue: number): Promise<boolean>;
657
- /**
658
- * Sends a command to the bulb.
659
- * @param {number[]} bytes - The command bytes.
660
- * @returns {Promise<boolean>} - Resolves with a boolean indicating whether the operation was successful.
661
- * @private
662
- */
663
- private operateBulb;
664
- }
665
- /**
666
- * Class representing a WoCeilingLight device.
667
- * @see https://github.com/OpenWonderLabs/SwitchBotAPI-BLE/blob/latest/devicetypes/colorbulb.md
668
- */
669
- export declare class WoCeilingLight extends SwitchbotDevice {
670
- /**
671
- * Parses the service data for WoCeilingLight.
672
- * @param {Buffer} manufacturerData - The manufacturer data buffer.
673
- * @param {Function} emitLog - The function to emit log messages.
674
- * @returns {Promise<ceilingLightServiceData | null>} - Parsed service data or null if invalid.
675
- */
676
- static parseServiceData(manufacturerData: Buffer, emitLog: (level: string, message: string) => void): Promise<ceilingLightServiceData | null>;
677
- /**
678
- * Parses the service data for WoCeilingLight Pro.
679
- * @param {Buffer} manufacturerData - The manufacturer data buffer.
680
- * @param {Function} emitLog - The function to emit log messages.
681
- * @returns {Promise<ceilingLightProServiceData | null>} - Parsed service data or null if invalid.
682
- */
683
- static parseServiceData_Pro(manufacturerData: Buffer, emitLog: (level: string, message: string) => void): Promise<ceilingLightProServiceData | null>;
684
- constructor(peripheral: NobleTypes['peripheral'], noble: NobleTypes['noble']);
685
- /**
686
- * Reads the state of the ceiling light.
687
- * @returns {Promise<boolean>} - Resolves with a boolean indicating whether the light is ON (true) or OFF (false).
688
- */
689
- readState(): Promise<boolean>;
690
- /**
691
- * Sets the state of the ceiling light.
692
- * @param {number[]} reqByteArray - The request byte array.
693
- * @returns {Promise<boolean>} - Resolves with a boolean indicating whether the operation was successful.
694
- */
695
- setState(reqByteArray: number[]): Promise<boolean>;
696
- /**
697
- * Turns on the ceiling light.
698
- * @returns {Promise<boolean>} - Resolves with a boolean indicating whether the light is ON (true).
699
- */
700
- turnOn(): Promise<boolean>;
701
- /**
702
- * Turns off the ceiling light.
703
- * @returns {Promise<boolean>} - Resolves with a boolean indicating whether the light is OFF (false).
704
- */
705
- turnOff(): Promise<boolean>;
706
- /**
707
- * Sets the brightness of the ceiling light.
708
- * @param {number} brightness - The brightness percentage (0-100).
709
- * @returns {Promise<boolean>} - Resolves with a boolean indicating whether the operation was successful.
710
- */
711
- setBrightness(brightness: number): Promise<boolean>;
712
- /**
713
- * Sets the color temperature of the ceiling light.
714
- * @param {number} color_temperature - The color temperature percentage (0-100).
715
- * @returns {Promise<boolean>} - Resolves with a boolean indicating whether the operation was successful.
716
- */
717
- setColorTemperature(color_temperature: number): Promise<boolean>;
718
- /**
719
- * Sets the RGB color of the ceiling light.
720
- * @param {number} brightness - The brightness percentage (0-100).
721
- * @param {number} red - The red color value (0-255).
722
- * @param {number} green - The green color value (0-255).
723
- * @param {number} blue - The blue color value (0-255).
724
- * @returns {Promise<boolean>} - Resolves with a boolean indicating whether the operation was successful.
725
- */
726
- setRGB(brightness: number, red: number, green: number, blue: number): Promise<boolean>;
727
- /**
728
- * Sends a command to the ceiling light.
729
- * @param {number[]} bytes - The command bytes.
730
- * @returns {Promise<boolean>} - Resolves with a boolean indicating whether the operation was successful.
731
- */
732
- operateCeilingLight(bytes: number[]): Promise<boolean>;
733
- }
734
- /**
735
- * Class representing a WoContact device.
736
- * @see https://github.com/OpenWonderLabs/SwitchBotAPI-BLE/blob/latest/devicetypes/contactsensor.md
737
- */
738
- export declare class WoContact extends SwitchbotDevice {
739
- /**
740
- * Parses the service data for WoContact.
741
- * @param {Buffer} serviceData - The service data buffer.
742
- * @param {Function} emitLog - The function to emit log messages.
743
- * @returns {Promise<contactSensorServiceData | null>} - Parsed service data or null if invalid.
744
- */
745
- static parseServiceData(serviceData: Buffer, emitLog: (level: string, message: string) => void): Promise<contactSensorServiceData | null>;
746
- constructor(peripheral: NobleTypes['peripheral'], noble: NobleTypes['noble']);
747
- }
748
- /**
749
- * Class representing a WoCurtain device.
750
- * @see https://github.com/OpenWonderLabs/SwitchBotAPI-BLE/blob/latest/devicetypes/curtain.md
751
- * @see https://github.com/OpenWonderLabs/SwitchBotAPI-BLE/blob/latest/devicetypes/curtain3.md
752
- */
753
- export declare class WoCurtain extends SwitchbotDevice {
754
- /**
755
- * Parses the service data for WoCurtain.
756
- * @param {Buffer} serviceData - The service data buffer.
757
- * @param {Buffer} manufacturerData - The manufacturer data buffer.
758
- * @param {Function} emitLog - The function to emit log messages.
759
- * @param {boolean} [reverse] - Whether to reverse the position.
760
- * @returns {Promise<curtainServiceData | curtain3ServiceData | null>} - Parsed service data or null if invalid.
761
- */
762
- static parseServiceData(serviceData: Buffer, manufacturerData: Buffer, emitLog: (level: string, message: string) => void, reverse?: boolean): Promise<curtainServiceData | curtain3ServiceData | null>;
763
- constructor(peripheral: NobleTypes['peripheral'], noble: NobleTypes['noble']);
764
- /**
765
- * Opens the curtain.
766
- * @param {number} [mode] - Running mode (0x01 = QuietDrift, 0xFF = Default).
767
- * @returns {Promise<void>}
768
- */
769
- open(mode?: number): Promise<void>;
770
- /**
771
- * Closes the curtain.
772
- * @param {number} [mode] - Running mode (0x01 = QuietDrift, 0xFF = Default).
773
- * @returns {Promise<void>}
774
- */
775
- close(mode?: number): Promise<void>;
776
- /**
777
- * Pauses the curtain.
778
- * @returns {Promise<void>}
779
- */
780
- pause(): Promise<void>;
781
- /**
782
- * Runs the curtain to the target position.
783
- * @param {number} percent - The percentage of the target position.
784
- * @param {number} [mode] - Running mode (0x01 = QuietDrift, 0xFF = Default).
785
- * @returns {Promise<void>}
786
- */
787
- runToPos(percent: number, mode?: number): Promise<void>;
788
- /**
789
- * Sends a command to the curtain.
790
- * @param {number[]} bytes - The command bytes.
791
- * @returns {Promise<void>}
792
- */
793
- operateCurtain(bytes: number[]): Promise<void>;
794
- }
795
- /**
796
- * Class representing a WoHand device.
797
- * @see https://github.com/OpenWonderLabs/SwitchBotAPI-BLE/blob/latest/devicetypes/bot.md
798
- */
799
- export declare class WoHand extends SwitchbotDevice {
800
- /**
801
- * Parses the service data for WoHand.
802
- * @param {Buffer} serviceData - The service data buffer.
803
- * @param {Function} emitLog - The function to emit log messages.
804
- * @returns {Promise<botServiceData | null>} - Parsed service data or null if invalid.
805
- */
806
- static parseServiceData(serviceData: Buffer, emitLog: (level: string, message: string) => void): Promise<botServiceData | null>;
807
- constructor(peripheral: NobleTypes['peripheral'], noble: NobleTypes['noble']);
808
- /**
809
- * Sends a command to the bot.
810
- * @param {Buffer} reqBuf - The command buffer.
811
- * @returns {Promise<void>}
812
- */
813
- protected sendCommand(reqBuf: Buffer): Promise<void>;
814
- /**
815
- * Presses the bot.
816
- * @returns {Promise<void>}
817
- */
818
- press(): Promise<void>;
819
- /**
820
- * Turns on the bot.
821
- * @returns {Promise<void>}
822
- */
823
- turnOn(): Promise<void>;
824
- /**
825
- * Turns off the bot.
826
- * @returns {Promise<void>}
827
- */
828
- turnOff(): Promise<void>;
829
- /**
830
- * Moves the bot down.
831
- * @returns {Promise<void>}
832
- */
833
- down(): Promise<void>;
834
- /**
835
- * Moves the bot up.
836
- * @returns {Promise<void>}
837
- */
838
- up(): Promise<void>;
839
- }
840
- /**
841
- * Class representing a WoHub2 device.
842
- * @see https://github.com/OpenWonderLabs/SwitchBotAPI-BLE/blob/latest/devicetypes/meter.md
843
- */
844
- export declare class WoHub2 extends SwitchbotDevice {
845
- /**
846
- * Parses the service data for WoHub2.
847
- * @param {Buffer} manufacturerData - The manufacturer data buffer.
848
- * @param {Function} emitLog - The function to emit log messages.
849
- * @returns {Promise<hub2ServiceData | null>} - Parsed service data or null if invalid.
850
- */
851
- static parseServiceData(manufacturerData: Buffer, emitLog: (level: string, message: string) => void): Promise<hub2ServiceData | null>;
852
- constructor(peripheral: NobleTypes['peripheral'], noble: NobleTypes['noble']);
853
- }
854
- /**
855
- * Class representing a WoHub3 device.
856
- * @see https://github.com/OpenWonderLabs/SwitchBotAPI-BLE/blob/latest/devicetypes/meter.md
857
- */
858
- export declare class WoHub3 extends SwitchbotDevice {
859
- /**
860
- * Parses the service data for WoHub3.
861
- * @param {Buffer} manufacturerData - The manufacturer data buffer.
862
- * @param {Function} emitLog - The function to emit log messages.
863
- * @returns {Promise<hub3ServiceData | null>} - Parsed service data or null if invalid.
864
- */
865
- static parseServiceData(manufacturerData: Buffer, emitLog: (level: string, message: string) => void): Promise<hub3ServiceData | null>;
866
- constructor(peripheral: NobleTypes['peripheral'], noble: NobleTypes['noble']);
867
- }
868
- /**
869
- * Class representing a WoHumi device.
870
- * @see https://github.com/OpenWonderLabs/SwitchBotAPI-BLE/tree/latest/devicetypes
871
- */
872
- export declare class WoHumi extends SwitchbotDevice {
873
- constructor(peripheral: NobleTypes['peripheral'], noble: NobleTypes['noble']);
874
- /**
875
- * Parses the service data for WoHumi.
876
- * @param {Buffer} serviceData - The service data buffer.
877
- * @param {Function} emitLog - The function to emit log messages.
878
- * @returns {Promise<humidifierServiceData | null>} - Parsed service data or null if invalid.
879
- */
880
- static parseServiceData(serviceData: Buffer, emitLog: (level: string, message: string) => void): Promise<humidifierServiceData | null>;
881
- /**
882
- * Sends a command to the humidifier.
883
- * @param {Buffer} reqBuf - The command buffer.
884
- * @returns {Promise<void>}
885
- */
886
- protected operateHumi(reqBuf: Buffer): Promise<void>;
887
- /**
888
- * Turns on the humidifier.
889
- * @returns {Promise<void>}
890
- */
891
- turnOn(): Promise<void>;
892
- /**
893
- * Turns off the humidifier.
894
- * @returns {Promise<void>}
895
- */
896
- turnOff(): Promise<void>;
897
- /**
898
- * Increases the humidifier setting.
899
- * @returns {Promise<void>}
900
- */
901
- increase(): Promise<void>;
902
- /**
903
- * Decreases the humidifier setting.
904
- * @returns {Promise<void>}
905
- */
906
- decrease(): Promise<void>;
907
- /**
908
- * Sets the humidifier to auto mode.
909
- * @returns {Promise<void>}
910
- */
911
- setAutoMode(): Promise<void>;
912
- /**
913
- * Sets the humidifier to manual mode.
914
- * @returns {Promise<void>}
915
- */
916
- setManualMode(): Promise<void>;
917
- /**
918
- * Sets the humidifier level.
919
- * @param {number} level - The level to set (0-100).
920
- * @returns {Promise<void>}
921
- */
922
- percentage(level: number): Promise<void>;
923
- }
924
- /**
925
- * Class representing a WoHumi device.
926
- * @see https://github.com/OpenWonderLabs/SwitchBotAPI-BLE/tree/latest/devicetypes
927
- */
928
- export declare class WoHumi2 extends SwitchbotDevice {
929
- constructor(peripheral: NobleTypes['peripheral'], noble: NobleTypes['noble']);
930
- /**
931
- * Parses the service data for WoHumi.
932
- * @param {Buffer} serviceData - The service data buffer.
933
- * @param {Function} emitLog - The function to emit log messages.
934
- * @returns {Promise<humidifier2ServiceData | null>} - Parsed service data or null if invalid.
935
- */
936
- static parseServiceData(serviceData: Buffer, emitLog: (level: string, message: string) => void): Promise<humidifier2ServiceData | null>;
937
- /**
938
- * Sends a command to the humidifier.
939
- * @param {Buffer} reqBuf - The command buffer.
940
- * @returns {Promise<void>}
941
- */
942
- protected operateHumi(reqBuf: Buffer): Promise<void>;
943
- /**
944
- * Turns on the humidifier.
945
- * @returns {Promise<void>}
946
- */
947
- turnOn(): Promise<void>;
948
- /**
949
- * Turns off the humidifier.
950
- * @returns {Promise<void>}
951
- */
952
- turnOff(): Promise<void>;
953
- /**
954
- * Increases the humidifier setting.
955
- * @returns {Promise<void>}
956
- */
957
- increase(): Promise<void>;
958
- /**
959
- * Decreases the humidifier setting.
960
- * @returns {Promise<void>}
961
- */
962
- decrease(): Promise<void>;
963
- /**
964
- * Sets the humidifier to auto mode.
965
- * @returns {Promise<void>}
966
- */
967
- setAutoMode(): Promise<void>;
968
- /**
969
- * Sets the humidifier to manual mode.
970
- * @returns {Promise<void>}
971
- */
972
- setManualMode(): Promise<void>;
973
- /**
974
- * Sets the humidifier level.
975
- * @param {number} level - The level to set (0-100).
976
- * @returns {Promise<void>}
977
- */
978
- percentage(level: number): Promise<void>;
979
- }
980
- /**
981
- * Class representing a WoIOSensorTH device.
982
- * @see https://github.com/OpenWonderLabs/SwitchBotAPI-BLE/blob/latest/devicetypes/meter.md#outdoor-temperaturehumidity-sensor
983
- */
984
- export declare class WoIOSensorTH extends SwitchbotDevice {
985
- /**
986
- * Parses the service data for WoIOSensorTH.
987
- * @param {Buffer} serviceData - The service data buffer.
988
- * @param {Buffer} manufacturerData - The manufacturer data buffer.
989
- * @param {Function} emitLog - The function to emit log messages.
990
- * @returns {Promise<outdoorMeterServiceData | null>} - Parsed service data or null if invalid.
991
- */
992
- static parseServiceData(serviceData: Buffer, manufacturerData: Buffer, emitLog: (level: string, message: string) => void): Promise<outdoorMeterServiceData | null>;
993
- constructor(peripheral: NobleTypes['peripheral'], noble: NobleTypes['noble']);
994
- }
995
- /**
996
- * Class representing a WoKeypad device.
997
- */
998
- export declare class WoKeypad extends SwitchbotDevice {
999
- /**
1000
- * Parses the service data for WoKeypad.
1001
- * @param {Buffer} serviceData - The service data buffer.
1002
- * @param {Buffer} manufacturerData - The manufacturer data buffer.
1003
- * @param {Function} emitLog - The function to emit log messages.
1004
- * @returns {Promise<keypadDetectorServiceData | null>} - Parsed service data or null if invalid.
1005
- */
1006
- static parseServiceData(serviceData: Buffer, manufacturerData: Buffer, emitLog: (level: string, message: string) => void): Promise<keypadDetectorServiceData | null>;
1007
- constructor(peripheral: NobleTypes['peripheral'], noble: NobleTypes['noble']);
1008
- }
1009
- /**
1010
- * Class representing a WoLeak device.
1011
- * @see https://github.com/OpenWonderLabs/SwitchBotAPI-BLE/blob/latest/devicetypes/meter.md#outdoor-temperaturehumidity-sensor
1012
- */
1013
- export declare class WoLeak extends SwitchbotDevice {
1014
- /**
1015
- * Parses the service data for WoLeak.
1016
- * @param {Buffer} serviceData - The service data buffer.
1017
- * @param {Buffer} manufacturerData - The manufacturer data buffer.
1018
- * @param {Function} emitLog - The function to emit log messages.
1019
- * @returns {Promise<waterLeakDetectorServiceData | null>} - Parsed service data or null if invalid.
1020
- */
1021
- static parseServiceData(serviceData: Buffer, manufacturerData: Buffer, emitLog: (level: string, message: string) => void): Promise<waterLeakDetectorServiceData | null>;
1022
- constructor(peripheral: NobleTypes['peripheral'], noble: NobleTypes['noble']);
1023
- }
1024
- /**
1025
- * Class representing a WoPlugMini device.
1026
- * @see https://github.com/OpenWonderLabs/SwitchBotAPI-BLE/blob/latest/devicetypes/plugmini.md
1027
- */
1028
- export declare class WoPlugMiniJP extends SwitchbotDevice {
1029
- constructor(peripheral: NobleTypes['peripheral'], noble: NobleTypes['noble']);
1030
- /**
1031
- * Parses the service data for WoPlugMini JP.
1032
- * @param {Buffer} manufacturerData - The manufacturer data buffer.
1033
- * @param {Function} emitLog - The function to emit log messages.
1034
- * @returns {Promise<plugMiniJPServiceData | null>} - Parsed service data or null if invalid.
1035
- */
1036
- static parseServiceData(manufacturerData: Buffer, emitLog: (level: string, message: string) => void): Promise<plugMiniJPServiceData | null>;
1037
- /**
1038
- * Reads the state of the plug.
1039
- * @returns {Promise<boolean>} - Resolves with a boolean that tells whether the plug is ON (true) or OFF (false).
1040
- */
1041
- readState(): Promise<boolean>;
1042
- /**
1043
- * Sets the state of the plug.
1044
- * @private
1045
- * @param {number[]} reqByteArray - The request byte array.
1046
- * @returns {Promise<boolean>} - Resolves with a boolean that tells whether the plug is ON (true) or OFF (false).
1047
- */
1048
- setState(reqByteArray: number[]): Promise<boolean>;
1049
- /**
1050
- * Turns on the plug.
1051
- * @returns {Promise<boolean>} - Resolves with a boolean that tells whether the plug is ON (true) or OFF (false).
1052
- */
1053
- turnOn(): Promise<boolean>;
1054
- /**
1055
- * Turns off the plug.
1056
- * @returns {Promise<boolean>} - Resolves with a boolean that tells whether the plug is ON (true) or OFF (false).
1057
- */
1058
- turnOff(): Promise<boolean>;
1059
- /**
1060
- * Toggles the state of the plug.
1061
- * @returns {Promise<boolean>} - Resolves with a boolean that tells whether the plug is ON (true) or OFF (false).
1062
- */
1063
- toggle(): Promise<boolean>;
1064
- /**
1065
- * Operates the plug with the given bytes.
1066
- * @param {number[]} bytes - The byte array to send to the plug.
1067
- * @returns {Promise<boolean>} - Resolves with a boolean that tells whether the plug is ON (true) or OFF (false).
1068
- */
1069
- operatePlug(bytes: number[]): Promise<boolean>;
1070
- }
1071
- /**
1072
- * Class representing a WoPlugMini device.
1073
- * @see https://github.com/OpenWonderLabs/SwitchBotAPI-BLE/blob/latest/devicetypes/plugmini.md
1074
- */
1075
- export declare class WoPlugMiniUS extends SwitchbotDevice {
1076
- constructor(peripheral: NobleTypes['peripheral'], noble: NobleTypes['noble']);
1077
- /**
1078
- * Parses the service data for WoPlugMini US.
1079
- * @param {Buffer} manufacturerData - The manufacturer data buffer.
1080
- * @param {Function} emitLog - The function to emit log messages.
1081
- * @returns {Promise<plugMiniUSServiceData | null>} - Parsed service data or null if invalid.
1082
- */
1083
- static parseServiceData(manufacturerData: Buffer, emitLog: (level: string, message: string) => void): Promise<plugMiniUSServiceData | null>;
1084
- /**
1085
- * Reads the state of the plug.
1086
- * @returns {Promise<boolean>} - Resolves with a boolean that tells whether the plug is ON (true) or OFF (false).
1087
- */
1088
- readState(): Promise<boolean>;
1089
- /**
1090
- * Sets the state of the plug.
1091
- * @private
1092
- * @param {number[]} reqByteArray - The request byte array.
1093
- * @returns {Promise<boolean>} - Resolves with a boolean that tells whether the plug is ON (true) or OFF (false).
1094
- */
1095
- private setState;
1096
- /**
1097
- * Turns on the plug.
1098
- * @returns {Promise<boolean>} - Resolves with a boolean that tells whether the plug is ON (true) or OFF (false).
1099
- */
1100
- turnOn(): Promise<boolean>;
1101
- /**
1102
- * Turns off the plug.
1103
- * @returns {Promise<boolean>} - Resolves with a boolean that tells whether the plug is ON (true) or OFF (false).
1104
- */
1105
- turnOff(): Promise<boolean>;
1106
- /**
1107
- * Toggles the state of the plug.
1108
- * @returns {Promise<boolean>} - Resolves with a boolean that tells whether the plug is ON (true) or OFF (false).
1109
- */
1110
- toggle(): Promise<boolean>;
1111
- /**
1112
- * Operates the plug with the given bytes.
1113
- * @param {number[]} bytes - The byte array to send to the plug.
1114
- * @returns {Promise<boolean>} - Resolves with a boolean that tells whether the plug is ON (true) or OFF (false).
1115
- */
1116
- operatePlug(bytes: number[]): Promise<boolean>;
1117
- }
1118
- /**
1119
- * Class representing a WoPresence device.
1120
- * @see https://github.com/OpenWonderLabs/SwitchBotAPI-BLE/blob/latest/devicetypes/meter.md
1121
- */
1122
- export declare class WoPresence extends SwitchbotDevice {
1123
- /**
1124
- * Parses the service data for WoPresence.
1125
- * @param {Buffer} serviceData - The service data buffer.
1126
- * @param {Function} emitLog - The function to emit log messages.
1127
- * @returns {Promise<motionSensorServiceData | null>} - Parsed service data or null if invalid.
1128
- */
1129
- static parseServiceData(serviceData: Buffer, emitLog: (level: string, message: string) => void): Promise<motionSensorServiceData | null>;
1130
- /**
1131
- * Parses the manufacturer data for presence sensors.
1132
- * @param {Buffer | null} serviceData - The optional service data buffer.
1133
- * @param {Buffer} manufacturerData - The manufacturer data buffer.
1134
- * @param {Function} emitLog - The function to emit log messages.
1135
- * @returns {Promise<presenceSensorServiceData | null>} - Parsed service data or null if invalid.
1136
- */
1137
- static parsePresenceSensorServiceData(serviceData: Buffer | null, manufacturerData: Buffer, emitLog: (level: string, message: string) => void): Promise<presenceSensorServiceData | null>;
1138
- constructor(peripheral: NobleTypes['peripheral'], noble: NobleTypes['noble']);
1139
- }
1140
- /**
1141
- * Class representing a WoRelaySwitch1 device.
1142
- * @see https://github.com/OpenWonderLabs/SwitchBotAPI-BLE/
1143
- */
1144
- export declare class WoRelaySwitch1 extends SwitchbotDevice {
1145
- constructor(peripheral: NobleTypes['peripheral'], noble: NobleTypes['noble']);
1146
- /**
1147
- * Parses the service data for WoRelaySwitch1.
1148
- * @param {Buffer} serviceData - The service data buffer.
1149
- * @param {Buffer} manufacturerData - The manufacturer data buffer.
1150
- * @param {Function} emitLog - The function to emit log messages.
1151
- * @returns {Promise<relaySwitch1ServiceData | null>} - Parsed service data or null if invalid.
1152
- */
1153
- static parseServiceData(serviceData: Buffer, manufacturerData: Buffer, emitLog: (level: string, message: string) => void): Promise<relaySwitch1ServiceData | null>;
1154
- /**
1155
- * Sends a command to the bot.
1156
- * @param {Buffer} reqBuf - The command buffer.
1157
- * @returns {Promise<void>}
1158
- */
1159
- protected sendCommand(reqBuf: Buffer): Promise<void>;
1160
- /**
1161
- * Turns on the bot.
1162
- * @returns {Promise<void>}
1163
- */
1164
- turnOn(): Promise<void>;
1165
- /**
1166
- * Turns off the bot.
1167
- * @returns {Promise<void>}
1168
- */
1169
- turnOff(): Promise<void>;
1170
- }
1171
- /**
1172
- * Class representing a WoRelaySwitch1PM device.
1173
- * @see https://github.com/OpenWonderLabs/SwitchBotAPI-BLE/
1174
- */
1175
- export declare class WoRelaySwitch1PM extends SwitchbotDevice {
1176
- constructor(peripheral: NobleTypes['peripheral'], noble: NobleTypes['noble']);
1177
- /**
1178
- * Parses the service data for WoRelaySwitch1PM.
1179
- * @param {Buffer} serviceData - The service data buffer.
1180
- * @param {Buffer} manufacturerData - The manufacturer data buffer.
1181
- * @param {Function} emitLog - The function to emit log messages.
1182
- * @returns {Promise<relaySwitch1PMServiceData | null>} - Parsed service data or null if invalid.
1183
- */
1184
- static parseServiceData(serviceData: Buffer, manufacturerData: Buffer, emitLog: (level: string, message: string) => void): Promise<relaySwitch1PMServiceData | null>;
1185
- /**
1186
- * Sends a command to the bot.
1187
- * @param {Buffer} reqBuf - The command buffer.
1188
- * @returns {Promise<void>}
1189
- */
1190
- protected sendCommand(reqBuf: Buffer): Promise<void>;
1191
- /**
1192
- * Turns on the bot.
1193
- * @returns {Promise<void>}
1194
- */
1195
- turnOn(): Promise<void>;
1196
- /**
1197
- * Turns off the bot.
1198
- * @returns {Promise<void>}
1199
- */
1200
- turnOff(): Promise<void>;
1201
- }
1202
- /**
1203
- * Class representing a WoRemote device.
1204
- * @see https://github.com/OpenWonderLabs/SwitchBotAPI-BLE/blob/latest/devicetypes/
1205
- */
1206
- export declare class WoRemote extends SwitchbotDevice {
1207
- /**
1208
- * Parses the service data for WoRemote.
1209
- * @param {Buffer} serviceData - The service data buffer.
1210
- * @param {Function} emitLog - The function to emit log messages.
1211
- * @returns {Promise<remoteServiceData | null>} - Parsed service data or null if invalid.
1212
- */
1213
- static parseServiceData(serviceData: Buffer, emitLog: (level: string, message: string) => void): Promise<remoteServiceData | null>;
1214
- constructor(peripheral: NobleTypes['peripheral'], noble: NobleTypes['noble']);
1215
- }
1216
- /**
1217
- * Class representing a WoSensorTH device.
1218
- * @see https://github.com/OpenWonderLabs/SwitchBotAPI-BLE/blob/latest/devicetypes/meter.md
1219
- */
1220
- export declare class WoSensorTH extends SwitchbotDevice {
1221
- constructor(peripheral: NobleTypes['peripheral'], noble: NobleTypes['noble']);
1222
- static parseServiceData(serviceData: Buffer, emitLog: (level: string, message: string) => void): Promise<meterServiceData | null>;
1223
- }
1224
- /**
1225
- * Class representing a WoSensorTH device.
1226
- * @see https://github.com/OpenWonderLabs/SwitchBotAPI-BLE/blob/latest/devicetypes/meter.md
1227
- */
1228
- export declare class WoSensorTHPlus extends SwitchbotDevice {
1229
- constructor(peripheral: NobleTypes['peripheral'], noble: NobleTypes['noble']);
1230
- static parseServiceData(serviceData: Buffer, emitLog: (level: string, message: string) => void): Promise<meterPlusServiceData | null>;
1231
- }
1232
- /**
1233
- * Class representing a WoSensorTH device.
1234
- * @see https://github.com/OpenWonderLabs/SwitchBotAPI-BLE/blob/latest/devicetypes/meter.md
1235
- */
1236
- export declare class WoSensorTHPro extends SwitchbotDevice {
1237
- constructor(peripheral: NobleTypes['peripheral'], noble: NobleTypes['noble']);
1238
- static parseServiceData(serviceData: Buffer, emitLog: (level: string, message: string) => void): Promise<meterProServiceData | null>;
1239
- }
1240
- /**
1241
- * Class representing a WoSensorTH device.
1242
- * @see https://github.com/OpenWonderLabs/SwitchBotAPI-BLE/blob/latest/devicetypes/meter.md
1243
- */
1244
- export declare class WoSensorTHProCO2 extends SwitchbotDevice {
1245
- constructor(peripheral: NobleTypes['peripheral'], noble: NobleTypes['noble']);
1246
- static parseServiceData(serviceData: Buffer, manufacturerData: Buffer, emitLog: (level: string, message: string) => void): Promise<meterProCO2ServiceData | null>;
1247
- }
1248
- /**
1249
- * Class representing a WoSmartLock device.
1250
- * @see https://github.com/OpenWonderLabs/SwitchBotAPI-BLE/blob/latest/devicetypes/lock.md
1251
- */
1252
- export declare class WoSmartLock extends SwitchbotDevice {
1253
- iv: Buffer | null;
1254
- key_id: string;
1255
- encryption_key: Buffer | null;
1256
- static Result: {
1257
- ERROR: number;
1258
- SUCCESS: number;
1259
- SUCCESS_LOW_BATTERY: number;
1260
- };
1261
- static validateResponse(res: Buffer): Promise<number>;
1262
- static getLockStatus(code: number): string;
1263
- /**
1264
- * Parses the service data from the SwitchBot Strip Light.
1265
- * @param {Buffer} serviceData - The service data buffer.
1266
- * @param {Buffer} manufacturerData - The manufacturer data buffer.
1267
- * @param {Function} emitLog - The function to emit log messages.
1268
- * @returns {Promise<lockServiceData | null>} - Parsed service data or null if invalid.
1269
- */
1270
- static parseServiceData(serviceData: Buffer, manufacturerData: Buffer, emitLog: (level: string, message: string) => void): Promise<lockServiceData | null>;
1271
- constructor(peripheral: NobleTypes['peripheral'], noble: NobleTypes['noble']);
1272
- /**
1273
- * Initializes the encryption key info for valid lock communication.
1274
- * @param {string} keyId - The key ID.
1275
- * @param {string} encryptionKey - The encryption key.
1276
- */
1277
- setKey(keyId: string, encryptionKey: string): Promise<void>;
1278
- /**
1279
- * Unlocks the Smart Lock.
1280
- * @returns {Promise<number>} - The result of the unlock operation.
1281
- */
1282
- unlock(): Promise<number>;
1283
- /**
1284
- * Unlocks the Smart Lock without unlatching the door.
1285
- * @returns {Promise<number>} - The result of the unlock operation.
1286
- */
1287
- unlockNoUnlatch(): Promise<number>;
1288
- /**
1289
- * Locks the Smart Lock.
1290
- * @returns {Promise<number>} - The result of the lock operation.
1291
- */
1292
- lock(): Promise<number>;
1293
- /**
1294
- * Gets general state info from the Smart Lock.
1295
- * @returns {Promise<object | null>} - The state object or null if an error occurred.
1296
- */
1297
- info(): Promise<object | null>;
1298
- /**
1299
- * Encrypts a string using AES-128-CTR.
1300
- * @param {string} str - The string to encrypt.
1301
- * @returns {Promise<string>} - The encrypted string in hex format.
1302
- */
1303
- encrypt(str: string): Promise<string>;
1304
- /**
1305
- * Decrypts a buffer using AES-128-CTR.
1306
- * @param {Buffer} data - The data to decrypt.
1307
- * @returns {Promise<Buffer>} - The decrypted data.
1308
- */
1309
- decrypt(data: Buffer): Promise<Buffer>;
1310
- /**
1311
- * Retrieves the IV from the device.
1312
- * @returns {Promise<Buffer>} - The IV buffer.
1313
- */
1314
- getIv(): Promise<Buffer>;
1315
- /**
1316
- * Sends an encrypted command to the device.
1317
- * @param {string} key - The command key.
1318
- * @returns {Promise<Buffer>} - The response buffer.
1319
- */
1320
- encryptedCommand(key: string): Promise<Buffer>;
1321
- /**
1322
- * Operates the lock with the given command.
1323
- * @param {string} key - The command key.
1324
- * @param {boolean} [encrypt] - Whether to encrypt the command.
1325
- * @returns {Promise<Buffer>} - The response buffer.
1326
- */
1327
- operateLock(key: string, encrypt?: boolean): Promise<Buffer>;
1328
- }
1329
- /**
1330
- * Class representing a WoSmartLockPro device.
1331
- * @see https://github.com/OpenWonderLabs/SwitchBotAPI-BLE/blob/latest/devicetypes/lock.md
1332
- */
1333
- export declare class WoSmartLockPro extends SwitchbotDevice {
1334
- iv: Buffer | null;
1335
- key_id: string;
1336
- encryption_key: Buffer | null;
1337
- static Result: {
1338
- ERROR: number;
1339
- SUCCESS: number;
1340
- SUCCESS_LOW_BATTERY: number;
1341
- };
1342
- static validateResponse(res: Buffer): Promise<number>;
1343
- static getLockStatus(code: number): string;
1344
- /**
1345
- * Parses the service data from the SwitchBot Strip Light.
1346
- * @param {Buffer} serviceData - The service data buffer.
1347
- * @param {Buffer} manufacturerData - The manufacturer data buffer.
1348
- * @param {Function} emitLog - The function to emit log messages.
1349
- * @returns {Promise<lockProServiceData | null>} - Parsed service data or null if invalid.
1350
- */
1351
- static parseServiceData(serviceData: Buffer, manufacturerData: Buffer, emitLog: (level: string, message: string) => void): Promise<lockProServiceData | null>;
1352
- constructor(peripheral: NobleTypes['peripheral'], noble: NobleTypes['noble']);
1353
- /**
1354
- * Initializes the encryption key info for valid lock communication.
1355
- * @param {string} keyId - The key ID.
1356
- * @param {string} encryptionKey - The encryption key.
1357
- */
1358
- setKey(keyId: string, encryptionKey: string): Promise<void>;
1359
- /**
1360
- * Unlocks the Smart Lock.
1361
- * @returns {Promise<number>} - The result of the unlock operation.
1362
- */
1363
- unlock(): Promise<number>;
1364
- /**
1365
- * Unlocks the Smart Lock without unlatching the door.
1366
- * @returns {Promise<number>} - The result of the unlock operation.
1367
- */
1368
- unlockNoUnlatch(): Promise<number>;
1369
- /**
1370
- * Locks the Smart Lock.
1371
- * @returns {Promise<number>} - The result of the lock operation.
1372
- */
1373
- lock(): Promise<number>;
1374
- /**
1375
- * Gets general state info from the Smart Lock.
1376
- * @returns {Promise<object | null>} - The state object or null if an error occurred.
1377
- */
1378
- info(): Promise<object | null>;
1379
- /**
1380
- * Encrypts a string using AES-128-CTR.
1381
- * @param {string} str - The string to encrypt.
1382
- * @returns {Promise<string>} - The encrypted string in hex format.
1383
- */
1384
- encrypt(str: string): Promise<string>;
1385
- /**
1386
- * Decrypts a buffer using AES-128-CTR.
1387
- * @param {Buffer} data - The data to decrypt.
1388
- * @returns {Promise<Buffer>} - The decrypted data.
1389
- */
1390
- decrypt(data: Buffer): Promise<Buffer>;
1391
- /**
1392
- * Retrieves the IV from the device.
1393
- * @returns {Promise<Buffer>} - The IV buffer.
1394
- */
1395
- getIv(): Promise<Buffer>;
1396
- /**
1397
- * Sends an encrypted command to the device.
1398
- * @param {string} key - The command key.
1399
- * @returns {Promise<Buffer>} - The response buffer.
1400
- */
1401
- encryptedCommand(key: string): Promise<Buffer>;
1402
- /**
1403
- * Operates the lock with the given command.
1404
- * @param {string} key - The command key.
1405
- * @param {boolean} [encrypt] - Whether to encrypt the command.
1406
- * @returns {Promise<Buffer>} - The response buffer.
1407
- */
1408
- operateLockPro(key: string, encrypt?: boolean): Promise<Buffer>;
1409
- }
1410
- /**
1411
- * Class representing a WoSmartLockUltra device.
1412
- * Reuses the LockPro parsing and encrypted command behavior but reports a distinct model.
1413
- */
1414
- export declare class WoSmartLockUltra extends WoSmartLockPro {
1415
- constructor(peripheral: NobleTypes['peripheral'], noble: NobleTypes['noble']);
1416
- static parseServiceData(serviceData: Buffer, manufacturerData: Buffer, emitLog: (level: string, message: string) => void): Promise<any>;
1417
- }
1418
- /**
1419
- * Class representing a WoStrip device.
1420
- * @see https://github.com/OpenWonderLabs/SwitchBotAPI-BLE/blob/latest/devicetypes/ledstriplight.md
1421
- */
1422
- export declare class WoStrip extends SwitchbotDevice {
1423
- /**
1424
- * Parses the service data from the SwitchBot Strip Light.
1425
- * @param {Buffer} serviceData - The service data buffer.
1426
- * @param {Function} emitLog - The function to emit log messages.
1427
- * @returns {Promise<stripLightServiceData | null>} - Parsed service data or null if invalid.
1428
- */
1429
- static parseServiceData(serviceData: Buffer, emitLog: (level: string, message: string) => void): Promise<stripLightServiceData | null>;
1430
- constructor(peripheral: NobleTypes['peripheral'], noble: NobleTypes['noble']);
1431
- /**
1432
- * Reads the state of the strip light.
1433
- * @returns {Promise<boolean>} - Resolves with true if the strip light is ON, false otherwise.
1434
- */
1435
- readState(): Promise<boolean>;
1436
- /**
1437
- * Sets the state of the strip light.
1438
- * @public
1439
- * @param {number[]} reqByteArray - The request byte array.
1440
- * @returns {Promise<boolean>} - Resolves with true if the operation was successful.
1441
- */
1442
- setState(reqByteArray: number[]): Promise<boolean>;
1443
- /**
1444
- * Turns the strip light on.
1445
- * @returns {Promise<boolean>} - Resolves with true if the strip light is ON.
1446
- */
1447
- turnOn(): Promise<boolean>;
1448
- /**
1449
- * Turns the strip light off.
1450
- * @returns {Promise<boolean>} - Resolves with true if the strip light is OFF.
1451
- */
1452
- turnOff(): Promise<boolean>;
1453
- /**
1454
- * Sets the brightness of the strip light.
1455
- * @param {number} brightness - The brightness percentage (0-100).
1456
- * @returns {Promise<boolean>} - Resolves with true if the operation was successful.
1457
- */
1458
- setBrightness(brightness: number): Promise<boolean>;
1459
- /**
1460
- * Sets the RGB values of the strip light.
1461
- * @param {number} brightness - The brightness percentage (0-100).
1462
- * @param {number} red - The red value (0-255).
1463
- * @param {number} green - The green value (0-255).
1464
- * @param {number} blue - The blue value (0-255).
1465
- * @returns {Promise<boolean>} - Resolves with true if the operation was successful.
1466
- */
1467
- setRGB(brightness: number, red: number, green: number, blue: number): Promise<boolean>;
1468
- /**
1469
- * Operates the strip light with the given byte array.
1470
- * @public
1471
- * @param {number[]} bytes - The byte array to send.
1472
- * @returns {Promise<boolean>} - Resolves with true if the operation was successful.
1473
- */
1474
- operateStripLight(bytes: number[]): Promise<boolean>;
1475
- }
1476
- /**
1477
- * Class representing a SwitchBot Air Purifier device.
1478
- * @extends SwitchbotDevice
1479
- */
1480
- export declare class WoAirPurifier extends SwitchbotDevice {
1481
- /**
1482
- * Parses service data for air purifier devices.
1483
- * @param {Buffer | null} serviceData - The service data buffer.
1484
- * @param {Buffer | null} manufacturerData - The manufacturer data buffer.
1485
- * @param {Function} emitLog - The function to emit log messages.
1486
- * @returns {airPurifierServiceData | null} - The parsed service data or null.
1487
- */
1488
- static parseServiceData(serviceData: Buffer | null, manufacturerData: Buffer | null, emitLog?: (level: string, message: string) => void): airPurifierServiceData | null;
1489
- /**
1490
- * Sets the state of the air purifier.
1491
- * @param {number[]} reqByteArray - The request byte array.
1492
- * @returns {Promise<boolean>} - Resolves with a boolean indicating whether the operation was successful.
1493
- * @private
1494
- */
1495
- setState(reqByteArray: number[]): Promise<boolean>;
1496
- /**
1497
- * Turns the air purifier on.
1498
- * @returns {Promise<boolean>} - Resolves with true if the air purifier is turned on.
1499
- */
1500
- turnOn(): Promise<boolean>;
1501
- /**
1502
- * Turns the air purifier off.
1503
- * @returns {Promise<boolean>} - Resolves with true if the air purifier is turned off.
1504
- */
1505
- turnOff(): Promise<boolean>;
1506
- /**
1507
- * Sets the speed of the air purifier.
1508
- * @param {number} speed - The speed value (0-100).
1509
- * @returns {Promise<boolean>} - Resolves with true if the operation was successful.
1510
- */
1511
- setSpeed(speed: number): Promise<boolean>;
1512
- /**
1513
- * Sets the mode of the air purifier.
1514
- * @param {number} mode - The mode value (1-4).
1515
- * @returns {Promise<boolean>} - Resolves with true if the operation was successful.
1516
- */
1517
- setMode(mode: number): Promise<boolean>;
1518
- /**
1519
- * Operates the air purifier with the given byte array.
1520
- * @public
1521
- * @param {number[]} bytes - The byte array to send.
1522
- * @returns {Promise<boolean>} - Resolves with true if the operation was successful.
1523
- */
1524
- operateAirPurifier(bytes: number[]): Promise<boolean>;
1525
- }
1526
- /**
1527
- * Class representing a SwitchBot Air Purifier Table device.
1528
- * @extends SwitchbotDevice
1529
- */
1530
- export declare class WoAirPurifierTable extends SwitchbotDevice {
1531
- /**
1532
- * Parses service data for air purifier table devices.
1533
- * @param {Buffer | null} serviceData - The service data buffer.
1534
- * @param {Buffer | null} manufacturerData - The manufacturer data buffer.
1535
- * @param {Function} emitLog - The function to emit log messages.
1536
- * @returns {airPurifierTableServiceData | null} - The parsed service data or null.
1537
- */
1538
- static parseServiceData(serviceData: Buffer | null, manufacturerData: Buffer | null, emitLog?: (level: string, message: string) => void): airPurifierTableServiceData | null;
1539
- /**
1540
- * Sets the state of the air purifier table.
1541
- * @param {number[]} reqByteArray - The request byte array.
1542
- * @returns {Promise<boolean>} - Resolves with a boolean indicating whether the operation was successful.
1543
- * @private
1544
- */
1545
- setState(reqByteArray: number[]): Promise<boolean>;
1546
- /**
1547
- * Turns the air purifier table on.
1548
- * @returns {Promise<boolean>} - Resolves with true if the air purifier table is turned on.
1549
- */
1550
- turnOn(): Promise<boolean>;
1551
- /**
1552
- * Turns the air purifier table off.
1553
- * @returns {Promise<boolean>} - Resolves with true if the air purifier table is turned off.
1554
- */
1555
- turnOff(): Promise<boolean>;
1556
- /**
1557
- * Sets the speed of the air purifier table.
1558
- * @param {number} speed - The speed value (0-100).
1559
- * @returns {Promise<boolean>} - Resolves with true if the operation was successful.
1560
- */
1561
- setSpeed(speed: number): Promise<boolean>;
1562
- /**
1563
- * Sets the mode of the air purifier table.
1564
- * @param {number} mode - The mode value (1-4).
1565
- * @returns {Promise<boolean>} - Resolves with true if the operation was successful.
1566
- */
1567
- setMode(mode: number): Promise<boolean>;
1568
- /**
1569
- * Operates the air purifier table with the given byte array.
1570
- * @public
1571
- * @param {number[]} bytes - The byte array to send.
1572
- * @returns {Promise<boolean>} - Resolves with true if the operation was successful.
1573
- */
1574
- operateAirPurifierTable(bytes: number[]): Promise<boolean>;
1575
- }
1576
- export {};
1577
- //# sourceMappingURL=device.d.ts.map