node-switchbot 2.5.0-beta.8 → 3.0.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 (406) hide show
  1. package/.github/workflows/beta-release.yml +25 -2
  2. package/.github/workflows/release.yml +13 -0
  3. package/BLE.md +1144 -0
  4. package/CHANGELOG.md +14 -0
  5. package/OpenAPI.md +185 -0
  6. package/README.md +20 -1189
  7. package/branding/Node_x_SwitchBot.svg +9 -0
  8. package/branding/icon.png +0 -0
  9. package/branding/switchbot.png +0 -0
  10. package/dist/advertising.d.ts +3 -3
  11. package/dist/advertising.d.ts.map +1 -1
  12. package/dist/advertising.js +26 -26
  13. package/dist/advertising.js.map +1 -1
  14. package/dist/device/woblindtilt.d.ts +19 -50
  15. package/dist/device/woblindtilt.d.ts.map +1 -1
  16. package/dist/device/woblindtilt.js +41 -100
  17. package/dist/device/woblindtilt.js.map +1 -1
  18. package/dist/device/wobulb.d.ts +41 -15
  19. package/dist/device/wobulb.d.ts.map +1 -1
  20. package/dist/device/wobulb.js +72 -128
  21. package/dist/device/wobulb.js.map +1 -1
  22. package/dist/device/woceilinglight.d.ts +47 -21
  23. package/dist/device/woceilinglight.d.ts.map +1 -1
  24. package/dist/device/woceilinglight.js +96 -171
  25. package/dist/device/woceilinglight.js.map +1 -1
  26. package/dist/device/wocontact.d.ts +11 -1
  27. package/dist/device/wocontact.d.ts.map +1 -1
  28. package/dist/device/wocontact.js +23 -22
  29. package/dist/device/wocontact.js.map +1 -1
  30. package/dist/device/wocurtain.d.ts +39 -1
  31. package/dist/device/wocurtain.d.ts.map +1 -1
  32. package/dist/device/wocurtain.js +69 -103
  33. package/dist/device/wocurtain.js.map +1 -1
  34. package/dist/device/wohand.d.ts +37 -2
  35. package/dist/device/wohand.d.ts.map +1 -1
  36. package/dist/device/wohand.js +55 -89
  37. package/dist/device/wohand.js.map +1 -1
  38. package/dist/device/wohub2.d.ts +11 -1
  39. package/dist/device/wohub2.d.ts.map +1 -1
  40. package/dist/device/wohub2.js +21 -29
  41. package/dist/device/wohub2.js.map +1 -1
  42. package/dist/device/wohumi.d.ts +37 -2
  43. package/dist/device/wohumi.d.ts.map +1 -1
  44. package/dist/device/wohumi.js +52 -83
  45. package/dist/device/wohumi.js.map +1 -1
  46. package/dist/device/woiosensorth.d.ts +12 -1
  47. package/dist/device/woiosensorth.d.ts.map +1 -1
  48. package/dist/device/woiosensorth.js +25 -29
  49. package/dist/device/woiosensorth.js.map +1 -1
  50. package/dist/device/woplugmini.d.ts +45 -12
  51. package/dist/device/woplugmini.d.ts.map +1 -1
  52. package/dist/device/woplugmini.js +71 -77
  53. package/dist/device/woplugmini.js.map +1 -1
  54. package/dist/device/wopresence.d.ts +11 -1
  55. package/dist/device/wopresence.d.ts.map +1 -1
  56. package/dist/device/wopresence.js +21 -27
  57. package/dist/device/wopresence.js.map +1 -1
  58. package/dist/device/wosensorth.d.ts +18 -2
  59. package/dist/device/wosensorth.d.ts.map +1 -1
  60. package/dist/device/wosensorth.js +34 -50
  61. package/dist/device/wosensorth.js.map +1 -1
  62. package/dist/device/wosmartlock.d.ts +63 -13
  63. package/dist/device/wosmartlock.d.ts.map +1 -1
  64. package/dist/device/wosmartlock.js +114 -195
  65. package/dist/device/wosmartlock.js.map +1 -1
  66. package/dist/device/wosmartlockpro.d.ts +16 -12
  67. package/dist/device/wosmartlockpro.d.ts.map +1 -1
  68. package/dist/device/wosmartlockpro.js +34 -29
  69. package/dist/device/wosmartlockpro.js.map +1 -1
  70. package/dist/device/wostrip.d.ts +4 -3
  71. package/dist/device/wostrip.d.ts.map +1 -1
  72. package/dist/device/wostrip.js +5 -4
  73. package/dist/device/wostrip.js.map +1 -1
  74. package/dist/device.d.ts +13 -5
  75. package/dist/device.d.ts.map +1 -1
  76. package/dist/device.js +13 -2
  77. package/dist/device.js.map +1 -1
  78. package/dist/index.d.ts +9 -1
  79. package/dist/index.d.ts.map +1 -1
  80. package/dist/index.js +9 -1
  81. package/dist/index.js.map +1 -1
  82. package/dist/parameter-checker.d.ts +10 -13
  83. package/dist/parameter-checker.d.ts.map +1 -1
  84. package/dist/parameter-checker.js +16 -1
  85. package/dist/parameter-checker.js.map +1 -1
  86. package/dist/settings.d.ts +41 -0
  87. package/dist/settings.d.ts.map +1 -1
  88. package/dist/settings.js +43 -0
  89. package/dist/settings.js.map +1 -1
  90. package/dist/{switchbot.d.ts → switchbot-ble.d.ts} +13 -8
  91. package/dist/switchbot-ble.d.ts.map +1 -0
  92. package/dist/switchbot-ble.js +427 -0
  93. package/dist/switchbot-ble.js.map +1 -0
  94. package/dist/switchbot-openapi.d.ts +131 -0
  95. package/dist/switchbot-openapi.d.ts.map +1 -0
  96. package/dist/switchbot-openapi.js +311 -0
  97. package/dist/switchbot-openapi.js.map +1 -0
  98. package/dist/test/advertising.test.d.ts +2 -0
  99. package/dist/test/advertising.test.d.ts.map +1 -0
  100. package/dist/test/advertising.test.js +99 -0
  101. package/dist/test/advertising.test.js.map +1 -0
  102. package/dist/test/device.test.d.ts +2 -0
  103. package/dist/test/device.test.d.ts.map +1 -0
  104. package/dist/test/device.test.js +38 -0
  105. package/dist/test/device.test.js.map +1 -0
  106. package/dist/test/index.test.d.ts +2 -0
  107. package/dist/test/index.test.d.ts.map +1 -0
  108. package/dist/test/index.test.js +35 -0
  109. package/dist/test/index.test.js.map +1 -0
  110. package/dist/test/parameter-checker.test.d.ts +2 -0
  111. package/dist/test/parameter-checker.test.d.ts.map +1 -0
  112. package/dist/test/parameter-checker.test.js +108 -0
  113. package/dist/test/parameter-checker.test.js.map +1 -0
  114. package/dist/test/settings.test.d.ts +2 -0
  115. package/dist/test/settings.test.d.ts.map +1 -0
  116. package/dist/test/settings.test.js +49 -0
  117. package/dist/test/settings.test.js.map +1 -0
  118. package/dist/test/switchbot-openapi.test.d.ts +2 -0
  119. package/dist/test/switchbot-openapi.test.d.ts.map +1 -0
  120. package/dist/test/switchbot-openapi.test.js +96 -0
  121. package/dist/test/switchbot-openapi.test.js.map +1 -0
  122. package/dist/test/switchbot.test.d.ts +2 -0
  123. package/dist/test/switchbot.test.d.ts.map +1 -0
  124. package/dist/test/switchbot.test.js +106 -0
  125. package/dist/test/switchbot.test.js.map +1 -0
  126. package/dist/test/woblindtilt.test.d.ts.map +1 -0
  127. package/dist/test/woblindtilt.test.js +76 -0
  128. package/dist/test/woblindtilt.test.js.map +1 -0
  129. package/dist/{device → test}/wobulb.test.d.ts.map +1 -1
  130. package/dist/test/wobulb.test.js +95 -0
  131. package/dist/test/wobulb.test.js.map +1 -0
  132. package/dist/test/woceilinglight.test.d.ts.map +1 -0
  133. package/dist/test/woceilinglight.test.js +81 -0
  134. package/dist/test/woceilinglight.test.js.map +1 -0
  135. package/dist/test/wocontact.test.d.ts.map +1 -0
  136. package/dist/test/wocontact.test.js +65 -0
  137. package/dist/test/wocontact.test.js.map +1 -0
  138. package/dist/test/wocurtain.test.d.ts.map +1 -0
  139. package/dist/test/wocurtain.test.js +75 -0
  140. package/dist/test/wocurtain.test.js.map +1 -0
  141. package/dist/{device → test}/wohand.test.d.ts.map +1 -1
  142. package/dist/test/wohand.test.js +56 -0
  143. package/dist/test/wohand.test.js.map +1 -0
  144. package/dist/test/wohub2.test.d.ts +2 -0
  145. package/dist/test/wohub2.test.d.ts.map +1 -0
  146. package/dist/test/wohub2.test.js +80 -0
  147. package/dist/test/wohub2.test.js.map +1 -0
  148. package/dist/{device → test}/wohumi.test.d.ts.map +1 -1
  149. package/dist/test/wohumi.test.js +82 -0
  150. package/dist/test/wohumi.test.js.map +1 -0
  151. package/dist/test/woiosensorth.test.d.ts.map +1 -0
  152. package/dist/test/woiosensorth.test.js +40 -0
  153. package/dist/test/woiosensorth.test.js.map +1 -0
  154. package/dist/test/woplugmini.test.d.ts.map +1 -0
  155. package/dist/test/woplugmini.test.js +114 -0
  156. package/dist/test/woplugmini.test.js.map +1 -0
  157. package/dist/test/wopresence.test.d.ts.map +1 -0
  158. package/dist/test/wopresence.test.js +68 -0
  159. package/dist/test/wopresence.test.js.map +1 -0
  160. package/dist/test/wosensorth.test.d.ts.map +1 -0
  161. package/dist/test/wosensorth.test.js +51 -0
  162. package/dist/test/wosensorth.test.js.map +1 -0
  163. package/dist/test/wosmartlock.test.d.ts.map +1 -0
  164. package/dist/test/wosmartlock.test.js +151 -0
  165. package/dist/test/wosmartlock.test.js.map +1 -0
  166. package/dist/test/wosmartlockpro.test.d.ts.map +1 -0
  167. package/dist/test/wosmartlockpro.test.js +151 -0
  168. package/dist/test/wosmartlockpro.test.js.map +1 -0
  169. package/dist/{device → test}/wostrip.test.d.ts.map +1 -1
  170. package/dist/test/wostrip.test.js +102 -0
  171. package/dist/test/wostrip.test.js.map +1 -0
  172. package/dist/types/bledevicestatus.d.ts +4 -12
  173. package/dist/types/bledevicestatus.d.ts.map +1 -1
  174. package/dist/types/devicelist.d.ts.map +1 -1
  175. package/dist/types/devicelist.js +0 -4
  176. package/dist/types/devicelist.js.map +1 -1
  177. package/dist/types/devicepush.d.ts +13 -0
  178. package/dist/types/devicepush.d.ts.map +1 -0
  179. package/dist/types/devicepush.js +2 -0
  180. package/dist/types/devicepush.js.map +1 -0
  181. package/dist/types/deviceresponse.d.ts +2 -3
  182. package/dist/types/deviceresponse.d.ts.map +1 -1
  183. package/dist/types/devicestatus.d.ts.map +1 -1
  184. package/dist/types/devicewebhookstatus.d.ts +32 -0
  185. package/dist/types/devicewebhookstatus.d.ts.map +1 -1
  186. package/dist/types/irdevicelist.d.ts.map +1 -1
  187. package/dist/types/types.d.ts +23 -0
  188. package/dist/types/types.d.ts.map +1 -1
  189. package/dist/types/types.js +14 -0
  190. package/dist/types/types.js.map +1 -1
  191. package/docs/assets/highlight.css +12 -47
  192. package/docs/assets/main.js +1 -1
  193. package/docs/assets/navigation.js +1 -1
  194. package/docs/assets/search.js +1 -1
  195. package/docs/classes/SwitchBotBLE.html +64 -0
  196. package/docs/classes/SwitchBotOpenAPI.html +47 -0
  197. package/docs/classes/SwitchbotDevice.html +32 -33
  198. package/docs/enums/LogLevel.html +10 -0
  199. package/docs/enums/SwitchBotBLEModel.html +2 -2
  200. package/docs/enums/SwitchBotBLEModelFriendlyName.html +2 -2
  201. package/docs/enums/SwitchBotBLEModelName.html +2 -2
  202. package/docs/enums/SwitchBotModel.html +2 -2
  203. package/docs/hierarchy.html +1 -0
  204. package/docs/index.html +16 -993
  205. package/docs/interfaces/Ad-1.html +5 -0
  206. package/docs/interfaces/AdvertisementData.html +3 -0
  207. package/docs/interfaces/Chars.html +4 -0
  208. package/docs/interfaces/ErrorObject.html +3 -0
  209. package/docs/interfaces/Params.html +6 -0
  210. package/docs/interfaces/ServiceData.html +2 -0
  211. package/docs/interfaces/SwitchBotBLEDevice.html +21 -0
  212. package/docs/interfaces/WebhookDetail.html +6 -0
  213. package/docs/interfaces/ad.html +5 -0
  214. package/docs/interfaces/body.html +3 -0
  215. package/docs/interfaces/bodyChange.html +4 -0
  216. package/docs/interfaces/deleteWebhookResponse.html +4 -0
  217. package/docs/interfaces/device.html +7 -0
  218. package/docs/interfaces/deviceList.html +2 -0
  219. package/docs/interfaces/deviceStatus.html +7 -0
  220. package/docs/interfaces/deviceStatusRequest.html +4 -0
  221. package/docs/interfaces/deviceWebhook.html +4 -0
  222. package/docs/interfaces/deviceWebhookContext.html +4 -0
  223. package/docs/interfaces/devices.html +4 -0
  224. package/docs/interfaces/infraredRemoteList.html +2 -0
  225. package/docs/interfaces/irdevice.html +5 -0
  226. package/docs/interfaces/pushResponse.html +4 -0
  227. package/docs/interfaces/queryWebhookResponse.html +4 -0
  228. package/docs/interfaces/setupWebhookResponse.html +4 -0
  229. package/docs/interfaces/switchbot.html +3 -0
  230. package/docs/interfaces/updateWebhookResponse.html +4 -0
  231. package/docs/interfaces/webhookRequest.html +4 -0
  232. package/docs/media/BLE.md +1109 -0
  233. package/docs/media/OpenAPI.md +185 -0
  234. package/docs/modules.html +136 -3
  235. package/docs/types/MacAddress.html +1 -0
  236. package/docs/types/batteryCirculatorFan.html +1 -0
  237. package/docs/types/batteryCirculatorFanServiceData.html +1 -0
  238. package/docs/types/batteryCirculatorFanStatus.html +1 -0
  239. package/docs/types/batteryCirculatorFanWebhookContext.html +1 -0
  240. package/docs/types/blindTilt.html +1 -0
  241. package/docs/types/blindTiltServiceData.html +1 -0
  242. package/docs/types/blindTiltStatus.html +1 -0
  243. package/docs/types/blindTiltWebhookContext.html +1 -0
  244. package/docs/types/bot.html +1 -0
  245. package/docs/types/botServiceData.html +1 -0
  246. package/docs/types/botStatus.html +1 -0
  247. package/docs/types/botWebhookContext.html +1 -0
  248. package/docs/types/ceilingLight.html +1 -0
  249. package/docs/types/ceilingLightPro.html +1 -0
  250. package/docs/types/ceilingLightProServiceData.html +1 -0
  251. package/docs/types/ceilingLightProStatus.html +1 -0
  252. package/docs/types/ceilingLightProWebhookContext.html +1 -0
  253. package/docs/types/ceilingLightServiceData.html +1 -0
  254. package/docs/types/ceilingLightStatus.html +1 -0
  255. package/docs/types/ceilingLightWebhookContext.html +1 -0
  256. package/docs/types/colorBulb.html +1 -0
  257. package/docs/types/colorBulbServiceData.html +1 -0
  258. package/docs/types/colorBulbStatus.html +1 -0
  259. package/docs/types/colorBulbWebhookContext.html +1 -0
  260. package/docs/types/contactSensor.html +1 -0
  261. package/docs/types/contactSensorServiceData.html +1 -0
  262. package/docs/types/contactSensorStatus.html +1 -0
  263. package/docs/types/contactSensorWebhookContext.html +1 -0
  264. package/docs/types/curtain.html +1 -0
  265. package/docs/types/curtain3.html +1 -0
  266. package/docs/types/curtain3ServiceData.html +1 -0
  267. package/docs/types/curtain3WebhookContext.html +1 -0
  268. package/docs/types/curtainServiceData.html +1 -0
  269. package/docs/types/curtainStatus.html +1 -0
  270. package/docs/types/curtainWebhookContext.html +1 -0
  271. package/docs/types/floorCleaningRobotS10.html +1 -0
  272. package/docs/types/floorCleaningRobotS10Status.html +1 -0
  273. package/docs/types/floorCleaningRobotS10WebhookContext.html +1 -0
  274. package/docs/types/hub2.html +1 -0
  275. package/docs/types/hub2ServiceData.html +1 -0
  276. package/docs/types/hub2Status.html +1 -0
  277. package/docs/types/hub2WebhookContext.html +1 -0
  278. package/docs/types/humidifier.html +1 -0
  279. package/docs/types/humidifierServiceData.html +1 -0
  280. package/docs/types/humidifierStatus.html +1 -0
  281. package/docs/types/humidifierWebhookContext.html +1 -0
  282. package/docs/types/indoorCam.html +1 -0
  283. package/docs/types/indoorCameraWebhookContext.html +1 -0
  284. package/docs/types/keypad.html +1 -0
  285. package/docs/types/keypadTouch.html +1 -0
  286. package/docs/types/keypadTouchWebhookContext.html +1 -0
  287. package/docs/types/keypadWebhookContext.html +1 -0
  288. package/docs/types/lock.html +1 -0
  289. package/docs/types/lockPro.html +1 -0
  290. package/docs/types/lockProServiceData.html +1 -0
  291. package/docs/types/lockProStatus.html +1 -0
  292. package/docs/types/lockProWebhookContext.html +1 -0
  293. package/docs/types/lockServiceData.html +1 -0
  294. package/docs/types/lockStatus.html +1 -0
  295. package/docs/types/lockWebhookContext.html +1 -0
  296. package/docs/types/meter.html +1 -0
  297. package/docs/types/meterPlus.html +1 -0
  298. package/docs/types/meterPlusServiceData.html +1 -0
  299. package/docs/types/meterPlusStatus.html +1 -0
  300. package/docs/types/meterPlusWebhookContext.html +1 -0
  301. package/docs/types/meterServiceData.html +1 -0
  302. package/docs/types/meterStatus.html +1 -0
  303. package/docs/types/meterWebhookContext.html +1 -0
  304. package/docs/types/motionSensor.html +1 -0
  305. package/docs/types/motionSensorServiceData.html +1 -0
  306. package/docs/types/motionSensorStatus.html +1 -0
  307. package/docs/types/motionSensorWebhookContext.html +1 -0
  308. package/docs/types/outdoorMeter.html +1 -0
  309. package/docs/types/outdoorMeterServiceData.html +1 -0
  310. package/docs/types/outdoorMeterStatus.html +1 -0
  311. package/docs/types/outdoorMeterWebhookContext.html +1 -0
  312. package/docs/types/panTiltCamWebhookContext.html +1 -0
  313. package/docs/types/pantiltCam.html +1 -0
  314. package/docs/types/pantiltCam2k.html +1 -0
  315. package/docs/types/plug.html +1 -0
  316. package/docs/types/plugMini.html +1 -0
  317. package/docs/types/plugMiniJPServiceData.html +1 -0
  318. package/docs/types/plugMiniJPWebhookContext.html +1 -0
  319. package/docs/types/plugMiniStatus.html +1 -0
  320. package/docs/types/plugMiniUSServiceData.html +1 -0
  321. package/docs/types/plugMiniUSWebhookContext.html +1 -0
  322. package/docs/types/plugStatus.html +1 -0
  323. package/docs/types/plugWebhookContext.html +1 -0
  324. package/docs/types/remote.html +1 -0
  325. package/docs/types/robotVacuumCleanerS1.html +1 -0
  326. package/docs/types/robotVacuumCleanerS1Plus.html +1 -0
  327. package/docs/types/robotVacuumCleanerS1PlusStatus.html +1 -0
  328. package/docs/types/robotVacuumCleanerS1PlusWebhookContext.html +1 -0
  329. package/docs/types/robotVacuumCleanerS1Status.html +1 -0
  330. package/docs/types/robotVacuumCleanerS1WebhookContext.html +1 -0
  331. package/docs/types/robotVacuumCleanerServiceData.html +1 -0
  332. package/docs/types/stripLight.html +1 -0
  333. package/docs/types/stripLightServiceData.html +1 -0
  334. package/docs/types/stripLightStatus.html +1 -0
  335. package/docs/types/stripLightWebhookContext.html +1 -0
  336. package/docs/types/waterLeakDetector.html +1 -0
  337. package/docs/types/waterLeakDetectorServiceData.html +1 -0
  338. package/docs/types/waterLeakDetectorStatus.html +1 -0
  339. package/docs/types/waterLeakDetectorWebhookContext.html +1 -0
  340. package/package.json +13 -11
  341. package/.github/npm-version-script.cjs +0 -81
  342. package/dist/device/woblindtilt.test.d.ts.map +0 -1
  343. package/dist/device/woblindtilt.test.js +0 -26
  344. package/dist/device/woblindtilt.test.js.map +0 -1
  345. package/dist/device/wobulb.test.js +0 -52
  346. package/dist/device/wobulb.test.js.map +0 -1
  347. package/dist/device/woceilinglight.test.d.ts.map +0 -1
  348. package/dist/device/woceilinglight.test.js +0 -63
  349. package/dist/device/woceilinglight.test.js.map +0 -1
  350. package/dist/device/wocontact.test.d.ts.map +0 -1
  351. package/dist/device/wocontact.test.js +0 -34
  352. package/dist/device/wocontact.test.js.map +0 -1
  353. package/dist/device/wocurtain.test.d.ts.map +0 -1
  354. package/dist/device/wocurtain.test.js +0 -33
  355. package/dist/device/wocurtain.test.js.map +0 -1
  356. package/dist/device/wohand.test.js +0 -62
  357. package/dist/device/wohand.test.js.map +0 -1
  358. package/dist/device/wohand2.test.d.ts +0 -2
  359. package/dist/device/wohand2.test.d.ts.map +0 -1
  360. package/dist/device/wohand2.test.js +0 -50
  361. package/dist/device/wohand2.test.js.map +0 -1
  362. package/dist/device/wohumi.test.js +0 -61
  363. package/dist/device/wohumi.test.js.map +0 -1
  364. package/dist/device/woiosensorth.test.d.ts.map +0 -1
  365. package/dist/device/woiosensorth.test.js +0 -39
  366. package/dist/device/woiosensorth.test.js.map +0 -1
  367. package/dist/device/woplugmini.test.d.ts.map +0 -1
  368. package/dist/device/woplugmini.test.js +0 -91
  369. package/dist/device/woplugmini.test.js.map +0 -1
  370. package/dist/device/wopresence.test.d.ts.map +0 -1
  371. package/dist/device/wopresence.test.js +0 -42
  372. package/dist/device/wopresence.test.js.map +0 -1
  373. package/dist/device/wosensorth.test.d.ts.map +0 -1
  374. package/dist/device/wosensorth.test.js +0 -59
  375. package/dist/device/wosensorth.test.js.map +0 -1
  376. package/dist/device/wosmartlock.test.d.ts.map +0 -1
  377. package/dist/device/wosmartlock.test.js +0 -84
  378. package/dist/device/wosmartlock.test.js.map +0 -1
  379. package/dist/device/wosmartlockpro.test.d.ts.map +0 -1
  380. package/dist/device/wosmartlockpro.test.js +0 -124
  381. package/dist/device/wosmartlockpro.test.js.map +0 -1
  382. package/dist/device/wostrip.test.js +0 -115
  383. package/dist/device/wostrip.test.js.map +0 -1
  384. package/dist/switchbot.d.ts.map +0 -1
  385. package/dist/switchbot.js +0 -259
  386. package/dist/switchbot.js.map +0 -1
  387. package/dist/types/pushbody.d.ts +0 -6
  388. package/dist/types/pushbody.d.ts.map +0 -1
  389. package/dist/types/pushbody.js +0 -2
  390. package/dist/types/pushbody.js.map +0 -1
  391. package/docs/classes/SwitchBot.html +0 -16
  392. package/docs/types/SwitchBotBLEDevice.html +0 -1
  393. /package/dist/{device → test}/woblindtilt.test.d.ts +0 -0
  394. /package/dist/{device → test}/wobulb.test.d.ts +0 -0
  395. /package/dist/{device → test}/woceilinglight.test.d.ts +0 -0
  396. /package/dist/{device → test}/wocontact.test.d.ts +0 -0
  397. /package/dist/{device → test}/wocurtain.test.d.ts +0 -0
  398. /package/dist/{device → test}/wohand.test.d.ts +0 -0
  399. /package/dist/{device → test}/wohumi.test.d.ts +0 -0
  400. /package/dist/{device → test}/woiosensorth.test.d.ts +0 -0
  401. /package/dist/{device → test}/woplugmini.test.d.ts +0 -0
  402. /package/dist/{device → test}/wopresence.test.d.ts +0 -0
  403. /package/dist/{device → test}/wosensorth.test.d.ts +0 -0
  404. /package/dist/{device → test}/wosmartlock.test.d.ts +0 -0
  405. /package/dist/{device → test}/wosmartlockpro.test.d.ts +0 -0
  406. /package/dist/{device → test}/wostrip.test.d.ts +0 -0
