node-switchbot 3.5.0-beta.0 → 3.5.0-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (452) hide show
  1. package/.github/npm-version-script-esm.js +97 -0
  2. package/.github/workflows/beta-release.yml +1 -1
  3. package/.github/workflows/release.yml +1 -1
  4. package/BLE.md +14 -13
  5. package/CHANGELOG.md +68 -1
  6. package/OpenAPI.md +13 -12
  7. package/branding/Node_x_SwitchBot.svg +2 -3
  8. package/dist/device.d.ts +1193 -3
  9. package/dist/device.d.ts.map +1 -1
  10. package/dist/device.js +2478 -2
  11. package/dist/device.js.map +1 -1
  12. package/dist/index.d.ts +0 -17
  13. package/dist/index.d.ts.map +1 -1
  14. package/dist/index.js +0 -17
  15. package/dist/index.js.map +1 -1
  16. package/dist/{test/index.test.d.ts.map → index.test.d.ts.map} +1 -1
  17. package/dist/{test/index.test.js → index.test.js} +1 -1
  18. package/dist/index.test.js.map +1 -0
  19. package/dist/parameter-checker.d.ts +1 -1
  20. package/dist/parameter-checker.d.ts.map +1 -1
  21. package/dist/settings.d.ts +12 -28
  22. package/dist/settings.d.ts.map +1 -1
  23. package/dist/settings.js +24 -22
  24. package/dist/settings.js.map +1 -1
  25. package/dist/{test/settings.test.d.ts.map → settings.test.d.ts.map} +1 -1
  26. package/dist/{test/settings.test.js → settings.test.js} +6 -6
  27. package/dist/{test/settings.test.js.map → settings.test.js.map} +1 -1
  28. package/dist/switchbot-ble.d.ts +1 -1
  29. package/dist/switchbot-ble.d.ts.map +1 -1
  30. package/dist/switchbot-ble.js +8 -27
  31. package/dist/switchbot-ble.js.map +1 -1
  32. package/dist/switchbot-openapi.d.ts +33 -22
  33. package/dist/switchbot-openapi.d.ts.map +1 -1
  34. package/dist/switchbot-openapi.js +104 -64
  35. package/dist/switchbot-openapi.js.map +1 -1
  36. package/dist/types/bledevicestatus.d.ts +32 -8
  37. package/dist/types/bledevicestatus.d.ts.map +1 -1
  38. package/dist/types/devicestatus.d.ts +35 -1
  39. package/dist/types/devicestatus.d.ts.map +1 -1
  40. package/dist/types/devicewebhookstatus.d.ts +38 -1
  41. package/dist/types/devicewebhookstatus.d.ts.map +1 -1
  42. package/dist/types/types.d.ts +0 -223
  43. package/dist/types/types.d.ts.map +1 -1
  44. package/dist/types/types.js +1 -144
  45. package/dist/types/types.js.map +1 -1
  46. package/docs/assets/hierarchy.js +1 -0
  47. package/docs/assets/icons.js +1 -1
  48. package/docs/assets/icons.svg +1 -1
  49. package/docs/assets/main.js +5 -5
  50. package/docs/assets/navigation.js +1 -1
  51. package/docs/assets/search.js +1 -1
  52. package/docs/assets/style.css +1405 -1288
  53. package/docs/classes/Advertising.html +10 -10
  54. package/docs/classes/SwitchBotBLE.html +13 -13
  55. package/docs/classes/SwitchBotOpenAPI.html +38 -28
  56. package/docs/classes/SwitchbotDevice.html +26 -23
  57. package/docs/classes/WoBlindTilt.html +45 -42
  58. package/docs/classes/WoBulb.html +42 -39
  59. package/docs/classes/WoCeilingLight.html +50 -47
  60. package/docs/classes/WoContact.html +30 -27
  61. package/docs/classes/WoCurtain.html +40 -37
  62. package/docs/classes/WoHand.html +37 -34
  63. package/docs/classes/WoHub2.html +30 -27
  64. package/docs/classes/WoHumi.html +45 -40
  65. package/docs/classes/WoHumi2.html +67 -0
  66. package/docs/classes/WoIOSensorTH.html +30 -27
  67. package/docs/classes/WoKeypad.html +52 -0
  68. package/docs/classes/WoLeak.html +53 -0
  69. package/docs/classes/WoPlugMiniJP.html +78 -0
  70. package/docs/classes/WoPlugMiniUS.html +39 -36
  71. package/docs/classes/WoPresence.html +30 -27
  72. package/docs/classes/WoRelaySwitch1.html +57 -0
  73. package/docs/classes/WoRelaySwitch1PM.html +57 -0
  74. package/docs/classes/WoRemote.html +52 -0
  75. package/docs/classes/WoSensorTH.html +27 -24
  76. package/docs/classes/WoSensorTHPlus.html +46 -0
  77. package/docs/classes/WoSensorTHPro.html +46 -0
  78. package/docs/classes/WoSensorTHProCO2.html +46 -0
  79. package/docs/classes/WoSmartLock.html +49 -46
  80. package/docs/classes/WoSmartLockPro.html +49 -46
  81. package/docs/classes/WoStrip.html +44 -41
  82. package/docs/enums/LogLevel.html +10 -10
  83. package/docs/enums/SwitchBotBLEModel.html +29 -27
  84. package/docs/enums/SwitchBotBLEModelFriendlyName.html +30 -26
  85. package/docs/enums/SwitchBotBLEModelName.html +28 -26
  86. package/docs/enums/SwitchBotModel.html +47 -43
  87. package/docs/hierarchy.html +1 -1
  88. package/docs/index.html +13 -13
  89. package/docs/interfaces/AdvertisementData.html +3 -3
  90. package/docs/interfaces/Chars.html +2 -2
  91. package/docs/interfaces/ErrorObject.html +2 -2
  92. package/docs/interfaces/NobleTypes.html +2 -2
  93. package/docs/interfaces/Params.html +2 -2
  94. package/docs/interfaces/Rule.html +4 -4
  95. package/docs/interfaces/ServiceData.html +2 -2
  96. package/docs/interfaces/SwitchBotBLEDevice.html +23 -23
  97. package/docs/interfaces/WebhookDetail.html +4 -4
  98. package/docs/interfaces/ad.html +3 -3
  99. package/docs/interfaces/body.html +3 -3
  100. package/docs/interfaces/bodyChange.html +3 -3
  101. package/docs/interfaces/deleteWebhookResponse.html +3 -3
  102. package/docs/interfaces/device.html +6 -6
  103. package/docs/interfaces/deviceList.html +2 -2
  104. package/docs/interfaces/deviceStatus.html +6 -6
  105. package/docs/interfaces/deviceStatusRequest.html +3 -3
  106. package/docs/interfaces/deviceWebhook.html +4 -4
  107. package/docs/interfaces/deviceWebhookContext.html +4 -4
  108. package/docs/interfaces/devices.html +3 -3
  109. package/docs/interfaces/infraredRemoteList.html +2 -2
  110. package/docs/interfaces/irdevice.html +5 -5
  111. package/docs/interfaces/pushResponse.html +3 -3
  112. package/docs/interfaces/queryWebhookResponse.html +3 -3
  113. package/docs/interfaces/setupWebhookResponse.html +3 -3
  114. package/docs/interfaces/switchbot.html +2 -2
  115. package/docs/interfaces/updateWebhookResponse.html +3 -3
  116. package/docs/interfaces/webhookRequest.html +3 -3
  117. package/docs/media/BLE.md +14 -13
  118. package/docs/media/OpenAPI.md +13 -12
  119. package/docs/modules.html +1 -170
  120. package/docs/types/MacAddress.html +1 -1
  121. package/docs/types/batteryCirculatorFan.html +1 -1
  122. package/docs/types/batteryCirculatorFanServiceData.html +1 -1
  123. package/docs/types/batteryCirculatorFanStatus.html +1 -1
  124. package/docs/types/batteryCirculatorFanWebhookContext.html +1 -1
  125. package/docs/types/blindTilt.html +1 -1
  126. package/docs/types/blindTiltServiceData.html +1 -1
  127. package/docs/types/blindTiltStatus.html +1 -1
  128. package/docs/types/blindTiltWebhookContext.html +1 -1
  129. package/docs/types/bot.html +1 -1
  130. package/docs/types/botServiceData.html +1 -1
  131. package/docs/types/botStatus.html +1 -1
  132. package/docs/types/botWebhookContext.html +1 -1
  133. package/docs/types/ceilingLight.html +1 -1
  134. package/docs/types/ceilingLightPro.html +1 -1
  135. package/docs/types/ceilingLightProServiceData.html +1 -1
  136. package/docs/types/ceilingLightProStatus.html +1 -1
  137. package/docs/types/ceilingLightProWebhookContext.html +1 -1
  138. package/docs/types/ceilingLightServiceData.html +1 -1
  139. package/docs/types/ceilingLightStatus.html +1 -1
  140. package/docs/types/ceilingLightWebhookContext.html +1 -1
  141. package/docs/types/circulatorFanStatus.html +1 -0
  142. package/docs/types/circulatorFanWebhookContext.html +1 -0
  143. package/docs/types/colorBulb.html +1 -1
  144. package/docs/types/colorBulbServiceData.html +1 -1
  145. package/docs/types/colorBulbStatus.html +1 -1
  146. package/docs/types/colorBulbWebhookContext.html +1 -1
  147. package/docs/types/contactSensor.html +1 -1
  148. package/docs/types/contactSensorServiceData.html +1 -1
  149. package/docs/types/contactSensorStatus.html +1 -1
  150. package/docs/types/contactSensorWebhookContext.html +1 -1
  151. package/docs/types/curtain.html +1 -1
  152. package/docs/types/curtain3.html +1 -1
  153. package/docs/types/curtain3ServiceData.html +1 -1
  154. package/docs/types/curtain3WebhookContext.html +1 -1
  155. package/docs/types/curtainServiceData.html +1 -1
  156. package/docs/types/curtainStatus.html +1 -1
  157. package/docs/types/curtainWebhookContext.html +1 -1
  158. package/docs/types/floorCleaningRobotS10.html +1 -1
  159. package/docs/types/floorCleaningRobotS10Status.html +1 -1
  160. package/docs/types/floorCleaningRobotS10WebhookContext.html +1 -1
  161. package/docs/types/hub2.html +1 -1
  162. package/docs/types/hub2ServiceData.html +1 -1
  163. package/docs/types/hub2Status.html +1 -1
  164. package/docs/types/hub2WebhookContext.html +1 -1
  165. package/docs/types/humidifier.html +1 -1
  166. package/docs/types/humidifier2ServiceData.html +1 -0
  167. package/docs/types/humidifier2Status.html +1 -0
  168. package/docs/types/humidifier2WebhookContext.html +1 -0
  169. package/docs/types/humidifierServiceData.html +1 -1
  170. package/docs/types/humidifierStatus.html +1 -1
  171. package/docs/types/humidifierWebhookContext.html +1 -1
  172. package/docs/types/indoorCam.html +1 -1
  173. package/docs/types/indoorCameraWebhookContext.html +1 -1
  174. package/docs/types/keypad.html +1 -1
  175. package/docs/types/keypadDetectorServiceData.html +1 -1
  176. package/docs/types/keypadTouch.html +1 -1
  177. package/docs/types/keypadTouchWebhookContext.html +1 -1
  178. package/docs/types/keypadWebhookContext.html +1 -1
  179. package/docs/types/lock.html +1 -1
  180. package/docs/types/lockPro.html +1 -1
  181. package/docs/types/lockProServiceData.html +1 -1
  182. package/docs/types/lockProStatus.html +1 -1
  183. package/docs/types/lockProWebhookContext.html +1 -1
  184. package/docs/types/lockServiceData.html +1 -1
  185. package/docs/types/lockStatus.html +1 -1
  186. package/docs/types/lockWebhookContext.html +1 -1
  187. package/docs/types/meter.html +1 -1
  188. package/docs/types/meterPlus.html +1 -1
  189. package/docs/types/meterPlusServiceData.html +1 -1
  190. package/docs/types/meterPlusStatus.html +1 -1
  191. package/docs/types/meterPlusWebhookContext.html +1 -1
  192. package/docs/types/meterPro.html +1 -1
  193. package/docs/types/meterProCO2ServiceData.html +1 -1
  194. package/docs/types/meterProCO2Status.html +1 -1
  195. package/docs/types/meterProCO2WebhookContext.html +1 -1
  196. package/docs/types/meterProServiceData.html +1 -1
  197. package/docs/types/meterProStatus.html +1 -1
  198. package/docs/types/meterProWebhookContext.html +1 -1
  199. package/docs/types/meterServiceData.html +1 -1
  200. package/docs/types/meterStatus.html +1 -1
  201. package/docs/types/meterWebhookContext.html +1 -1
  202. package/docs/types/motionSensor.html +1 -1
  203. package/docs/types/motionSensorServiceData.html +1 -1
  204. package/docs/types/motionSensorStatus.html +1 -1
  205. package/docs/types/motionSensorWebhookContext.html +1 -1
  206. package/docs/types/onadvertisement.html +1 -1
  207. package/docs/types/ondiscover.html +1 -1
  208. package/docs/types/outdoorMeter.html +1 -1
  209. package/docs/types/outdoorMeterServiceData.html +1 -1
  210. package/docs/types/outdoorMeterStatus.html +1 -1
  211. package/docs/types/outdoorMeterWebhookContext.html +1 -1
  212. package/docs/types/panTiltCamWebhookContext.html +1 -1
  213. package/docs/types/pantiltCam.html +1 -1
  214. package/docs/types/pantiltCam2k.html +1 -1
  215. package/docs/types/plug.html +1 -1
  216. package/docs/types/plugMini.html +1 -1
  217. package/docs/types/plugMiniJPServiceData.html +1 -1
  218. package/docs/types/plugMiniJPWebhookContext.html +1 -1
  219. package/docs/types/plugMiniStatus.html +1 -1
  220. package/docs/types/plugMiniUSServiceData.html +1 -1
  221. package/docs/types/plugMiniUSWebhookContext.html +1 -1
  222. package/docs/types/plugStatus.html +1 -1
  223. package/docs/types/plugWebhookContext.html +1 -1
  224. package/docs/types/relaySwitch1Context.html +1 -0
  225. package/docs/types/relaySwitch1PMContext.html +1 -0
  226. package/docs/types/relaySwitch1PMServiceData.html +1 -1
  227. package/docs/types/relaySwitch1PMStatus.html +1 -0
  228. package/docs/types/relaySwitch1ServiceData.html +1 -0
  229. package/docs/types/relaySwitch1Status.html +1 -0
  230. package/docs/types/remote.html +1 -1
  231. package/docs/types/remoteServiceData.html +1 -0
  232. package/docs/types/robotVacuumCleanerS1.html +1 -1
  233. package/docs/types/robotVacuumCleanerS1Plus.html +1 -1
  234. package/docs/types/robotVacuumCleanerS1PlusStatus.html +1 -1
  235. package/docs/types/robotVacuumCleanerS1PlusWebhookContext.html +1 -1
  236. package/docs/types/robotVacuumCleanerS1Status.html +1 -1
  237. package/docs/types/robotVacuumCleanerS1WebhookContext.html +1 -1
  238. package/docs/types/robotVacuumCleanerServiceData.html +1 -1
  239. package/docs/types/stripLight.html +1 -1
  240. package/docs/types/stripLightServiceData.html +1 -1
  241. package/docs/types/stripLightStatus.html +1 -1
  242. package/docs/types/stripLightWebhookContext.html +1 -1
  243. package/docs/types/waterLeakDetector.html +1 -1
  244. package/docs/types/waterLeakDetectorServiceData.html +1 -1
  245. package/docs/types/waterLeakDetectorStatus.html +1 -1
  246. package/docs/types/waterLeakDetectorWebhookContext.html +1 -1
  247. package/package.json +16 -19
  248. package/.github/npm-version-script.cjs +0 -81
  249. package/dist/advertising.d.ts +0 -44
  250. package/dist/advertising.d.ts.map +0 -1
  251. package/dist/advertising.js +0 -163
  252. package/dist/advertising.js.map +0 -1
  253. package/dist/device/woblindtilt.d.ts +0 -78
  254. package/dist/device/woblindtilt.d.ts.map +0 -1
  255. package/dist/device/woblindtilt.js +0 -181
  256. package/dist/device/woblindtilt.js.map +0 -1
  257. package/dist/device/wobulb.d.ts +0 -70
  258. package/dist/device/wobulb.d.ts.map +0 -1
  259. package/dist/device/wobulb.js +0 -136
  260. package/dist/device/wobulb.js.map +0 -1
  261. package/dist/device/woceilinglight.d.ts +0 -74
  262. package/dist/device/woceilinglight.d.ts.map +0 -1
  263. package/dist/device/woceilinglight.js +0 -161
  264. package/dist/device/woceilinglight.js.map +0 -1
  265. package/dist/device/wocontact.d.ts +0 -19
  266. package/dist/device/wocontact.d.ts.map +0 -1
  267. package/dist/device/wocontact.js +0 -48
  268. package/dist/device/wocontact.js.map +0 -1
  269. package/dist/device/wocurtain.d.ts +0 -52
  270. package/dist/device/wocurtain.d.ts.map +0 -1
  271. package/dist/device/wocurtain.js +0 -135
  272. package/dist/device/wocurtain.js.map +0 -1
  273. package/dist/device/wohand.d.ts +0 -50
  274. package/dist/device/wohand.d.ts.map +0 -1
  275. package/dist/device/wohand.js +0 -82
  276. package/dist/device/wohand.js.map +0 -1
  277. package/dist/device/wohub2.d.ts +0 -19
  278. package/dist/device/wohub2.d.ts.map +0 -1
  279. package/dist/device/wohub2.js +0 -40
  280. package/dist/device/wohub2.js.map +0 -1
  281. package/dist/device/wohumi.d.ts +0 -50
  282. package/dist/device/wohumi.d.ts.map +0 -1
  283. package/dist/device/wohumi.js +0 -89
  284. package/dist/device/wohumi.js.map +0 -1
  285. package/dist/device/woiosensorth.d.ts +0 -20
  286. package/dist/device/woiosensorth.d.ts.map +0 -1
  287. package/dist/device/woiosensorth.js +0 -49
  288. package/dist/device/woiosensorth.js.map +0 -1
  289. package/dist/device/wokeypad.d.ts +0 -19
  290. package/dist/device/wokeypad.d.ts.map +0 -1
  291. package/dist/device/wokeypad.js +0 -51
  292. package/dist/device/wokeypad.js.map +0 -1
  293. package/dist/device/woleak.d.ts +0 -20
  294. package/dist/device/woleak.d.ts.map +0 -1
  295. package/dist/device/woleak.js +0 -52
  296. package/dist/device/woleak.js.map +0 -1
  297. package/dist/device/woplugmini.d.ts +0 -52
  298. package/dist/device/woplugmini.d.ts.map +0 -1
  299. package/dist/device/woplugmini.js +0 -110
  300. package/dist/device/woplugmini.js.map +0 -1
  301. package/dist/device/woplugmini_jp.d.ts +0 -52
  302. package/dist/device/woplugmini_jp.d.ts.map +0 -1
  303. package/dist/device/woplugmini_jp.js +0 -110
  304. package/dist/device/woplugmini_jp.js.map +0 -1
  305. package/dist/device/wopresence.d.ts +0 -19
  306. package/dist/device/wopresence.d.ts.map +0 -1
  307. package/dist/device/wopresence.js +0 -39
  308. package/dist/device/wopresence.js.map +0 -1
  309. package/dist/device/worelayswitch1plus.d.ts +0 -36
  310. package/dist/device/worelayswitch1plus.d.ts.map +0 -1
  311. package/dist/device/worelayswitch1plus.js +0 -141
  312. package/dist/device/worelayswitch1plus.js.map +0 -1
  313. package/dist/device/worelayswitch1pm.d.ts +0 -36
  314. package/dist/device/worelayswitch1pm.d.ts.map +0 -1
  315. package/dist/device/worelayswitch1pm.js +0 -144
  316. package/dist/device/worelayswitch1pm.js.map +0 -1
  317. package/dist/device/wosensorth.d.ts +0 -13
  318. package/dist/device/wosensorth.d.ts.map +0 -1
  319. package/dist/device/wosensorth.js +0 -38
  320. package/dist/device/wosensorth.js.map +0 -1
  321. package/dist/device/wosensorthplus.d.ts +0 -13
  322. package/dist/device/wosensorthplus.d.ts.map +0 -1
  323. package/dist/device/wosensorthplus.js +0 -38
  324. package/dist/device/wosensorthplus.js.map +0 -1
  325. package/dist/device/wosensorthpro.d.ts +0 -13
  326. package/dist/device/wosensorthpro.d.ts.map +0 -1
  327. package/dist/device/wosensorthpro.js +0 -38
  328. package/dist/device/wosensorthpro.js.map +0 -1
  329. package/dist/device/wosensorthproco2.d.ts +0 -13
  330. package/dist/device/wosensorthproco2.d.ts.map +0 -1
  331. package/dist/device/wosensorthproco2.js +0 -40
  332. package/dist/device/wosensorthproco2.js.map +0 -1
  333. package/dist/device/wosmartlock.d.ts +0 -86
  334. package/dist/device/wosmartlock.d.ts.map +0 -1
  335. package/dist/device/wosmartlock.js +0 -198
  336. package/dist/device/wosmartlock.js.map +0 -1
  337. package/dist/device/wosmartlockpro.d.ts +0 -86
  338. package/dist/device/wosmartlockpro.d.ts.map +0 -1
  339. package/dist/device/wosmartlockpro.js +0 -200
  340. package/dist/device/wosmartlockpro.js.map +0 -1
  341. package/dist/device/wostrip.d.ts +0 -63
  342. package/dist/device/wostrip.d.ts.map +0 -1
  343. package/dist/device/wostrip.js +0 -131
  344. package/dist/device/wostrip.js.map +0 -1
  345. package/dist/test/advertising.test.d.ts +0 -2
  346. package/dist/test/advertising.test.d.ts.map +0 -1
  347. package/dist/test/advertising.test.js +0 -99
  348. package/dist/test/advertising.test.js.map +0 -1
  349. package/dist/test/device.test.d.ts +0 -2
  350. package/dist/test/device.test.d.ts.map +0 -1
  351. package/dist/test/device.test.js +0 -38
  352. package/dist/test/device.test.js.map +0 -1
  353. package/dist/test/index.test.js.map +0 -1
  354. package/dist/test/parameter-checker.test.d.ts +0 -2
  355. package/dist/test/parameter-checker.test.d.ts.map +0 -1
  356. package/dist/test/parameter-checker.test.js +0 -108
  357. package/dist/test/parameter-checker.test.js.map +0 -1
  358. package/dist/test/switchbot-ble.test.d.ts +0 -2
  359. package/dist/test/switchbot-ble.test.d.ts.map +0 -1
  360. package/dist/test/switchbot-ble.test.js +0 -45
  361. package/dist/test/switchbot-ble.test.js.map +0 -1
  362. package/dist/test/switchbot-openapi.test.d.ts +0 -2
  363. package/dist/test/switchbot-openapi.test.d.ts.map +0 -1
  364. package/dist/test/switchbot-openapi.test.js +0 -96
  365. package/dist/test/switchbot-openapi.test.js.map +0 -1
  366. package/dist/test/woblindtilt.test.d.ts +0 -2
  367. package/dist/test/woblindtilt.test.d.ts.map +0 -1
  368. package/dist/test/woblindtilt.test.js +0 -76
  369. package/dist/test/woblindtilt.test.js.map +0 -1
  370. package/dist/test/wobulb.test.d.ts +0 -2
  371. package/dist/test/wobulb.test.d.ts.map +0 -1
  372. package/dist/test/wobulb.test.js +0 -95
  373. package/dist/test/wobulb.test.js.map +0 -1
  374. package/dist/test/woceilinglight.test.d.ts +0 -2
  375. package/dist/test/woceilinglight.test.d.ts.map +0 -1
  376. package/dist/test/woceilinglight.test.js +0 -81
  377. package/dist/test/woceilinglight.test.js.map +0 -1
  378. package/dist/test/wocontact.test.d.ts +0 -2
  379. package/dist/test/wocontact.test.d.ts.map +0 -1
  380. package/dist/test/wocontact.test.js +0 -65
  381. package/dist/test/wocontact.test.js.map +0 -1
  382. package/dist/test/wocurtain.test.d.ts +0 -2
  383. package/dist/test/wocurtain.test.d.ts.map +0 -1
  384. package/dist/test/wocurtain.test.js +0 -75
  385. package/dist/test/wocurtain.test.js.map +0 -1
  386. package/dist/test/wohand.test.d.ts +0 -2
  387. package/dist/test/wohand.test.d.ts.map +0 -1
  388. package/dist/test/wohand.test.js +0 -56
  389. package/dist/test/wohand.test.js.map +0 -1
  390. package/dist/test/wohub2.test.d.ts +0 -2
  391. package/dist/test/wohub2.test.d.ts.map +0 -1
  392. package/dist/test/wohub2.test.js +0 -80
  393. package/dist/test/wohub2.test.js.map +0 -1
  394. package/dist/test/wohumi.test.d.ts +0 -2
  395. package/dist/test/wohumi.test.d.ts.map +0 -1
  396. package/dist/test/wohumi.test.js +0 -82
  397. package/dist/test/wohumi.test.js.map +0 -1
  398. package/dist/test/woiosensorth.test.d.ts +0 -2
  399. package/dist/test/woiosensorth.test.d.ts.map +0 -1
  400. package/dist/test/woiosensorth.test.js +0 -40
  401. package/dist/test/woiosensorth.test.js.map +0 -1
  402. package/dist/test/wokeypad.test.d.ts +0 -2
  403. package/dist/test/wokeypad.test.d.ts.map +0 -1
  404. package/dist/test/wokeypad.test.js +0 -46
  405. package/dist/test/wokeypad.test.js.map +0 -1
  406. package/dist/test/woleak.test.d.ts +0 -2
  407. package/dist/test/woleak.test.d.ts.map +0 -1
  408. package/dist/test/woleak.test.js +0 -51
  409. package/dist/test/woleak.test.js.map +0 -1
  410. package/dist/test/woplugmini.test.d.ts +0 -2
  411. package/dist/test/woplugmini.test.d.ts.map +0 -1
  412. package/dist/test/woplugmini.test.js +0 -90
  413. package/dist/test/woplugmini.test.js.map +0 -1
  414. package/dist/test/woplugmini_jp.test.d.ts +0 -2
  415. package/dist/test/woplugmini_jp.test.d.ts.map +0 -1
  416. package/dist/test/woplugmini_jp.test.js +0 -90
  417. package/dist/test/woplugmini_jp.test.js.map +0 -1
  418. package/dist/test/wopresence.test.d.ts +0 -2
  419. package/dist/test/wopresence.test.d.ts.map +0 -1
  420. package/dist/test/wopresence.test.js +0 -68
  421. package/dist/test/wopresence.test.js.map +0 -1
  422. package/dist/test/wosensorth.test.d.ts +0 -2
  423. package/dist/test/wosensorth.test.d.ts.map +0 -1
  424. package/dist/test/wosensorth.test.js +0 -29
  425. package/dist/test/wosensorth.test.js.map +0 -1
  426. package/dist/test/wosensorthplus.test.d.ts +0 -2
  427. package/dist/test/wosensorthplus.test.d.ts.map +0 -1
  428. package/dist/test/wosensorthplus.test.js +0 -29
  429. package/dist/test/wosensorthplus.test.js.map +0 -1
  430. package/dist/test/wosensorthpro.test.d.ts +0 -2
  431. package/dist/test/wosensorthpro.test.d.ts.map +0 -1
  432. package/dist/test/wosensorthpro.test.js +0 -29
  433. package/dist/test/wosensorthpro.test.js.map +0 -1
  434. package/dist/test/wosensorthproco2.test.d.ts +0 -2
  435. package/dist/test/wosensorthproco2.test.d.ts.map +0 -1
  436. package/dist/test/wosensorthproco2.test.js +0 -32
  437. package/dist/test/wosensorthproco2.test.js.map +0 -1
  438. package/dist/test/wosmartlock.test.d.ts +0 -2
  439. package/dist/test/wosmartlock.test.d.ts.map +0 -1
  440. package/dist/test/wosmartlock.test.js +0 -151
  441. package/dist/test/wosmartlock.test.js.map +0 -1
  442. package/dist/test/wosmartlockpro.test.d.ts +0 -2
  443. package/dist/test/wosmartlockpro.test.d.ts.map +0 -1
  444. package/dist/test/wosmartlockpro.test.js +0 -150
  445. package/dist/test/wosmartlockpro.test.js.map +0 -1
  446. package/dist/test/wostrip.test.d.ts +0 -2
  447. package/dist/test/wostrip.test.d.ts.map +0 -1
  448. package/dist/test/wostrip.test.js +0 -102
  449. package/dist/test/wostrip.test.js.map +0 -1
  450. package/docs/types/relaySwitch1PlusServiceData.html +0 -1
  451. /package/dist/{test/index.test.d.ts → index.test.d.ts} +0 -0
  452. /package/dist/{test/settings.test.d.ts → settings.test.d.ts} +0 -0