@@ -0,0 +1,81 @@
1
+ import { Buffer } from 'node:buffer';
2
+ import { describe, expect, it, vi } from 'vitest';
3
+ import { WoCeilingLight } from '../device/woceilinglight.js';
4
+ import { SwitchBotBLEModel, SwitchBotBLEModelFriendlyName, SwitchBotBLEModelName } from '../types/types.js';
5
+ describe('woCeilingLight', () => {
6
+ const emitLog = vi.fn();
7
+ describe('parseServiceData', () => {
8
+ it('should parse valid manufacturer data', async () => {
9
+ const manufacturerData = Buffer.from([0x00, 0x01, 0x00, 0x02, 0x03, 0x04, 0x05, 0x06, 0x87, 0x08, 0x09, 0x00, 0x00]);
10
+ const result = await WoCeilingLight.parseServiceData(manufacturerData, emitLog);
11
+ expect(result).toEqual({
12
+ model: SwitchBotBLEModel.CeilingLight,
13
+ modelName: SwitchBotBLEModelName.CeilingLight,
14
+ modelFriendlyName: SwitchBotBLEModelFriendlyName.CeilingLight,
15
+ power: 0x01,
16
+ red: 0x02,
17
+ green: 0x03,
18
+ blue: 0x04,
19
+ color_temperature: 0x05,
20
+ state: true,
21
+ brightness: 0x06,
22
+ delay: true,
23
+ preset: false,
24
+ color_mode: 0x07,
25
+ speed: 0x08,
26
+ loop_index: 0x08,
27
+ });
28
+ });
29
+ it('should return null for invalid manufacturer data length', async () => {
30
+ const manufacturerData = Buffer.from([0x00, 0x01, 0x00]);
31
+ const result = await WoCeilingLight.parseServiceData(manufacturerData, emitLog);
32
+ expect(result).toBeNull();
33
+ expect(emitLog).toHaveBeenCalledWith('error', '[parseServiceDataForWoCeilingLight] Buffer length 3 !== 13!');
34
+ });
35
+ });
36
+ describe('parseServiceData_Pro', () => {
37
+ it('should parse valid manufacturer data for Pro', async () => {
38
+ const manufacturerData = Buffer.from([0x00, 0x01, 0x00, 0x02, 0x03, 0x04, 0x05, 0x06, 0x87, 0x08, 0x09, 0x00, 0x00]);
39
+ const result = await WoCeilingLight.parseServiceData_Pro(manufacturerData, emitLog);
40
+ expect(result).toEqual({
41
+ model: SwitchBotBLEModel.CeilingLightPro,
42
+ modelName: SwitchBotBLEModelName.CeilingLightPro,
43
+ modelFriendlyName: SwitchBotBLEModelFriendlyName.CeilingLightPro,
44
+ power: 0x01,
45
+ red: 0x02,
46
+ green: 0x03,
47
+ blue: 0x04,
48
+ color_temperature: 0x05,
49
+ state: true,
50
+ brightness: 0x06,
51
+ delay: true,
52
+ preset: false,
53
+ color_mode: 0x07,
54
+ speed: 0x08,
55
+ loop_index: 0x08,
56
+ });
57
+ });
58
+ it('should return null for invalid manufacturer data length for Pro', async () => {
59
+ const manufacturerData = Buffer.from([0x00, 0x01, 0x00]);
60
+ const result = await WoCeilingLight.parseServiceData_Pro(manufacturerData, emitLog);
61
+ expect(result).toBeNull();
62
+ expect(emitLog).toHaveBeenCalledWith('error', '[parseServiceDataForWoCeilingLightPro] Buffer length 3 !== 13!');
63
+ });
64
+ });
65
+ describe('operateCeilingLight', () => {
66
+ it('should return true for successful operation', async () => {
67
+ const peripheral = {};
68
+ const device = new WoCeilingLight(peripheral, emitLog);
69
+ vi.spyOn(device, 'command').mockResolvedValue(Buffer.from([0x00, 0x80]));
70
+ const result = await device.operateCeilingLight([0x57, 0x0F, 0x48, 0x01]);
71
+ expect(result).toBe(true);
72
+ });
73
+ it('should throw an error for invalid response length', async () => {
74
+ const peripheral = {};
75
+ const device = new WoCeilingLight(peripheral, emitLog);
76
+ vi.spyOn(device, 'command').mockResolvedValue(Buffer.from([0x00]));
77
+ await expect(device.operateCeilingLight([0x57, 0x0F, 0x48, 0x01])).rejects.toThrow('Expecting a 2-byte response, got instead: 0x00');
78
+ });
79
+ });
80
+ });
81
+ //# sourceMappingURL=woceilinglight.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"woceilinglight.test.js","sourceRoot":"","sources":["../../src/test/woceilinglight.test.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AAEpC,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAA;AAEjD,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAA;AAC5D,OAAO,EAAE,iBAAiB,EAAE,6BAA6B,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAA;AAE3G,QAAQ,CAAC,gBAAgB,EAAE,GAAG,EAAE;IAC9B,MAAM,OAAO,GAAG,EAAE,CAAC,EAAE,EAAE,CAAA;IAEvB,QAAQ,CAAC,kBAAkB,EAAE,GAAG,EAAE;QAChC,EAAE,CAAC,sCAAsC,EAAE,KAAK,IAAI,EAAE;YACpD,MAAM,gBAAgB,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC,CAAA;YACpH,MAAM,MAAM,GAAG,MAAM,cAAc,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GAAG,EAAiC,CAAA;YACpD,MAAM,MAAM,GAAG,IAAI,cAAc,CAAC,UAAU,EAAE,OAAc,CAAC,CAAA;YAC7D,EAAE,CAAC,KAAK,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC,iBAAiB,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC,CAAA;YACxE,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,mBAAmB,CAAC,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC,CAAA;YACzE,MAAM,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;QAC3B,CAAC,CAAC,CAAA;QAEF,EAAE,CAAC,mDAAmD,EAAE,KAAK,IAAI,EAAE;YACjE,MAAM,UAAU,GAAG,EAAiC,CAAA;YACpD,MAAM,MAAM,GAAG,IAAI,cAAc,CAAC,UAAU,EAAE,OAAc,CAAC,CAAA;YAC7D,EAAE,CAAC,KAAK,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC,iBAAiB,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;YAClE,MAAM,MAAM,CAAC,MAAM,CAAC,mBAAmB,CAAC,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,gDAAgD,CAAC,CAAA;QACtI,CAAC,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wocontact.test.d.ts","sourceRoot":"","sources":["../../src/test/wocontact.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,65 @@
1
+ import { Buffer } from 'node:buffer';
2
+ import { describe, expect, it, vi } from 'vitest';
3
+ import { WoContact } from '../device/wocontact.js';
4
+ import { SwitchBotBLEModel, SwitchBotBLEModelFriendlyName, SwitchBotBLEModelName } from '../types/types.js';
5
+ describe('woContact', () => {
6
+ const emitLog = vi.fn();
7
+ it('should parse valid service data correctly', async () => {
8
+ const serviceData = Buffer.from([0b11000000, 0b01111111, 0b00000110, 0, 0, 0, 0, 0, 0b00001111]);
9
+ const result = await WoContact.parseServiceData(serviceData, emitLog);
10
+ expect(result).toEqual({
11
+ model: SwitchBotBLEModel.ContactSensor,
12
+ modelName: SwitchBotBLEModelName.ContactSensor,
13
+ modelFriendlyName: SwitchBotBLEModelFriendlyName.ContactSensor,
14
+ movement: true,
15
+ tested: true,
16
+ battery: 127,
17
+ contact_open: true,
18
+ contact_timeout: true,
19
+ lightLevel: 'dark',
20
+ button_count: 15,
21
+ doorState: 'open',
22
+ });
23
+ });
24
+ it('should return null for invalid service data length', async () => {
25
+ const serviceData = Buffer.from([0b11000000, 0b01111111]);
26
+ const result = await WoContact.parseServiceData(serviceData, emitLog);
27
+ expect(result).toBeNull();
28
+ expect(emitLog).toHaveBeenCalledWith('error', '[parseServiceDataForWoContact] Buffer length 2 !== 9!');
29
+ });
30
+ it('should parse service data with different hall state correctly', async () => {
31
+ const serviceData = Buffer.from([0b01000000, 0b01111111, 0b00000000, 0, 0, 0, 0, 0, 0b00000001]);
32
+ const result = await WoContact.parseServiceData(serviceData, emitLog);
33
+ expect(result).toEqual({
34
+ model: SwitchBotBLEModel.ContactSensor,
35
+ modelName: SwitchBotBLEModelName.ContactSensor,
36
+ modelFriendlyName: SwitchBotBLEModelFriendlyName.ContactSensor,
37
+ movement: true,
38
+ tested: false,
39
+ battery: 127,
40
+ contact_open: false,
41
+ contact_timeout: false,
42
+ lightLevel: 'dark',
43
+ button_count: 1,
44
+ doorState: 'close',
45
+ });
46
+ });
47
+ it('should parse service data with bright light level correctly', async () => {
48
+ const serviceData = Buffer.from([0b01000000, 0b01111111, 0b00000001, 0, 0, 0, 0, 0, 0b00000001]);
49
+ const result = await WoContact.parseServiceData(serviceData, emitLog);
50
+ expect(result).toEqual({
51
+ model: SwitchBotBLEModel.ContactSensor,
52
+ modelName: SwitchBotBLEModelName.ContactSensor,
53
+ modelFriendlyName: SwitchBotBLEModelFriendlyName.ContactSensor,
54
+ movement: true,
55
+ tested: false,
56
+ battery: 127,
57
+ contact_open: false,
58
+ contact_timeout: false,
59
+ lightLevel: 'bright',
60
+ button_count: 1,
61
+ doorState: 'close',
62
+ });
63
+ });
64
+ });
65
+ //# sourceMappingURL=wocontact.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wocontact.test.js","sourceRoot":"","sources":["../../src/test/wocontact.test.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AAEpC,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAA;AAEjD,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAA;AAClD,OAAO,EAAE,iBAAiB,EAAE,6BAA6B,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAA;AAE3G,QAAQ,CAAC,WAAW,EAAE,GAAG,EAAE;IACzB,MAAM,OAAO,GAAG,EAAE,CAAC,EAAE,EAAE,CAAA;IAEvB,EAAE,CAAC,2CAA2C,EAAE,KAAK,IAAI,EAAE;QACzD,MAAM,WAAW,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,UAAU,CAAC,CAAC,CAAA;QAChG,MAAM,MAAM,GAAG,MAAM,SAAS,CAAC,gBAAgB,CAAC,WAAW,EAAE,OAAO,CAAC,CAAA;QAErE,MAAM,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC;YACrB,KAAK,EAAE,iBAAiB,CAAC,aAAa;YACtC,SAAS,EAAE,qBAAqB,CAAC,aAAa;YAC9C,iBAAiB,EAAE,6BAA6B,CAAC,aAAa;YAC9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,EAAE,MAAM;YAClB,YAAY,EAAE,CAAC;YACf,SAAS,EAAE,OAAO;SACnB,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;IAEF,EAAE,CAAC,6DAA6D,EAAE,KAAK,IAAI,EAAE;QAC3E,MAAM,WAAW,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,UAAU,CAAC,CAAC,CAAA;QAChG,MAAM,MAAM,GAAG,MAAM,SAAS,CAAC,gBAAgB,CAAC,WAAW,EAAE,OAAO,CAAC,CAAA;QAErE,MAAM,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC;YACrB,KAAK,EAAE,iBAAiB,CAAC,aAAa;YACtC,SAAS,EAAE,qBAAqB,CAAC,aAAa;YAC9C,iBAAiB,EAAE,6BAA6B,CAAC,aAAa;YAC9D,QAAQ,EAAE,IAAI;YACd,MAAM,EAAE,KAAK;YACb,OAAO,EAAE,GAAG;YACZ,YAAY,EAAE,KAAK;YACnB,eAAe,EAAE,KAAK;YACtB,UAAU,EAAE,QAAQ;YACpB,YAAY,EAAE,CAAC;YACf,SAAS,EAAE,OAAO;SACnB,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wocurtain.test.d.ts","sourceRoot":"","sources":["../../src/test/wocurtain.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,75 @@
1
+ import { Buffer } from 'node:buffer';
2
+ import { describe, expect, it, vi } from 'vitest';
3
+ import { WoCurtain } from '../device/wocurtain.js';
4
+ import { SwitchBotBLEModel, SwitchBotBLEModelFriendlyName, SwitchBotBLEModelName } from '../types/types.js';
5
+ describe('woCurtain', () => {
6
+ const emitLog = vi.fn();
7
+ describe('parseServiceData', () => {
8
+ it('should return null if serviceData length is not 5 or 6', async () => {
9
+ const serviceData = Buffer.from([0x01, 0x02, 0x03, 0x04]);
10
+ const manufacturerData = Buffer.from([0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D]);
11
+ const result = await WoCurtain.parseServiceData(serviceData, manufacturerData, emitLog);
12
+ expect(result).toBeNull();
13
+ expect(emitLog).toHaveBeenCalledWith('error', '[parseServiceDataForWoCurtain] Buffer length 4 !== 5 or 6!');
14
+ });
15
+ it('should parse valid serviceData and manufacturerData correctly', async () => {
16
+ const serviceData = Buffer.from([0x63, 0x40, 0x50, 0x01, 0x02, 0x03]);
17
+ const manufacturerData = Buffer.from([0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x64]);
18
+ const result = await WoCurtain.parseServiceData(serviceData, manufacturerData, emitLog);
19
+ expect(result).toEqual({
20
+ model: SwitchBotBLEModel.Curtain,
21
+ modelName: SwitchBotBLEModelName.Curtain,
22
+ modelFriendlyName: SwitchBotBLEModelFriendlyName.Curtain,
23
+ calibration: true,
24
+ battery: 100,
25
+ inMotion: false,
26
+ position: 1,
27
+ lightLevel: 0,
28
+ deviceChain: 2,
29
+ });
30
+ });
31
+ });
32
+ describe('open', () => {
33
+ it('should call runToPos with 0 and default mode', async () => {
34
+ const peripheral = {};
35
+ const curtain = new WoCurtain(peripheral, emitLog);
36
+ const runToPosSpy = vi.spyOn(curtain, 'runToPos').mockResolvedValue();
37
+ await curtain.open();
38
+ expect(runToPosSpy).toHaveBeenCalledWith(0, 0xFF);
39
+ });
40
+ });
41
+ describe('close', () => {
42
+ it('should call runToPos with 100 and default mode', async () => {
43
+ const peripheral = {};
44
+ const curtain = new WoCurtain(peripheral, emitLog);
45
+ const runToPosSpy = vi.spyOn(curtain, 'runToPos').mockResolvedValue();
46
+ await curtain.close();
47
+ expect(runToPosSpy).toHaveBeenCalledWith(100, 0xFF);
48
+ });
49
+ });
50
+ describe('pause', () => {
51
+ it('should call operateCurtain with correct bytes', async () => {
52
+ const peripheral = {};
53
+ const curtain = new WoCurtain(peripheral, emitLog);
54
+ const operateCurtainSpy = vi.spyOn(curtain, 'operateCurtain').mockResolvedValue();
55
+ await curtain.pause();
56
+ expect(operateCurtainSpy).toHaveBeenCalledWith([0x57, 0x0F, 0x45, 0x01, 0x00, 0xFF]);
57
+ });
58
+ });
59
+ describe('runToPos', () => {
60
+ it('should call operateCurtain with correct bytes', async () => {
61
+ const peripheral = {};
62
+ const curtain = new WoCurtain(peripheral, emitLog);
63
+ const operateCurtainSpy = vi.spyOn(curtain, 'operateCurtain').mockResolvedValue();
64
+ await curtain.runToPos(50, 0x01);
65
+ expect(operateCurtainSpy).toHaveBeenCalledWith([0x57, 0x0F, 0x45, 0x01, 0x05, 0x01, 50]);
66
+ });
67
+ it('should throw TypeError if percent or mode is not a number', async () => {
68
+ const peripheral = {};
69
+ const curtain = new WoCurtain(peripheral, emitLog);
70
+ await expect(curtain.runToPos('50', 0x01)).rejects.toThrow(TypeError);
71
+ await expect(curtain.runToPos(50, '0x01')).rejects.toThrow(TypeError);
72
+ });
73
+ });
74
+ });
75
+ //# sourceMappingURL=wocurtain.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wocurtain.test.js","sourceRoot":"","sources":["../../src/test/wocurtain.test.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AAEpC,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAA;AAEjD,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAA;AAClD,OAAO,EAAE,iBAAiB,EAAE,6BAA6B,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAA;AAE3G,QAAQ,CAAC,WAAW,EAAE,GAAG,EAAE;IACzB,MAAM,OAAO,GAAG,EAAE,CAAC,EAAE,EAAE,CAAA;IAEvB,QAAQ,CAAC,kBAA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,EAAiC,CAAA;YACpD,MAAM,OAAO,GAAG,IAAI,SAAS,CAAC,UAAU,EAAE,OAAc,CAAC,CAAA;YACzD,MAAM,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAW,EAAE,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,SAAS,CAAC,CAAA;YAC5E,MAAM,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,EAAE,MAAa,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,SAAS,CAAC,CAAA;QAC9E,CAAC,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"wohand.test.d.ts","sourceRoot":"","sources":["../../src/device/wohand.test.ts"],"names":[],"mappings":""}
1
+ {"version":3,"file":"wohand.test.d.ts","sourceRoot":"","sources":["../../src/test/wohand.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,56 @@
1
+ import { Buffer } from 'node:buffer';
2
+ import { describe, expect, it, vi } from 'vitest';
3
+ import { WoHand } from '../device/wohand.js';
4
+ import { SwitchBotBLEModel, SwitchBotBLEModelFriendlyName, SwitchBotBLEModelName } from '../types/types.js';
5
+ describe('woHand', () => {
6
+ const emitLog = vi.fn();
7
+ describe('parseServiceData', () => {
8
+ it('should parse valid service data correctly', async () => {
9
+ const serviceData = Buffer.from([0x00, 0x80, 0x64]); // Example buffer
10
+ const result = await WoHand.parseServiceData(serviceData, emitLog);
11
+ expect(result).toEqual({
12
+ model: SwitchBotBLEModel.Bot,
13
+ modelName: SwitchBotBLEModelName.Bot,
14
+ modelFriendlyName: SwitchBotBLEModelFriendlyName.Bot,
15
+ mode: true,
16
+ state: true,
17
+ battery: 100,
18
+ });
19
+ });
20
+ it('should return null for invalid buffer length', async () => {
21
+ const serviceData = Buffer.from([0x00, 0x80]); // Invalid buffer length
22
+ const result = await WoHand.parseServiceData(serviceData, emitLog);
23
+ expect(result).toBeNull();
24
+ expect(emitLog).toHaveBeenCalledWith('error', '[parseServiceData] Buffer length 2 !== 3!');
25
+ });
26
+ });
27
+ describe('operateBot', () => {
28
+ let woHand;
29
+ beforeEach(() => {
30
+ const peripheral = {};
31
+ woHand = new WoHand(peripheral, emitLog);
32
+ vi.spyOn(woHand, 'command').mockResolvedValue(Buffer.from([0x01, 0x00, 0x00]));
33
+ });
34
+ it('should send the correct command for press', async () => {
35
+ await woHand.press();
36
+ expect(woHand.command).toHaveBeenCalledWith(Buffer.from([0x57, 0x01, 0x00]));
37
+ });
38
+ it('should send the correct command for turnOn', async () => {
39
+ await woHand.turnOn();
40
+ expect(woHand.command).toHaveBeenCalledWith(Buffer.from([0x57, 0x01, 0x01]));
41
+ });
42
+ it('should send the correct command for turnOff', async () => {
43
+ await woHand.turnOff();
44
+ expect(woHand.command).toHaveBeenCalledWith(Buffer.from([0x57, 0x01, 0x02]));
45
+ });
46
+ it('should send the correct command for down', async () => {
47
+ await woHand.down();
48
+ expect(woHand.command).toHaveBeenCalledWith(Buffer.from([0x57, 0x01, 0x03]));
49
+ });
50
+ it('should send the correct command for up', async () => {
51
+ await woHand.up();
52
+ expect(woHand.command).toHaveBeenCalledWith(Buffer.from([0x57, 0x01, 0x04]));
53
+ });
54
+ });
55
+ });
56
+ //# sourceMappingURL=wohand.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wohand.test.js","sourceRoot":"","sources":["../../src/test/wohand.test.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AAEpC,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAA;AAEjD,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAA;AAC5C,OAAO,EAAE,iBAAiB,EAAE,6BAA6B,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAA;AAE3G,QAAQ,CAAC,QAAQ,EAAE,GAAG,EAA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IAAI,CAAC,CAAC,CAAC,CAAA;QAC9E,CAAC,CAAC,CAAA;QAEF,EAAE,CAAC,wCAAwC,EAAE,KAAK,IAAI,EAAE;YACtD,MAAM,MAAM,CAAC,EAAE,EAAE,CAAA;YACjB,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,oBAAoB,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC,CAAA;QAC9E,CAAC,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=wohub2.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wohub2.test.d.ts","sourceRoot":"","sources":["../../src/test/wohub2.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,80 @@
1
+ import { Buffer } from 'node:buffer';
2
+ import { describe, expect, it, vi } from 'vitest';
3
+ import { WoHub2 } from '../device/wohub2.js';
4
+ import { SwitchBotBLEModel, SwitchBotBLEModelFriendlyName, SwitchBotBLEModelName } from '../types/types.js';
5
+ describe('woHub2', () => {
6
+ describe('parseServiceData', () => {
7
+ const emitLog = vi.fn();
8
+ it('should parse valid manufacturer data correctly', async () => {
9
+ const manufacturerData = Buffer.from([
10
+ 0x01,
11
+ 0x82,
12
+ 0x41,
13
+ 0x00,
14
+ 0x00,
15
+ 0x00,
16
+ 0x00,
17
+ 0x00,
18
+ 0x00,
19
+ 0x00,
20
+ 0x00,
21
+ 0x00,
22
+ 0x1F,
23
+ 0x00,
24
+ 0x00,
25
+ 0x00,
26
+ ]);
27
+ const result = await WoHub2.parseServiceData(manufacturerData, emitLog);
28
+ expect(result).toEqual({
29
+ model: SwitchBotBLEModel.Hub2,
30
+ modelName: SwitchBotBLEModelName.Hub2,
31
+ modelFriendlyName: SwitchBotBLEModelFriendlyName.Hub2,
32
+ celsius: 2.1,
33
+ fahrenheit: 35.8,
34
+ fahrenheit_mode: true,
35
+ humidity: 65,
36
+ lightLevel: 31,
37
+ });
38
+ expect(emitLog).not.toHaveBeenCalled();
39
+ });
40
+ it('should return null for invalid buffer length', async () => {
41
+ const manufacturerData = Buffer.from([0x01, 0x82]);
42
+ const result = await WoHub2.parseServiceData(manufacturerData, emitLog);
43
+ expect(result).toBeNull();
44
+ expect(emitLog).toHaveBeenCalledWith('error', '[parseServiceDataForWoHub2] Buffer length 2 !== 16!');
45
+ });
46
+ it('should parse negative temperature correctly', async () => {
47
+ const manufacturerData = Buffer.from([
48
+ 0x01,
49
+ 0x02,
50
+ 0x41,
51
+ 0x00,
52
+ 0x00,
53
+ 0x00,
54
+ 0x00,
55
+ 0x00,
56
+ 0x00,
57
+ 0x00,
58
+ 0x00,
59
+ 0x00,
60
+ 0x1F,
61
+ 0x00,
62
+ 0x00,
63
+ 0x00,
64
+ ]);
65
+ const result = await WoHub2.parseServiceData(manufacturerData, emitLog);
66
+ expect(result).toEqual({
67
+ model: SwitchBotBLEModel.Hub2,
68
+ modelName: SwitchBotBLEModelName.Hub2,
69
+ modelFriendlyName: SwitchBotBLEModelFriendlyName.Hub2,
70
+ celsius: -2.1,
71
+ fahrenheit: 28.2,
72
+ fahrenheit_mode: true,
73
+ humidity: 65,
74
+ lightLevel: 31,
75
+ });
76
+ expect(emitLog).not.toHaveBeenCalled();
77
+ });
78
+ });
79
+ });
80
+ //# sourceMappingURL=wohub2.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wohub2.test.js","sourceRoot":"","sources":["../../src/test/wohub2.test.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AAEpC,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAA;AAEjD,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAA;AAC5C,OAAO,EAAE,iBAAiB,EAAE,6BAA6B,EAAE,qB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C,CAAA;YAEvE,MAAM,CAAC,MAAM,CAAC,CAAC,QAAQ,EAAE,CAAA;YACzB,MAAM,CAAC,OAAO,CAAC,CAAC,oBAAoB,CAAC,OAAO,EAAE,qDAAqD,CAAC,CAAA;QACtG,CAAC,CAAC,CAAA;QAEF,EAAE,CAAC,6CAA6C,EAAE,KAAK,IAAI,EAAE;YAC3D,MAAM,gBAAgB,GAAG,MAAM,CAAC,IAAI,CAAC;gBACnC,IAAI;gBACJ,IAAI;gBACJ,IAAI;gBACJ,IAAI;gBACJ,IAAI;gBACJ,IAAI;gBACJ,IAAI;gBACJ,IAAI;gBACJ,IAAI;gBACJ,IAAI;gBACJ,IAAI;gBACJ,IAAI;gBACJ,IAAI;gBACJ,IAAI;gBACJ,IAAI;gBACJ,IAAI;aACL,CAAC,CAAA;YAEF,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,gBAAgB,CAAC,gBAAgB,EAAE,OAAO,CAAC,CAAA;YAEvE,MAAM,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC;gBACrB,KAAK,EAAE,iBAAiB,CAAC,IAAI;gBAC7B,SAAS,EAAE,qBAAqB,CAAC,IAAI;gBACrC,iBAAiB,EAAE,6BAA6B,CAAC,IAAI;gBACrD,OAAO,EAAE,CAAC,GAAG;gBACb,UAAU,EAAE,IAAI;gBAChB,eAAe,EAAE,IAAI;gBACrB,QAAQ,EAAE,EAAE;gBACZ,UAAU,EAAE,EAAE;aACf,CAAC,CAAA;YACF,MAAM,CAAC,OAAO,CAAC,CAAC,GAAG,CAAC,gBAAgB,EAAE,CAAA;QACxC,CAAC,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"wohumi.test.d.ts","sourceRoot":"","sources":["../../src/device/wohumi.test.ts"],"names":[],"mappings":""}
1
+ {"version":3,"file":"wohumi.test.d.ts","sourceRoot":"","sources":["../../src/test/wohumi.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,82 @@
1
+ import { Buffer } from 'node:buffer';
2
+ import { describe, expect, it, vi } from 'vitest';
3
+ import { WoHumi } from '../device/wohumi.js';
4
+ import { SwitchBotBLEModel, SwitchBotBLEModelFriendlyName, SwitchBotBLEModelName } from '../types/types.js';
5
+ describe('woHumi', () => {
6
+ const emitLog = vi.fn();
7
+ describe('parseServiceData', () => {
8
+ it('should return parsed data for valid service data', async () => {
9
+ const serviceData = Buffer.from([0x00, 0x80, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00]);
10
+ const result = await WoHumi.parseServiceData(serviceData, emitLog);
11
+ expect(result).toEqual({
12
+ model: SwitchBotBLEModel.Humidifier,
13
+ modelName: SwitchBotBLEModelName.Humidifier,
14
+ modelFriendlyName: SwitchBotBLEModelFriendlyName.Humidifier,
15
+ onState: true,
16
+ autoMode: true,
17
+ percentage: 0,
18
+ humidity: 0,
19
+ });
20
+ });
21
+ it('should return null for invalid service data length', async () => {
22
+ const serviceData = Buffer.from([0x00, 0x80, 0x00]);
23
+ const result = await WoHumi.parseServiceData(serviceData, emitLog);
24
+ expect(result).toBeNull();
25
+ expect(emitLog).toHaveBeenCalledWith('error', '[parseServiceDataForWoHumi] Buffer length 3 !== 8!');
26
+ });
27
+ });
28
+ describe('operateHumi', () => {
29
+ it('should throw an error if the device returns an error', async () => {
30
+ const peripheral = {};
31
+ const wohumi = new WoHumi(peripheral, emitLog);
32
+ vi.spyOn(wohumi, 'command').mockResolvedValue(Buffer.from([0x00, 0x00, 0x00]));
33
+ await expect(wohumi.operateHumi([0x57, 0x01, 0x00])).rejects.toThrow('The device returned an error: 0x000000');
34
+ });
35
+ });
36
+ describe('press', () => {
37
+ it('should call operateHumi with correct bytes', async () => {
38
+ const peripheral = {};
39
+ const wohumi = new WoHumi(peripheral, emitLog);
40
+ const operateHumiSpy = vi.spyOn(wohumi, 'operateHumi').mockResolvedValue();
41
+ await wohumi.press();
42
+ expect(operateHumiSpy).toHaveBeenCalledWith([0x57, 0x01, 0x00]);
43
+ });
44
+ });
45
+ describe('turnOn', () => {
46
+ it('should call operateHumi with correct bytes', async () => {
47
+ const peripheral = {};
48
+ const wohumi = new WoHumi(peripheral, emitLog);
49
+ const operateHumiSpy = vi.spyOn(wohumi, 'operateHumi').mockResolvedValue();
50
+ await wohumi.turnOn();
51
+ expect(operateHumiSpy).toHaveBeenCalledWith([0x57, 0x01, 0x01]);
52
+ });
53
+ });
54
+ describe('turnOff', () => {
55
+ it('should call operateHumi with correct bytes', async () => {
56
+ const peripheral = {};
57
+ const wohumi = new WoHumi(peripheral, emitLog);
58
+ const operateHumiSpy = vi.spyOn(wohumi, 'operateHumi').mockResolvedValue();
59
+ await wohumi.turnOff();
60
+ expect(operateHumiSpy).toHaveBeenCalledWith([0x57, 0x01, 0x02]);
61
+ });
62
+ });
63
+ describe('down', () => {
64
+ it('should call operateHumi with correct bytes', async () => {
65
+ const peripheral = {};
66
+ const wohumi = new WoHumi(peripheral, emitLog);
67
+ const operateHumiSpy = vi.spyOn(wohumi, 'operateHumi').mockResolvedValue();
68
+ await wohumi.down();
69
+ expect(operateHumiSpy).toHaveBeenCalledWith([0x57, 0x01, 0x03]);
70
+ });
71
+ });
72
+ describe('up', () => {
73
+ it('should call operateHumi with correct bytes', async () => {
74
+ const peripheral = {};
75
+ const wohumi = new WoHumi(peripheral, emitLog);
76
+ const operateHumiSpy = vi.spyOn(wohumi, 'operateHumi').mockResolvedValue();
77
+ await wohumi.up();
78
+ expect(operateHumiSpy).toHaveBeenCalledWith([0x57, 0x01, 0x04]);
79
+ });
80
+ });
81
+ });
82
+ //# sourceMappingURL=wohumi.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wohumi.test.js","sourceRoot":"","sources":["../../src/test/wohumi.test.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AAEpC,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,EAAE,MAAM,Q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AAA;YAC1E,MAAM,MAAM,CAAC,IAAI,EAAE,CAAA;YACnB,MAAM,CAAC,cAAc,CAAC,CAAC,oBAAoB,CAAC,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC,CAAA;QACjE,CAAC,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;IAEF,QAAQ,CAAC,IAAI,EAAE,GAAG,EAAE;QAClB,EAAE,CAAC,4CAA4C,EAAE,KAAK,IAAI,EAAE;YAC1D,MAAM,UAAU,GAAG,EAAiC,CAAA;YACpD,MAAM,MAAM,GAAG,IAAI,MAAM,CAAC,UAAU,EAAE,OAAc,CAAC,CAAA;YACrD,MAAM,cAAc,GAAG,EAAE,CAAC,KAAK,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC,iBAAiB,EAAE,CAAA;YAC1E,MAAM,MAAM,CAAC,EAAE,EAAE,CAAA;YACjB,MAAM,CAAC,cAAc,CAAC,CAAC,oBAAoB,CAAC,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC,CAAA;QACjE,CAAC,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"woiosensorth.test.d.ts","sourceRoot":"","sources":["../../src/test/woiosensorth.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,40 @@
1
+ import { Buffer } from 'node:buffer';
2
+ import { describe, expect, it, vi } from 'vitest';
3
+ import { WoIOSensorTH } from '../device/woiosensorth.js';
4
+ import { SwitchBotBLEModel, SwitchBotBLEModelFriendlyName, SwitchBotBLEModelName } from '../types/types.js';
5
+ describe('woIOSensorTH', () => {
6
+ describe('parseServiceData', () => {
7
+ const emitLog = vi.fn();
8
+ it('should return parsed data for valid buffers', async () => {
9
+ const serviceData = Buffer.from([0x00, 0x00, 0x64]);
10
+ const manufacturerData = Buffer.from([0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1E, 0x2A, 0x50, 0x00]);
11
+ const result = await WoIOSensorTH.parseServiceData(serviceData, manufacturerData, emitLog);
12
+ expect(result).toEqual({
13
+ model: SwitchBotBLEModel.OutdoorMeter,
14
+ modelName: SwitchBotBLEModelName.OutdoorMeter,
15
+ modelFriendlyName: SwitchBotBLEModelFriendlyName.OutdoorMeter,
16
+ celsius: 42.6,
17
+ fahrenheit: 108.7,
18
+ fahrenheit_mode: true,
19
+ humidity: 80,
20
+ battery: 100,
21
+ });
22
+ expect(emitLog).not.toHaveBeenCalled();
23
+ });
24
+ it('should return null for invalid serviceData length', async () => {
25
+ const serviceData = Buffer.from([0x00, 0x00]);
26
+ const manufacturerData = Buffer.from([0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1E, 0x2A, 0x50, 0x00]);
27
+ const result = await WoIOSensorTH.parseServiceData(serviceData, manufacturerData, emitLog);
28
+ expect(result).toBeNull();
29
+ expect(emitLog).toHaveBeenCalledWith('error', '[parseServiceDataForWoIOSensorTH] Service Data Buffer length 2 !== 3!');
30
+ });
31
+ it('should return null for invalid manufacturerData length', async () => {
32
+ const serviceData = Buffer.from([0x00, 0x00, 0x64]);
33
+ const manufacturerData = Buffer.from([0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1E, 0x2A]);
34
+ const result = await WoIOSensorTH.parseServiceData(serviceData, manufacturerData, emitLog);
35
+ expect(result).toBeNull();
36
+ expect(emitLog).toHaveBeenCalledWith('error', '[parseServiceDataForWoIOSensorTH] Manufacturer Data Buffer length 12 !== 14!');
37
+ });
38
+ });
39
+ });
40
+ //# sourceMappingURL=woiosensorth.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"woiosensorth.test.js","sourceRoot":"","sources":["../../src/test/woiosensorth.test.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AAEpC,OAAO,EAAE,QAAQ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