@@ -1,135 +0,0 @@
1
- import { Buffer } from 'node:buffer';
2
- import { SwitchbotDevice } from '../device.js';
3
- import { SwitchBotBLEModel, SwitchBotBLEModelFriendlyName, SwitchBotBLEModelName } from '../types/types.js';
4
- /**
5
- * Class representing a WoCurtain device.
6
- * @see https://github.com/OpenWonderLabs/SwitchBotAPI-BLE/blob/latest/devicetypes/curtain.md
7
- * @see https://github.com/OpenWonderLabs/SwitchBotAPI-BLE/blob/latest/devicetypes/curtain3.md
8
- */
9
- export class WoCurtain extends SwitchbotDevice {
10
- /**
11
- * Parses the service data for WoCurtain.
12
- * @param {Buffer} serviceData - The service data buffer.
13
- * @param {Buffer} manufacturerData - The manufacturer data buffer.
14
- * @param {Function} emitLog - The function to emit log messages.
15
- * @param {boolean} [reverse] - Whether to reverse the position.
16
- * @returns {Promise<curtainServiceData | curtain3ServiceData | null>} - Parsed service data or null if invalid.
17
- */
18
- static async parseServiceData(serviceData, manufacturerData, emitLog, reverse = false) {
19
- if (![5, 6].includes(serviceData.length)) {
20
- emitLog('debugerror', `[parseServiceDataForWoCurtain] Buffer length ${serviceData.length} !== 5 or 6!`);
21
- return null;
22
- }
23
- const byte1 = serviceData.readUInt8(1);
24
- const byte2 = serviceData.readUInt8(2);
25
- let deviceData;
26
- let batteryData = null;
27
- if (manufacturerData.length >= 13) {
28
- deviceData = manufacturerData.subarray(8, 11);
29
- batteryData = manufacturerData.readUInt8(12);
30
- }
31
- else if (manufacturerData.length >= 11) {
32
- deviceData = manufacturerData.subarray(8, 11);
33
- batteryData = byte2;
34
- }
35
- else {
36
- deviceData = serviceData.subarray(3, 6);
37
- batteryData = byte2;
38
- }
39
- const model = serviceData.subarray(0, 1).toString('utf8') ? SwitchBotBLEModel.Curtain : SwitchBotBLEModel.Curtain3;
40
- const calibration = Boolean(byte1 & 0b01000000);
41
- if (model === SwitchBotBLEModel.Curtain) {
42
- const byte3 = serviceData.readUInt8(3);
43
- const byte4 = serviceData.readUInt8(4);
44
- const position = byte3 & 0b01111111;
45
- const inMotion = Boolean(byte3 & 0b10000000);
46
- const lightLevel = (byte4 >> 4) & 0b00001111;
47
- const deviceChain = byte4 & 0b00000111;
48
- const battery = byte2 & 0b01111111;
49
- const data = {
50
- model: SwitchBotBLEModel.Curtain,
51
- modelName: SwitchBotBLEModelName.Curtain,
52
- modelFriendlyName: SwitchBotBLEModelFriendlyName.Curtain,
53
- calibration,
54
- battery: battery ?? 0,
55
- inMotion,
56
- position: reverse ? 100 - position : position,
57
- lightLevel,
58
- deviceChain,
59
- };
60
- return data;
61
- }
62
- else {
63
- const position = Math.max(Math.min(deviceData.readUInt8(0) & 0b01111111, 100), 0);
64
- const inMotion = Boolean(deviceData.readUInt8(0) & 0b10000000);
65
- const lightLevel = (deviceData.readUInt8(1) >> 4) & 0b00001111;
66
- const deviceChain = deviceData.readUInt8(1) & 0b00000111;
67
- const battery = batteryData !== null ? batteryData & 0b01111111 : 0;
68
- const data = {
69
- model: SwitchBotBLEModel.Curtain3,
70
- modelName: SwitchBotBLEModelName.Curtain3,
71
- modelFriendlyName: SwitchBotBLEModelFriendlyName.Curtain3,
72
- calibration,
73
- battery,
74
- inMotion,
75
- position: reverse ? 100 - position : position,
76
- lightLevel,
77
- deviceChain,
78
- };
79
- return data;
80
- }
81
- }
82
- constructor(peripheral, noble) {
83
- super(peripheral, noble);
84
- }
85
- /**
86
- * Opens the curtain.
87
- * @param {number} [mode] - Running mode (0x01 = QuietDrift, 0xFF = Default).
88
- * @returns {Promise<void>}
89
- */
90
- async open(mode = 0xFF) {
91
- await this.runToPos(0, mode);
92
- }
93
- /**
94
- * Closes the curtain.
95
- * @param {number} [mode] - Running mode (0x01 = QuietDrift, 0xFF = Default).
96
- * @returns {Promise<void>}
97
- */
98
- async close(mode = 0xFF) {
99
- await this.runToPos(100, mode);
100
- }
101
- /**
102
- * Pauses the curtain.
103
- * @returns {Promise<void>}
104
- */
105
- async pause() {
106
- await this.operateCurtain([0x57, 0x0F, 0x45, 0x01, 0x00, 0xFF]);
107
- }
108
- /**
109
- * Runs the curtain to the target position.
110
- * @param {number} percent - The percentage of the target position.
111
- * @param {number} [mode] - Running mode (0x01 = QuietDrift, 0xFF = Default).
112
- * @returns {Promise<void>}
113
- */
114
- async runToPos(percent, mode = 0xFF) {
115
- if (typeof percent !== 'number' || typeof mode !== 'number') {
116
- throw new TypeError('Invalid type for percent or mode');
117
- }
118
- percent = Math.max(0, Math.min(100, percent));
119
- await this.operateCurtain([0x57, 0x0F, 0x45, 0x01, 0x05, mode, percent]);
120
- }
121
- /**
122
- * Sends a command to the curtain.
123
- * @param {number[]} bytes - The command bytes.
124
- * @returns {Promise<void>}
125
- */
126
- async operateCurtain(bytes) {
127
- const reqBuf = Buffer.from(bytes);
128
- const resBuf = await this.command(reqBuf);
129
- const code = resBuf.readUInt8(0);
130
- if (resBuf.length !== 3 || code !== 0x01) {
131
- throw new Error(`The device returned an error: 0x${resBuf.toString('hex')}`);
132
- }
133
- }
134
- }
135
- //# sourceMappingURL=wocurtain.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"wocurtain.js","sourceRoot":"","sources":["../../src/device/wocurtain.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AAEpC,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AAC9C,OAAO,EAAE,iBAAiB,EAAE,6BAA6B,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAA;AAE3G;;;;GAIG;AACH,MAAM,OAAO,SAAU,SAAQ,eAAe;IAC5C;;;;;;;OAOG;IACH,MAAM,CAAC,KAAK,CAAC,gBAAgB,CAC3B,WAAmB,EACnB,gBAAwB,EACxB,OAAiD,EACjD,UAAmB,KAAK;QAExB,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,WAAW,CAAC,MAAM,CAAC,EAAE,CAAC;YACzC,OAAO,CAAC,YAAY,EAAE,gDAAgD,WAAW,CAAC,MAAM,cAAc,CAAC,CAAA;YACvG,OAAO,IAAI,CAAA;QACb,CAAC;QAED,MAAM,KAAK,GAAG,WAAW,CAAC,SAAS,CAAC,CAAC,CAAC,CAAA;QACtC,MAAM,KAAK,GAAG,WAAW,CAAC,SAAS,CAAC,CAAC,CAAC,CAAA;QAEtC,IAAI,UAAkB,CAAA;QACtB,IAAI,WAAW,GAAkB,IAAI,CAAA;QAEr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,MAAM,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAA;QACzC,MAAM,IAAI,GAAG,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,CAAA;QAEhC,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC,IAAI,IAAI,KAAK,IAAI,EAAE,CAAC;YACzC,MAAM,IAAI,KAAK,CAAC,mCAAmC,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC,CAAA;QAC9E,CAAC;IACH,CAAC;CACF"}
@@ -1,50 +0,0 @@
1
- import type { botServiceData } from '../types/bledevicestatus.js';
2
- import type { NobleTypes } from '../types/types.js';
3
- import { Buffer } from 'node:buffer';
4
- import { SwitchbotDevice } from '../device.js';
5
- /**
6
- * Class representing a WoHand device.
7
- * @see https://github.com/OpenWonderLabs/SwitchBotAPI-BLE/blob/latest/devicetypes/bot.md
8
- */
9
- export declare class WoHand extends SwitchbotDevice {
10
- /**
11
- * Parses the service data for WoHand.
12
- * @param {Buffer} serviceData - The service data buffer.
13
- * @param {Function} emitLog - The function to emit log messages.
14
- * @returns {Promise<botServiceData | null>} - Parsed service data or null if invalid.
15
- */
16
- static parseServiceData(serviceData: Buffer, emitLog: (level: string, message: string) => void): Promise<botServiceData | null>;
17
- constructor(peripheral: NobleTypes['peripheral'], noble: NobleTypes['noble']);
18
- /**
19
- * Sends a command to the bot.
20
- * @param {Buffer} reqBuf - The command buffer.
21
- * @returns {Promise<void>}
22
- */
23
- protected sendCommand(reqBuf: Buffer): Promise<void>;
24
- /**
25
- * Presses the bot.
26
- * @returns {Promise<void>}
27
- */
28
- press(): Promise<void>;
29
- /**
30
- * Turns on the bot.
31
- * @returns {Promise<void>}
32
- */
33
- turnOn(): Promise<void>;
34
- /**
35
- * Turns off the bot.
36
- * @returns {Promise<void>}
37
- */
38
- turnOff(): Promise<void>;
39
- /**
40
- * Moves the bot down.
41
- * @returns {Promise<void>}
42
- */
43
- down(): Promise<void>;
44
- /**
45
- * Moves the bot up.
46
- * @returns {Promise<void>}
47
- */
48
- up(): Promise<void>;
49
- }
50
- //# sourceMappingURL=wohand.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"wohand.d.ts","sourceRoot":"","sources":["../../src/device/wohand.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAA;AACjE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAA;AAEnD,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AAEpC,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AAG9C;;;GAGG;AACH,qBAAa,MAAO,SAAQ,eAAe;IACzC;;;;;OAKG;WACU,gBAAgB,CAC3B,WAAW,EAAE,MAAM,EACnB,OAAO,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,KAAK,IAAI,GAChD,OAAO,CAAC,cAAc,GAAG,IAAI,CAAC;gBAmBrB,UAAU,EAAE,UAAU,CAAC,YAAY,CAAC,EAAE,KAAK,EAAE,UAAU,CAAC,OAAO,CAAC;IAI5E;;;;OAIG;cACa,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAS1D;;;OAGG;IACU,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAInC;;;OAGG;IACU,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC;IAIpC;;;OAGG;IACU,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IAIrC;;;OAGG;IACU,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAIlC;;;OAGG;IACU,EAAE,IAAI,OAAO,CAAC,IAAI,CAAC;CAGjC"}
@@ -1,82 +0,0 @@
1
- import { Buffer } from 'node:buffer';
2
- import { SwitchbotDevice } from '../device.js';
3
- import { SwitchBotBLEModel, SwitchBotBLEModelFriendlyName, SwitchBotBLEModelName } from '../types/types.js';
4
- /**
5
- * Class representing a WoHand device.
6
- * @see https://github.com/OpenWonderLabs/SwitchBotAPI-BLE/blob/latest/devicetypes/bot.md
7
- */
8
- export class WoHand extends SwitchbotDevice {
9
- /**
10
- * Parses the service data for WoHand.
11
- * @param {Buffer} serviceData - The service data buffer.
12
- * @param {Function} emitLog - The function to emit log messages.
13
- * @returns {Promise<botServiceData | null>} - Parsed service data or null if invalid.
14
- */
15
- static async parseServiceData(serviceData, emitLog) {
16
- if (serviceData.length !== 3) {
17
- emitLog('debugerror', `[parseServiceData] Buffer length ${serviceData.length} !== 3!`);
18
- return null;
19
- }
20
- const byte1 = serviceData.readUInt8(1);
21
- const byte2 = serviceData.readUInt8(2);
22
- return {
23
- model: SwitchBotBLEModel.Bot,
24
- modelName: SwitchBotBLEModelName.Bot,
25
- modelFriendlyName: SwitchBotBLEModelFriendlyName.Bot,
26
- mode: !!(byte1 & 0b10000000), // Whether the light switch Add-on is used or not. 0 = press, 1 = switch
27
- state: !(byte1 & 0b01000000), // Whether the switch status is ON or OFF. 0 = on, 1 = off
28
- battery: byte2 & 0b01111111, // %
29
- };
30
- }
31
- constructor(peripheral, noble) {
32
- super(peripheral, noble);
33
- }
34
- /**
35
- * Sends a command to the bot.
36
- * @param {Buffer} reqBuf - The command buffer.
37
- * @returns {Promise<void>}
38
- */
39
- async sendCommand(reqBuf) {
40
- const resBuf = await this.command(reqBuf);
41
- const code = resBuf.readUInt8(0);
42
- if (resBuf.length !== 3 || (code !== 0x01 && code !== 0x05)) {
43
- throw new Error(`The device returned an error: 0x${resBuf.toString('hex')}`);
44
- }
45
- }
46
- /**
47
- * Presses the bot.
48
- * @returns {Promise<void>}
49
- */
50
- async press() {
51
- await this.sendCommand(Buffer.from([0x57, 0x01, 0x00]));
52
- }
53
- /**
54
- * Turns on the bot.
55
- * @returns {Promise<void>}
56
- */
57
- async turnOn() {
58
- await this.sendCommand(Buffer.from([0x57, 0x01, 0x01]));
59
- }
60
- /**
61
- * Turns off the bot.
62
- * @returns {Promise<void>}
63
- */
64
- async turnOff() {
65
- await this.sendCommand(Buffer.from([0x57, 0x01, 0x02]));
66
- }
67
- /**
68
- * Moves the bot down.
69
- * @returns {Promise<void>}
70
- */
71
- async down() {
72
- await this.sendCommand(Buffer.from([0x57, 0x01, 0x03]));
73
- }
74
- /**
75
- * Moves the bot up.
76
- * @returns {Promise<void>}
77
- */
78
- async up() {
79
- await this.sendCommand(Buffer.from([0x57, 0x01, 0x04]));
80
- }
81
- }
82
- //# sourceMappingURL=wohand.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"wohand.js","sourceRoot":"","sources":["../../src/device/wohand.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AAEpC,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AAC9C,OAAO,EAAE,iBAAiB,EAAE,6BAA6B,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAA;AAE3G;;;GAGG;AACH,MAAM,OAAO,MAAO,SAAQ,eAAe;IACzC;;;;;OAKG;IACH,MAAM,CAAC,KAAK,CAAC,gBAAgB,CAC3B,WAAmB,EACnB,OAAiD;QAEjD,IAAI,WAAW,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YAC7B,OAAO,CAAC,YAAY,EAAE,oCAAoC,WAAW,CAAC,MAAM,SAAS,CAAC,CAAA;YACtF,OAAO,IAAI,CAAA;QACb,CAAC;QAED,MAAM,KAAK,GAAG,WAAW,CAAC,SAAS,CAAC,CAAC,CAAC,CAAA;QACtC,MAAM,KAAK,GAAG,WAAW,CAAC,SAAS,CAAC,CAAC,CAAC,CAAA;QAEtC,OAAO;YACL,KAAK,EAAE,iBAAiB,CAAC,GAAG;YAC5B,SAAS,EAAE,qBAAqB,CAAC,GAAG;YACpC,iBAAiB,EAAE,6BAA6B,CAAC,GAAG;YACpD,IAAI,EAAE,CAAC,CAAC,CAAC,KAAK,GAAG,UAAU,CAAC,EAAE,wEAAwE;YACtG,KAAK,EAAE,CAAC,CAAC,KAA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I,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC,CAAA;IACzD,CAAC;IAED;;;OAGG;IACI,KAAK,CAAC,EAAE;QACb,MAAM,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC,CAAA;IACzD,CAAC;CACF"}
@@ -1,19 +0,0 @@
1
- import type { Buffer } from 'node:buffer';
2
- import type { hub2ServiceData } from '../types/bledevicestatus.js';
3
- import type { NobleTypes } from '../types/types.js';
4
- import { SwitchbotDevice } from '../device.js';
5
- /**
6
- * Class representing a WoHub2 device.
7
- * @see https://github.com/OpenWonderLabs/SwitchBotAPI-BLE/blob/latest/devicetypes/meter.md
8
- */
9
- export declare class WoHub2 extends SwitchbotDevice {
10
- /**
11
- * Parses the service data for WoHub2.
12
- * @param {Buffer} manufacturerData - The manufacturer data buffer.
13
- * @param {Function} emitLog - The function to emit log messages.
14
- * @returns {Promise<hub2ServiceData | null>} - Parsed service data or null if invalid.
15
- */
16
- static parseServiceData(manufacturerData: Buffer, emitLog: (level: string, message: string) => void): Promise<hub2ServiceData | null>;
17
- constructor(peripheral: NobleTypes['peripheral'], noble: NobleTypes['noble']);
18
- }
19
- //# sourceMappingURL=wohub2.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"wohub2.d.ts","sourceRoot":"","sources":["../../src/device/wohub2.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AAEzC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAA;AAClE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAA;AAEnD,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AAG9C;;;GAGG;AACH,qBAAa,MAAO,SAAQ,eAAe;IACzC;;;;;OAKG;WACU,gBAAgB,CAC3B,gBAAgB,EAAE,MAAM,EACxB,OAAO,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,KAAK,IAAI,GAChD,OAAO,CAAC,eAAe,GAAG,IAAI,CAAC;gBA2BtB,UAAU,EAAE,UAAU,CAAC,YAAY,CAAC,EAAE,KAAK,EAAE,UAAU,CAAC,OAAO,CAAC;CAG7E"}
@@ -1,40 +0,0 @@
1
- import { SwitchbotDevice } from '../device.js';
2
- import { SwitchBotBLEModel, SwitchBotBLEModelFriendlyName, SwitchBotBLEModelName } from '../types/types.js';
3
- /**
4
- * Class representing a WoHub2 device.
5
- * @see https://github.com/OpenWonderLabs/SwitchBotAPI-BLE/blob/latest/devicetypes/meter.md
6
- */
7
- export class WoHub2 extends SwitchbotDevice {
8
- /**
9
- * Parses the service data for WoHub2.
10
- * @param {Buffer} manufacturerData - The manufacturer data buffer.
11
- * @param {Function} emitLog - The function to emit log messages.
12
- * @returns {Promise<hub2ServiceData | null>} - Parsed service data or null if invalid.
13
- */
14
- static async parseServiceData(manufacturerData, emitLog) {
15
- if (manufacturerData.length !== 16) {
16
- emitLog('debugerror', `[parseServiceDataForWoHub2] Buffer length ${manufacturerData.length} !== 16!`);
17
- return null;
18
- }
19
- const [byte0, byte1, byte2, , , , , , , , , , byte12] = manufacturerData;
20
- const tempSign = byte1 & 0b10000000 ? 1 : -1;
21
- const tempC = tempSign * ((byte1 & 0b01111111) + (byte0 & 0b00001111) / 10);
22
- const tempF = Math.round(((tempC * 9) / 5 + 32) * 10) / 10;
23
- const lightLevel = byte12 & 0b11111;
24
- const data = {
25
- model: SwitchBotBLEModel.Hub2,
26
- modelName: SwitchBotBLEModelName.Hub2,
27
- modelFriendlyName: SwitchBotBLEModelFriendlyName.Hub2,
28
- celsius: tempC,
29
- fahrenheit: tempF,
30
- fahrenheit_mode: !!(byte2 & 0b10000000),
31
- humidity: byte2 & 0b01111111,
32
- lightLevel,
33
- };
34
- return data;
35
- }
36
- constructor(peripheral, noble) {
37
- super(peripheral, noble);
38
- }
39
- }
40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iB,CAAC,IAAI;YAC7B,SAAS,EAAE,qBAAqB,CAAC,IAAI;YACrC,iBAAiB,EAAE,6BAA6B,CAAC,IAAI;YACrD,OAAO,EAAE,KAAK;YACd,UAAU,EAAE,KAAK;YACjB,eAAe,EAAE,CAAC,CAAC,CAAC,KAAK,GAAG,UAAU,CAAC;YACvC,QAAQ,EAAE,KAAK,GAAG,UAAU;YAC5B,UAAU;SACX,CAAA;QAED,OAAO,IAAI,CAAA;IACb,CAAC;IAED,YAAY,UAAoC,EAAE,KAA0B;QAC1E,KAAK,CAAC,UAAU,EAAE,KAAK,CAAC,CAAA;IAC1B,CAAC;CACF"}
@@ -1,50 +0,0 @@
1
- import type { humidifierServiceData } from '../types/bledevicestatus.js';
2
- import type { NobleTypes } from '../types/types.js';
3
- import { Buffer } from 'node:buffer';
4
- import { SwitchbotDevice } from '../device.js';
5
- /**
6
- * Class representing a WoHumi device.
7
- * @see https://github.com/OpenWonderLabs/SwitchBotAPI-BLE/tree/latest/devicetypes
8
- */
9
- export declare class WoHumi extends SwitchbotDevice {
10
- /**
11
- * Parses the service data for WoHumi.
12
- * @param {Buffer} serviceData - The service data buffer.
13
- * @param {Function} emitLog - The function to emit log messages.
14
- * @returns {Promise<humidifierServiceData | null>} - Parsed service data or null if invalid.
15
- */
16
- static parseServiceData(serviceData: Buffer, emitLog: (level: string, message: string) => void): Promise<humidifierServiceData | null>;
17
- constructor(peripheral: NobleTypes['peripheral'], noble: NobleTypes['noble']);
18
- /**
19
- * Sends a command to the humidifier.
20
- * @param {number[]} bytes - The command bytes.
21
- * @returns {Promise<void>}
22
- */
23
- operateHumi(bytes: number[]): Promise<void>;
24
- /**
25
- * Presses the humidifier button.
26
- * @returns {Promise<void>}
27
- */
28
- press(): Promise<void>;
29
- /**
30
- * Turns on the humidifier.
31
- * @returns {Promise<void>}
32
- */
33
- turnOn(): Promise<void>;
34
- /**
35
- * Turns off the humidifier.
36
- * @returns {Promise<void>}
37
- */
38
- turnOff(): Promise<void>;
39
- /**
40
- * Decreases the humidifier setting.
41
- * @returns {Promise<void>}
42
- */
43
- down(): Promise<void>;
44
- /**
45
- * Increases the humidifier setting.
46
- * @returns {Promise<void>}
47
- */
48
- up(): Promise<void>;
49
- }
50
- //# sourceMappingURL=wohumi.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"wohumi.d.ts","sourceRoot":"","sources":["../../src/device/wohumi.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,6BAA6B,CAAA;AACxE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAA;AAEnD,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AAEpC,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AAG9C;;;GAGG;AACH,qBAAa,MAAO,SAAQ,eAAe;IACzC;;;;;OAKG;WACU,gBAAgB,CAC3B,WAAW,EAAE,MAAM,EACnB,OAAO,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,KAAK,IAAI,GAChD,OAAO,CAAC,qBAAqB,GAAG,IAAI,CAAC;gBA2B5B,UAAU,EAAE,UAAU,CAAC,YAAY,CAAC,EAAE,KAAK,EAAE,UAAU,CAAC,OAAO,CAAC;IAI5E;;;;OAIG;IACU,WAAW,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAUxD;;;OAGG;IACG,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAI5B;;;OAGG;IACG,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC;IAI7B;;;OAGG;IACG,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IAI9B;;;OAGG;IACG,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAI3B;;;OAGG;IACG,EAAE,IAAI,OAAO,CAAC,IAAI,CAAC;CAG1B"}
@@ -1,89 +0,0 @@
1
- import { Buffer } from 'node:buffer';
2
- import { SwitchbotDevice } from '../device.js';
3
- import { SwitchBotBLEModel, SwitchBotBLEModelFriendlyName, SwitchBotBLEModelName } from '../types/types.js';
4
- /**
5
- * Class representing a WoHumi device.
6
- * @see https://github.com/OpenWonderLabs/SwitchBotAPI-BLE/tree/latest/devicetypes
7
- */
8
- export class WoHumi extends SwitchbotDevice {
9
- /**
10
- * Parses the service data for WoHumi.
11
- * @param {Buffer} serviceData - The service data buffer.
12
- * @param {Function} emitLog - The function to emit log messages.
13
- * @returns {Promise<humidifierServiceData | null>} - Parsed service data or null if invalid.
14
- */
15
- static async parseServiceData(serviceData, emitLog) {
16
- if (serviceData.length !== 8) {
17
- emitLog('debugerror', `[parseServiceDataForWoHumi] Buffer length ${serviceData.length} !== 8!`);
18
- return null;
19
- }
20
- const byte1 = serviceData.readUInt8(1);
21
- const byte4 = serviceData.readUInt8(4);
22
- const onState = !!(byte1 & 0b10000000); // 1 - on
23
- const autoMode = !!(byte4 & 0b10000000); // 1 - auto
24
- const percentage = byte4 & 0b01111111; // 0-100%, 101/102/103 - Quick gear 1/2/3
25
- const humidity = autoMode ? 0 : percentage === 101 ? 33 : percentage === 102 ? 66 : percentage === 103 ? 100 : percentage;
26
- const data = {
27
- model: SwitchBotBLEModel.Humidifier,
28
- modelName: SwitchBotBLEModelName.Humidifier,
29
- modelFriendlyName: SwitchBotBLEModelFriendlyName.Humidifier,
30
- onState,
31
- autoMode,
32
- percentage: autoMode ? 0 : percentage,
33
- humidity,
34
- };
35
- return data;
36
- }
37
- constructor(peripheral, noble) {
38
- super(peripheral, noble);
39
- }
40
- /**
41
- * Sends a command to the humidifier.
42
- * @param {number[]} bytes - The command bytes.
43
- * @returns {Promise<void>}
44
- */
45
- async operateHumi(bytes) {
46
- const reqBuf = Buffer.from(bytes);
47
- const resBuf = await this.command(reqBuf);
48
- const code = resBuf.readUInt8(0);
49
- if (resBuf.length !== 3 || (code !== 0x01 && code !== 0x05)) {
50
- throw new Error(`The device returned an error: 0x${resBuf.toString('hex')}`);
51
- }
52
- }
53
- /**
54
- * Presses the humidifier button.
55
- * @returns {Promise<void>}
56
- */
57
- async press() {
58
- await this.operateHumi([0x57, 0x01, 0x00]);
59
- }
60
- /**
61
- * Turns on the humidifier.
62
- * @returns {Promise<void>}
63
- */
64
- async turnOn() {
65
- await this.operateHumi([0x57, 0x01, 0x01]);
66
- }
67
- /**
68
- * Turns off the humidifier.
69
- * @returns {Promise<void>}
70
- */
71
- async turnOff() {
72
- await this.operateHumi([0x57, 0x01, 0x02]);
73
- }
74
- /**
75
- * Decreases the humidifier setting.
76
- * @returns {Promise<void>}
77
- */
78
- async down() {
79
- await this.operateHumi([0x57, 0x01, 0x03]);
80
- }
81
- /**
82
- * Increases the humidifier setting.
83
- * @returns {Promise<void>}
84
- */
85
- async up() {
86
- await this.operateHumi([0x57, 0x01, 0x04]);
87
- }
88
- }
89
- //# sourceMappingURL=wohumi.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"wohumi.js","sourceRoot":"","sources":["../../src/device/wohumi.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AAEpC,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AAC9C,OAAO,EAAE,iBAAiB,EAAE,6BAA6B,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAA;AAE3G;;;GAGG;AACH,MAAM,OAAO,MAAO,SAAQ,eAAe;IACzC;;;;;OAKG;IACH,MAAM,CAAC,KAAK,CAAC,gBAAgB,CAC3B,WAAmB,EACnB,OAAiD;QAEjD,IAAI,WAAW,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YAC7B,OAAO,CAAC,YAAY,EAAE,6CAA6C,WAAW,CAAC,MAAM,SAAS,CAAC,CAAA;YAC/F,OAAO,IAAI,CAAA;QACb,CAAC;QAED,MAAM,KAAK,GAAG,WAAW,CAAC,SAAS,CAAC,CAAC,CAAC,CAAA;QACtC,MAAM,KAAK,GAAG,WAAW,CAAC,SAAS,CAA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KAAK,IAAI,IAAI,IAAI,KAAK,IAAI,CAAC,EAAE,CAAC;YAC5D,MAAM,IAAI,KAAK,CAAC,mCAAmC,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC,CAAA;QAC9E,CAAC;IACH,CAAC;IAED;;;OAGG;IACH,KAAK,CAAC,KAAK;QACT,MAAM,IAAI,CAAC,WAAW,CAAC,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC,CAAA;IAC5C,CAAC;IAED;;;OAGG;IACH,KAAK,CAAC,MAAM;QACV,MAAM,IAAI,CAAC,WAAW,CAAC,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC,CAAA;IAC5C,CAAC;IAED;;;OAGG;IACH,KAAK,CAAC,OAAO;QACX,MAAM,IAAI,CAAC,WAAW,CAAC,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC,CAAA;IAC5C,CAAC;IAED;;;OAGG;IACH,KAAK,CAAC,IAAI;QACR,MAAM,IAAI,CAAC,WAAW,CAAC,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC,CAAA;IAC5C,CAAC;IAED;;;OAGG;IACH,KAAK,CAAC,EAAE;QACN,MAAM,IAAI,CAAC,WAAW,CAAC,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC,CAAA;IAC5C,CAAC;CACF"}
@@ -1,20 +0,0 @@
1
- import type { Buffer } from 'node:buffer';
2
- import type { outdoorMeterServiceData } from '../types/bledevicestatus.js';
3
- import type { NobleTypes } from '../types/types.js';
4
- import { SwitchbotDevice } from '../device.js';
5
- /**
6
- * Class representing a WoIOSensorTH device.
7
- * @see https://github.com/OpenWonderLabs/SwitchBotAPI-BLE/blob/latest/devicetypes/meter.md#outdoor-temperaturehumidity-sensor
8
- */
9
- export declare class WoIOSensorTH extends SwitchbotDevice {
10
- /**
11
- * Parses the service data for WoIOSensorTH.
12
- * @param {Buffer} serviceData - The service data buffer.
13
- * @param {Buffer} manufacturerData - The manufacturer data buffer.
14
- * @param {Function} emitLog - The function to emit log messages.
15
- * @returns {Promise<outdoorMeterServiceData | null>} - Parsed service data or null if invalid.
16
- */
17
- static parseServiceData(serviceData: Buffer, manufacturerData: Buffer, emitLog: (level: string, message: string) => void): Promise<outdoorMeterServiceData | null>;
18
- constructor(peripheral: NobleTypes['peripheral'], noble: NobleTypes['noble']);
19
- }
20
- //# sourceMappingURL=woiosensorth.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"woiosensorth.d.ts","sourceRoot":"","sources":["../../src/device/woiosensorth.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AAEzC,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,6BAA6B,CAAA;AAC1E,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAA;AAEnD,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AAG9C;;;GAGG;AACH,qBAAa,YAAa,SAAQ,eAAe;IAC/C;;;;;;OAMG;WACU,gBAAgB,CAC3B,WAAW,EAAE,MAAM,EACnB,gBAAgB,EAAE,MAAM,EACxB,OAAO,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,KAAK,IAAI,GAChD,OAAO,CAAC,uBAAuB,GAAG,IAAI,CAAC;gBAmC9B,UAAU,EAAE,UAAU,CAAC,YAAY,CAAC,EAAE,KAAK,EAAE,UAAU,CAAC,OAAO,CAAC;CAG7E"}
@@ -1,49 +0,0 @@
1
- import { SwitchbotDevice } from '../device.js';
2
- import { SwitchBotBLEModel, SwitchBotBLEModelFriendlyName, SwitchBotBLEModelName } from '../types/types.js';
3
- /**
4
- * Class representing a WoIOSensorTH device.
5
- * @see https://github.com/OpenWonderLabs/SwitchBotAPI-BLE/blob/latest/devicetypes/meter.md#outdoor-temperaturehumidity-sensor
6
- */
7
- export class WoIOSensorTH extends SwitchbotDevice {
8
- /**
9
- * Parses the service data for WoIOSensorTH.
10
- * @param {Buffer} serviceData - The service data buffer.
11
- * @param {Buffer} manufacturerData - The manufacturer data buffer.
12
- * @param {Function} emitLog - The function to emit log messages.
13
- * @returns {Promise<outdoorMeterServiceData | null>} - Parsed service data or null if invalid.
14
- */
15
- static async parseServiceData(serviceData, manufacturerData, emitLog) {
16
- if (serviceData.length !== 3) {
17
- emitLog('debugerror', `[parseServiceDataForWoIOSensorTH] Service Data Buffer length ${serviceData.length} !== 3!`);
18
- return null;
19
- }
20
- if (manufacturerData.length !== 14) {
21
- emitLog('debugerror', `[parseServiceDataForWoIOSensorTH] Manufacturer Data Buffer length ${manufacturerData.length} !== 14!`);
22
- return null;
23
- }
24
- const [mdByte10, mdByte11, mdByte12] = [
25
- manufacturerData.readUInt8(10),
26
- manufacturerData.readUInt8(11),
27
- manufacturerData.readUInt8(12),
28
- ];
29
- const sdByte2 = serviceData.readUInt8(2);
30
- const tempSign = mdByte11 & 0b10000000 ? 1 : -1;
31
- const tempC = tempSign * ((mdByte11 & 0b01111111) + (mdByte10 & 0b00001111) / 10);
32
- const tempF = Math.round(((tempC * 9) / 5 + 32) * 10) / 10;
33
- const data = {
34
- model: SwitchBotBLEModel.OutdoorMeter,
35
- modelName: SwitchBotBLEModelName.OutdoorMeter,
36
- modelFriendlyName: SwitchBotBLEModelFriendlyName.OutdoorMeter,
37
- celsius: tempC,
38
- fahrenheit: tempF,
39
- fahrenheit_mode: !!(mdByte12 & 0b10000000),
40
- humidity: mdByte12 & 0b01111111,
41
- battery: sdByte2 & 0b01111111,
42
- };
43
- return data;
44
- }
45
- constructor(peripheral, noble) {
46
- super(peripheral, noble);
47
- }
48
- }
49
- //# sourceMappingURL=woiosensorth.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"woiosensorth.js","sourceRoot":"","sources":["../../src/device/woiosensorth.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AAC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;QAE1D,MAAM,IAAI,GAA4B;YACpC,KAAK,EAAE,iBAAiB,CAAC,YAAY;YACrC,SAAS,EAAE,qBAAqB,CAAC,YAAY;YAC7C,iBAAiB,EAAE,6BAA6B,CAAC,YAAY;YAC7D,OAAO,EAAE,KAAK;YACd,UAAU,EAAE,KAAK;YACjB,eAAe,EAAE,CAAC,CAAC,CAAC,QAAQ,GAAG,UAAU,CAAC;YAC1C,QAAQ,EAAE,QAAQ,GAAG,UAAU;YAC/B,OAAO,EAAE,OAAO,GAAG,UAAU;SAC9B,CAAA;QAED,OAAO,IAAI,CAAA;IACb,CAAC;IAED,YAAY,UAAoC,EAAE,KAA0B;QAC1E,KAAK,CAAC,UAAU,EAAE,KAAK,CAAC,CAAA;IAC1B,CAAC;CACF"}
@@ -1,19 +0,0 @@
1
- import type { Buffer } from 'node:buffer';
2
- import type { keypadDetectorServiceData } from '../types/bledevicestatus.js';
3
- import type { NobleTypes } from '../types/types.js';
4
- import { SwitchbotDevice } from '../device.js';
5
- /**
6
- * Class representing a WoKeypad device.
7
- */
8
- export declare class WoKeypad extends SwitchbotDevice {
9
- /**
10
- * Parses the service data for WoKeypad.
11
- * @param {Buffer} serviceData - The service data buffer.
12
- * @param {Buffer} manufacturerData - The manufacturer data buffer.
13
- * @param {Function} emitLog - The function to emit log messages.
14
- * @returns {Promise<keypadDetectorServiceData | null>} - Parsed service data or null if invalid.
15
- */
16
- static parseServiceData(serviceData: Buffer, manufacturerData: Buffer, emitLog: (level: string, message: string) => void): Promise<keypadDetectorServiceData | null>;
17
- constructor(peripheral: NobleTypes['peripheral'], noble: NobleTypes['noble']);
18
- }
19
- //# sourceMappingURL=wokeypad.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"wokeypad.d.ts","sourceRoot":"","sources":["../../src/device/wokeypad.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AAEzC,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAA;AAC5E,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAA;AAEnD,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AAG9C;;GAEG;AACH,qBAAa,QAAS,SAAQ,eAAe;IAC3C;;;;;;OAMG;WACU,gBAAgB,CAC3B,WAAW,EAAE,MAAM,EACnB,gBAAgB,EAAE,MAAM,EACxB,OAAO,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,KAAK,IAAI,GAChD,OAAO,CAAC,yBAAyB,GAAG,IAAI,CAAC;gBA0ChC,UAAU,EAAE,UAAU,CAAC,YAAY,CAAC,EAAE,KAAK,EAAE,UAAU,CAAC,OAAO,CAAC;CAG7E"}