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,81 +0,0 @@
1
- #!/bin/env node
2
-
3
- /**
4
- * This scripts queries the npm registry to pull out the latest version for a given tag.
5
- */
6
-
7
- const fs = require("fs");
8
- const semver = require("semver");
9
- const child_process = require("child_process");
10
- const assert = require("assert");
11
-
12
- const BRANCH_VERSION_PATTERN = /^([A-Za-z]*)-(\d+.\d+.\d+)$/
13
-
14
- // Load the contents of the package.json file
15
- const packageJSON = JSON.parse(fs.readFileSync("package.json", "utf8"));
16
-
17
- let refArgument = process.argv[2];
18
- let tagArgument = process.argv[3] || "latest";
19
-
20
- if (refArgument == null) {
21
- console.error("ref argument is missing");
22
- console.error("Usage: npm-version-script.cjs <ref> [tag]");
23
- process.exit(1);
24
- }
25
-
26
- /**
27
- * Queries the NPM registry for the latest version for the provided tag.
28
- * @param tag The tag to query for.
29
- * @returns {string} Returns the version.
30
- */
31
- function getTagVersionFromNpm(tag) {
32
- try {
33
- return child_process.execSync(`npm info ${packageJSON.name} version --tag="${tag}"`).toString("utf8").trim();
34
- } catch (e) {
35
- throw e;
36
- }
37
- }
38
-
39
- function desiredTargetVersion(ref) {
40
- // ref is a GitHub action ref string
41
- if (ref.startsWith("refs/pull/")) {
42
- throw Error("The version script was executed inside a PR!");
43
- }
44
-
45
- assert(ref.startsWith("refs/heads/"))
46
- let branchName = ref.slice("refs/heads/".length);
47
-
48
- let results = branchName.match(BRANCH_VERSION_PATTERN);
49
- if (results != null) {
50
- if (results[1] !== tagArgument) {
51
- console.warn(`The base branch name (${results[1]}) differs from the tag name ${tagArgument}`);
52
- }
53
-
54
- return results[2];
55
- }
56
-
57
- // legacy mode were we use the `betaVersion` property in the package.json
58
- if (branchName === "beta" && packageJSON.betaVersion) {
59
- return packageJSON.betaVersion
60
- }
61
-
62
- throw new Error("Malformed branch name for ref: " + ref + ". Can't derive the base version. Use a branch name like: beta-x.x.x!");
63
- }
64
-
65
- // derive the base version from the branch ref
66
- const baseVersion = desiredTargetVersion(refArgument);
67
-
68
- // query the npm registry for the latest version of the provided tag name
69
- const latestReleasedVersion = getTagVersionFromNpm(tagArgument); // e.g. 0.7.0-beta.12
70
- const latestReleaseBase = semver.inc(latestReleasedVersion, "patch"); // will produce 0.7.0 (removing the preid, needed for the equality check below)
71
-
72
- let publishTag;
73
- if (semver.eq(baseVersion, latestReleaseBase)) { // check if we are releasing another version for the latest beta
74
- publishTag = latestReleasedVersion; // set the current latest beta to be incremented
75
- } else {
76
- publishTag = baseVersion; // start of with a new beta version
77
- }
78
-
79
- // save the package.json
80
- packageJSON.version = publishTag;
81
- fs.writeFileSync("package.json", JSON.stringify(packageJSON, null, 2));
@@ -1,44 +0,0 @@
1
- import type { ad, NobleTypes } from './types/types.js';
2
- import { Buffer } from 'node:buffer';
3
- /**
4
- * Represents the advertising data parser for SwitchBot devices.
5
- */
6
- export declare class Advertising {
7
- constructor();
8
- /**
9
- * Parses the advertisement data coming from SwitchBot device.
10
- *
11
- * This function processes advertising packets received from SwitchBot devices
12
- * and extracts relevant information based on the device type.
13
- *
14
- * @param {NobleTypes['peripheral']} peripheral - The peripheral device object from noble.
15
- * @param {Function} emitLog - The function to emit log messages.
16
- * @returns {Promise<Ad | null>} - An object containing parsed data specific to the SwitchBot device type, or `null` if the device is not recognized.
17
- */
18
- static parse(peripheral: NobleTypes['peripheral'], emitLog: (level: string, message: string) => void): Promise<ad | null>;
19
- /**
20
- * Validates if the buffer is a valid Buffer object with a minimum length.
21
- *
22
- * @param {any} buffer - The buffer to validate.
23
- * @returns {boolean} - True if the buffer is valid, false otherwise.
24
- */
25
- private static validateBuffer;
26
- /**
27
- * Parses the service data based on the device model.
28
- *
29
- * @param {string} model - The device model.
30
- * @param {Buffer} serviceData - The service data buffer.
31
- * @param {Buffer} manufacturerData - The manufacturer data buffer.
32
- * @param {Function} emitLog - The function to emit log messages.
33
- * @returns {Promise<any>} - The parsed service data.
34
- */
35
- static parseServiceData(model: string, serviceData: Buffer, manufacturerData: Buffer, emitLog: (level: string, message: string) => void): Promise<any>;
36
- /**
37
- * Formats the address of the peripheral.
38
- *
39
- * @param {NobleTypes['peripheral']} peripheral - The peripheral device object from noble.
40
- * @returns {string} - The formatted address.
41
- */
42
- private static formatAddress;
43
- }
44
- //# sourceMappingURL=advertising.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"advertising.d.ts","sourceRoot":"","sources":["../src/advertising.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,EAAE,EAAE,UAAU,EAAe,MAAM,kBAAkB,CAAA;AAEnE,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AA0BpC;;GAEG;AACH,qBAAa,WAAW;;IAGtB;;;;;;;;;OASG;WACU,KAAK,CAChB,UAAU,EAAE,UAAU,CAAC,YAAY,CAAC,EACpC,OAAO,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,KAAK,IAAI,GAChD,OAAO,CAAC,EAAE,GAAG,IAAI,CAAC;IAqCrB;;;;;OAKG;IACH,OAAO,CAAC,MAAM,CAAC,cAAc;IAI7B;;;;;;;;OAQG;WACiB,gBAAgB,CAClC,KAAK,EAAE,MAAM,EACb,WAAW,EAAE,MAAM,EACnB,gBAAgB,EAAE,MAAM,EACxB,OAAO,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,KAAK,IAAI,GAChD,OAAO,CAAC,GAAG,CAAC;IAuDf;;;;;OAKG;IACH,OAAO,CAAC,MAAM,CAAC,aAAa;CAY7B"}
@@ -1,163 +0,0 @@
1
- import { Buffer } from 'node:buffer';
2
- import { WoBlindTilt } from './device/woblindtilt.js';
3
- import { WoBulb } from './device/wobulb.js';
4
- import { WoCeilingLight } from './device/woceilinglight.js';
5
- import { WoContact } from './device/wocontact.js';
6
- import { WoCurtain } from './device/wocurtain.js';
7
- import { WoHand } from './device/wohand.js';
8
- import { WoHub2 } from './device/wohub2.js';
9
- import { WoHumi } from './device/wohumi.js';
10
- import { WoIOSensorTH } from './device/woiosensorth.js';
11
- import { WoLeak } from './device/woleak.js';
12
- import { WoPlugMiniUS } from './device/woplugmini.js';
13
- import { WoPlugMiniJP } from './device/woplugmini_jp.js';
14
- import { WoPresence } from './device/wopresence.js';
15
- import { WoRelaySwitch1Plus } from './device/worelayswitch1plus.js';
16
- import { WoRelaySwitch1PM } from './device/worelayswitch1pm.js';
17
- import { WoSensorTH } from './device/wosensorth.js';
18
- import { WoSensorTHPlus } from './device/wosensorthplus.js';
19
- import { WoSensorTHPro } from './device/wosensorthpro.js';
20
- import { WoSensorTHProCO2 } from './device/wosensorthproco2.js';
21
- import { WoSmartLock } from './device/wosmartlock.js';
22
- import { WoSmartLockPro } from './device/wosmartlockpro.js';
23
- import { WoStrip } from './device/wostrip.js';
24
- import { SwitchBotBLEModel } from './types/types.js';
25
- /**
26
- * Represents the advertising data parser for SwitchBot devices.
27
- */
28
- export class Advertising {
29
- constructor() { }
30
- /**
31
- * Parses the advertisement data coming from SwitchBot device.
32
- *
33
- * This function processes advertising packets received from SwitchBot devices
34
- * and extracts relevant information based on the device type.
35
- *
36
- * @param {NobleTypes['peripheral']} peripheral - The peripheral device object from noble.
37
- * @param {Function} emitLog - The function to emit log messages.
38
- * @returns {Promise<Ad | null>} - An object containing parsed data specific to the SwitchBot device type, or `null` if the device is not recognized.
39
- */
40
- static async parse(peripheral, emitLog) {
41
- const ad = peripheral.advertisement;
42
- if (!ad || !ad.serviceData) {
43
- return null;
44
- }
45
- const serviceData = ad.serviceData[0]?.data;
46
- const manufacturerData = ad.manufacturerData;
47
- if (!Advertising.validateBuffer(serviceData) || !Advertising.validateBuffer(manufacturerData)) {
48
- return null;
49
- }
50
- const model = serviceData.subarray(0, 1).toString('utf8');
51
- const sd = await Advertising.parseServiceData(model, serviceData, manufacturerData, emitLog);
52
- if (!sd) {
53
- // emitLog('debugerror', `[parseAdvertising.${peripheral.id}.${model}] return null, parsed serviceData empty!`)
54
- return null;
55
- }
56
- const address = Advertising.formatAddress(peripheral);
57
- const data = {
58
- id: peripheral.id,
59
- address,
60
- rssi: peripheral.rssi,
61
- serviceData: {
62
- model,
63
- modelName: sd.modelName || '',
64
- modelFriendlyName: sd.modelFriendlyName || '',
65
- ...sd,
66
- },
67
- };
68
- emitLog('debug', `[parseAdvertising.${peripheral.id}.${model}] return ${JSON.stringify(data)}`);
69
- return data;
70
- }
71
- /**
72
- * Validates if the buffer is a valid Buffer object with a minimum length.
73
- *
74
- * @param {any} buffer - The buffer to validate.
75
- * @returns {boolean} - True if the buffer is valid, false otherwise.
76
- */
77
- static validateBuffer(buffer) {
78
- return buffer && Buffer.isBuffer(buffer) && buffer.length >= 3;
79
- }
80
- /**
81
- * Parses the service data based on the device model.
82
- *
83
- * @param {string} model - The device model.
84
- * @param {Buffer} serviceData - The service data buffer.
85
- * @param {Buffer} manufacturerData - The manufacturer data buffer.
86
- * @param {Function} emitLog - The function to emit log messages.
87
- * @returns {Promise<any>} - The parsed service data.
88
- */
89
- static async parseServiceData(model, serviceData, manufacturerData, emitLog) {
90
- switch (model) {
91
- case SwitchBotBLEModel.Bot:
92
- return WoHand.parseServiceData(serviceData, emitLog);
93
- case SwitchBotBLEModel.Curtain:
94
- case SwitchBotBLEModel.Curtain3:
95
- return WoCurtain.parseServiceData(serviceData, manufacturerData, emitLog);
96
- case SwitchBotBLEModel.Humidifier:
97
- return WoHumi.parseServiceData(serviceData, emitLog);
98
- case SwitchBotBLEModel.Meter:
99
- return WoSensorTH.parseServiceData(serviceData, emitLog);
100
- case SwitchBotBLEModel.MeterPlus:
101
- return WoSensorTHPlus.parseServiceData(serviceData, emitLog);
102
- case SwitchBotBLEModel.MeterPro:
103
- return WoSensorTHPro.parseServiceData(serviceData, emitLog);
104
- case SwitchBotBLEModel.MeterProCO2:
105
- return WoSensorTHProCO2.parseServiceData(serviceData, manufacturerData, emitLog);
106
- case SwitchBotBLEModel.Hub2:
107
- return WoHub2.parseServiceData(manufacturerData, emitLog);
108
- case SwitchBotBLEModel.OutdoorMeter:
109
- return WoIOSensorTH.parseServiceData(serviceData, manufacturerData, emitLog);
110
- case SwitchBotBLEModel.MotionSensor:
111
- return WoPresence.parseServiceData(serviceData, emitLog);
112
- case SwitchBotBLEModel.ContactSensor:
113
- return WoContact.parseServiceData(serviceData, emitLog);
114
- case SwitchBotBLEModel.ColorBulb:
115
- return WoBulb.parseServiceData(serviceData, manufacturerData, emitLog);
116
- case SwitchBotBLEModel.CeilingLight:
117
- return WoCeilingLight.parseServiceData(manufacturerData, emitLog);
118
- case SwitchBotBLEModel.CeilingLightPro:
119
- return WoCeilingLight.parseServiceData_Pro(manufacturerData, emitLog);
120
- case SwitchBotBLEModel.StripLight:
121
- return WoStrip.parseServiceData(serviceData, emitLog);
122
- case SwitchBotBLEModel.PlugMiniUS:
123
- return WoPlugMiniUS.parseServiceData(manufacturerData, emitLog);
124
- case SwitchBotBLEModel.PlugMiniJP:
125
- return WoPlugMiniJP.parseServiceData(manufacturerData, emitLog);
126
- case SwitchBotBLEModel.Lock:
127
- return WoSmartLock.parseServiceData(serviceData, manufacturerData, emitLog);
128
- case SwitchBotBLEModel.LockPro:
129
- return WoSmartLockPro.parseServiceData(serviceData, manufacturerData, emitLog);
130
- case SwitchBotBLEModel.BlindTilt:
131
- return WoBlindTilt.parseServiceData(serviceData, manufacturerData, emitLog);
132
- case SwitchBotBLEModel.Leak:
133
- return WoLeak.parseServiceData(serviceData, manufacturerData, emitLog);
134
- case SwitchBotBLEModel.RelaySwitch1PM:
135
- return WoRelaySwitch1PM.parseServiceData(serviceData, manufacturerData, emitLog);
136
- case SwitchBotBLEModel.RelaySwitch1Plus:
137
- return WoRelaySwitch1Plus.parseServiceData(serviceData, manufacturerData, emitLog);
138
- default:
139
- emitLog('debug', `[parseAdvertising.${model}] return null, model "${model}" not available!`);
140
- return null;
141
- }
142
- }
143
- /**
144
- * Formats the address of the peripheral.
145
- *
146
- * @param {NobleTypes['peripheral']} peripheral - The peripheral device object from noble.
147
- * @returns {string} - The formatted address.
148
- */
149
- static formatAddress(peripheral) {
150
- let address = peripheral.address || '';
151
- if (address === '') {
152
- const str = peripheral.advertisement.manufacturerData?.toString('hex').slice(4, 16) || '';
153
- if (str !== '') {
154
- address = str.match(/.{1,2}/g)?.join(':') || '';
155
- }
156
- }
157
- else {
158
- address = address.replace(/-/g, ':');
159
- }
160
- return address;
161
- }
162
- }
163
- //# sourceMappingURL=advertising.js.map
@@ -1 +0,0 @@
1
- {"version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AAC;QACH,CAAC;aAAM,CAAC;YACN,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC,CAAA;QACtC,CAAC;QACD,OAAO,OAAO,CAAA;IAChB,CAAC;CACF"}
@@ -1,78 +0,0 @@
1
- import type { blindTiltServiceData } 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 WoBlindTilt device.
7
- * @see https://github.com/OpenWonderLabs/SwitchBotAPI-BLE/blob/latest/devicetypes/curtain.md
8
- */
9
- export declare class WoBlindTilt extends SwitchbotDevice {
10
- private _reverse;
11
- /**
12
- * Parses the service data and manufacturer data for the WoBlindTilt device.
13
- * @param {Buffer} serviceData - The service data buffer.
14
- * @param {Buffer} manufacturerData - The manufacturer data buffer.
15
- * @param {Function} emitLog - The function to emit log messages.
16
- * @param {boolean} [reverse] - Whether to reverse the tilt percentage.
17
- * @returns {Promise<blindTiltServiceData | null>} - The parsed data object or null if the data is invalid.
18
- */
19
- static parseServiceData(serviceData: Buffer, manufacturerData: Buffer, emitLog: (level: string, message: string) => void, reverse?: boolean): Promise<blindTiltServiceData | null>;
20
- constructor(peripheral: NobleTypes['peripheral'], noble: NobleTypes['noble']);
21
- /**
22
- * Opens the blind tilt to the fully open position.
23
- * @returns {Promise<void>}
24
- */
25
- open(): Promise<void>;
26
- /**
27
- * Closes the blind tilt up to the nearest endpoint.
28
- * @returns {Promise<void>}
29
- */
30
- closeUp(): Promise<void>;
31
- /**
32
- * Closes the blind tilt down to the nearest endpoint.
33
- * @returns {Promise<void>}
34
- */
35
- closeDown(): Promise<void>;
36
- /**
37
- * Closes the blind tilt to the nearest endpoint.
38
- * @returns {Promise<void>}
39
- */
40
- close(): Promise<void>;
41
- /**
42
- * Retrieves the current position of the blind tilt.
43
- * @returns {Promise<number>} - The current position of the blind tilt (0-100).
44
- */
45
- getPosition(): Promise<number>;
46
- /**
47
- * Retrieves the advertised value for a given key.
48
- * @param {string} key - The key for the advertised value.
49
- * @returns {Promise<number>} - The advertised value.
50
- * @private
51
- */
52
- private _getAdvValue;
53
- /**
54
- * Retrieves the basic information of the blind tilt.
55
- * @returns {Promise<object | null>} - A promise that resolves to an object containing the basic information of the blind tilt.
56
- */
57
- getBasicInfo(): Promise<object | null>;
58
- /**
59
- * Pauses the blind tilt operation.
60
- * @returns {Promise<void>}
61
- */
62
- pause(): Promise<void>;
63
- /**
64
- * Runs the blind tilt to the specified position.
65
- * @param {number} percent - The target position percentage (0-100).
66
- * @param {number} mode - The running mode (0 or 1).
67
- * @returns {Promise<void>}
68
- */
69
- runToPos(percent: number, mode: number): Promise<void>;
70
- /**
71
- * Sends a command to operate the blind tilt and handles the response.
72
- * @param {number[]} bytes - The byte array representing the command to be sent to the device.
73
- * @returns {Promise<void>}
74
- * @private
75
- */
76
- operateBlindTilt(bytes: number[]): Promise<void>;
77
- }
78
- //# sourceMappingURL=woblindtilt.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"woblindtilt.d.ts","sourceRoot":"","sources":["../../src/device/woblindtilt.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAA;AACvE,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,WAAY,SAAQ,eAAe;IAC9C,OAAO,CAAC,QAAQ,CAAiB;IAEjC;;;;;;;OAOG;WACU,gBAAgB,CAC3B,WAAW,EAAE,MAAM,EACnB,gBAAgB,EAAE,MAAM,EACxB,OAAO,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,KAAK,IAAI,EACjD,OAAO,GAAE,OAAe,GACvB,OAAO,CAAC,oBAAoB,GAAG,IAAI,CAAC;gBA+B3B,UAAU,EAAE,UAAU,CAAC,YAAY,CAAC,EAAE,KAAK,EAAE,UAAU,CAAC,OAAO,CAAC;IAI5E;;;OAGG;IACG,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAI3B;;;OAGG;IACG,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IAI9B;;;OAGG;IACG,SAAS,IAAI,OAAO,CAAC,IAAI,CAAC;IAIhC;;;OAGG;IACG,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAS5B;;;OAGG;IACG,WAAW,IAAI,OAAO,CAAC,MAAM,CAAC;IAKpC;;;;;OAKG;YACW,YAAY;IAO1B;;;OAGG;IACG,YAAY,IAAI,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;IA2C5C;;;OAGG;IACG,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAI5B;;;;;OAKG;IACG,QAAQ,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAU5D;;;;;OAKG;IACU,gBAAgB,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;CAO9D"}
@@ -1,181 +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 WoBlindTilt device.
6
- * @see https://github.com/OpenWonderLabs/SwitchBotAPI-BLE/blob/latest/devicetypes/curtain.md
7
- */
8
- export class WoBlindTilt extends SwitchbotDevice {
9
- _reverse = false;
10
- /**
11
- * Parses the service data and manufacturer data for the WoBlindTilt device.
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 tilt percentage.
16
- * @returns {Promise<blindTiltServiceData | null>} - The parsed data object or null if the data is invalid.
17
- */
18
- static async parseServiceData(serviceData, manufacturerData, emitLog, reverse = false) {
19
- if (![5, 6].includes(manufacturerData.length)) {
20
- emitLog('debugerror', `[parseServiceDataForWoBlindTilt] Buffer length ${manufacturerData.length} !== 5 or 6!`);
21
- return null;
22
- }
23
- const byte2 = serviceData.readUInt8(2);
24
- const byte6 = manufacturerData.subarray(6);
25
- const tilt = Math.max(Math.min(byte6.readUInt8(2) & 0b01111111, 100), 0);
26
- const inMotion = !!(byte2 & 0b10000000);
27
- const lightLevel = (byte6.readUInt8(1) >> 4) & 0b00001111;
28
- const calibration = !!(byte6.readUInt8(1) & 0b00000001);
29
- const sequenceNumber = byte6.readUInt8(0);
30
- const battery = serviceData.length > 2 ? byte2 & 0b01111111 : 0;
31
- const data = {
32
- model: SwitchBotBLEModel.BlindTilt,
33
- modelName: SwitchBotBLEModelName.BlindTilt,
34
- modelFriendlyName: SwitchBotBLEModelFriendlyName.BlindTilt,
35
- calibration,
36
- battery,
37
- inMotion,
38
- tilt: reverse ? 100 - tilt : tilt,
39
- lightLevel,
40
- sequenceNumber,
41
- };
42
- return data;
43
- }
44
- constructor(peripheral, noble) {
45
- super(peripheral, noble);
46
- }
47
- /**
48
- * Opens the blind tilt to the fully open position.
49
- * @returns {Promise<void>}
50
- */
51
- async open() {
52
- await this.operateBlindTilt([0x57, 0x0F, 0x45, 0x01, 0x05, 0xFF, 0x32]);
53
- }
54
- /**
55
- * Closes the blind tilt up to the nearest endpoint.
56
- * @returns {Promise<void>}
57
- */
58
- async closeUp() {
59
- await this.operateBlindTilt([0x57, 0x0F, 0x45, 0x01, 0x05, 0xFF, 0x64]);
60
- }
61
- /**
62
- * Closes the blind tilt down to the nearest endpoint.
63
- * @returns {Promise<void>}
64
- */
65
- async closeDown() {
66
- await this.operateBlindTilt([0x57, 0x0F, 0x45, 0x01, 0x05, 0xFF, 0x00]);
67
- }
68
- /**
69
- * Closes the blind tilt to the nearest endpoint.
70
- * @returns {Promise<void>}
71
- */
72
- async close() {
73
- const position = await this.getPosition();
74
- if (position > 50) {
75
- await this.closeUp();
76
- }
77
- else {
78
- await this.closeDown();
79
- }
80
- }
81
- /**
82
- * Retrieves the current position of the blind tilt.
83
- * @returns {Promise<number>} - The current position of the blind tilt (0-100).
84
- */
85
- async getPosition() {
86
- const tiltPosition = await this._getAdvValue('tilt');
87
- return Math.max(0, Math.min(tiltPosition, 100));
88
- }
89
- /**
90
- * Retrieves the advertised value for a given key.
91
- * @param {string} key - The key for the advertised value.
92
- * @returns {Promise<number>} - The advertised value.
93
- * @private
94
- */
95
- async _getAdvValue(key) {
96
- if (key === 'tilt') {
97
- return 50; // Example value
98
- }
99
- throw new Error(`Unknown key: ${key}`);
100
- }
101
- /**
102
- * Retrieves the basic information of the blind tilt.
103
- * @returns {Promise<object | null>} - A promise that resolves to an object containing the basic information of the blind tilt.
104
- */
105
- async getBasicInfo() {
106
- const data = await this.getBasicInfo();
107
- if (!data) {
108
- return null;
109
- }
110
- const tilt = Math.max(Math.min(data[6], 100), 0);
111
- const moving = Boolean(data[5] & 0b00000011);
112
- let opening = false;
113
- let closing = false;
114
- let up = false;
115
- if (moving) {
116
- opening = Boolean(data[5] & 0b00000010);
117
- closing = !opening && Boolean(data[5] & 0b00000001);
118
- if (opening) {
119
- const flag = Boolean(data[5] & 0b00000001);
120
- up = flag ? this._reverse : !flag;
121
- }
122
- else {
123
- up = tilt < 50 ? this._reverse : tilt > 50;
124
- }
125
- }
126
- return {
127
- battery: data[1],
128
- firmware: data[2] / 10.0,
129
- light: Boolean(data[4] & 0b00100000),
130
- fault: Boolean(data[4] & 0b00001000),
131
- solarPanel: Boolean(data[5] & 0b00001000),
132
- calibration: Boolean(data[5] & 0b00000100),
133
- calibrated: Boolean(data[5] & 0b00000100),
134
- inMotion: moving,
135
- motionDirection: {
136
- opening: moving && opening,
137
- closing: moving && closing,
138
- up: moving && up,
139
- down: moving && !up,
140
- },
141
- tilt: this._reverse ? 100 - tilt : tilt,
142
- timers: data[7],
143
- };
144
- }
145
- /**
146
- * Pauses the blind tilt operation.
147
- * @returns {Promise<void>}
148
- */
149
- async pause() {
150
- await this.operateBlindTilt([0x57, 0x0F, 0x45, 0x01, 0x00, 0xFF]);
151
- }
152
- /**
153
- * Runs the blind tilt to the specified position.
154
- * @param {number} percent - The target position percentage (0-100).
155
- * @param {number} mode - The running mode (0 or 1).
156
- * @returns {Promise<void>}
157
- */
158
- async runToPos(percent, mode) {
159
- if (typeof percent !== 'number' || percent < 0 || percent > 100) {
160
- throw new RangeError('Percent must be a number between 0 and 100');
161
- }
162
- if (typeof mode !== 'number' || mode < 0 || mode > 1) {
163
- throw new RangeError('Mode must be a number between 0 and 1');
164
- }
165
- await this.operateBlindTilt([0x57, 0x0F, 0x45, 0x01, 0x05, mode, percent]);
166
- }
167
- /**
168
- * Sends a command to operate the blind tilt and handles the response.
169
- * @param {number[]} bytes - The byte array representing the command to be sent to the device.
170
- * @returns {Promise<void>}
171
- * @private
172
- */
173
- async operateBlindTilt(bytes) {
174
- const reqBuf = Buffer.from(bytes);
175
- const resBuf = await this.command(reqBuf);
176
- if (resBuf.length !== 3 || resBuf.readUInt8(0) !== 0x01) {
177
- throw new Error(`The device returned an error: 0x${resBuf.toString('hex')}`);
178
- }
179
- }
180
- }
181
- //# sourceMappingURL=woblindtilt.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"woblindtilt.js","sourceRoot":"","sources":["../../src/device/woblindtilt.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,WAAY,SAAQ,eAAe;IACtC,QAAQ,GAAY,KAAK,CAAA;IAEjC;;;;;;;OAOG;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Ae,EAAE,IAAY;QAC1C,IAAI,OAAO,OAAO,KAAK,QAAQ,IAAI,OAAO,GAAG,CAAC,IAAI,OAAO,GAAG,GAAG,EAAE,CAAC;YAChE,MAAM,IAAI,UAAU,CAAC,4CAA4C,CAAC,CAAA;QACpE,CAAC;QACD,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAI,IAAI,GAAG,CAAC,IAAI,IAAI,GAAG,CAAC,EAAE,CAAC;YACrD,MAAM,IAAI,UAAU,CAAC,uCAAuC,CAAC,CAAA;QAC/D,CAAC;QACD,MAAM,IAAI,CAAC,gBAAgB,CAAC,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC,CAAA;IAC5E,CAAC;IAED;;;;;OAKG;IACI,KAAK,CAAC,gBAAgB,CAAC,KAAe;QAC3C,MAAM,MAAM,GAAG,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;QACjC,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAA;QACzC,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC,IAAI,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,KAAK,IAAI,EAAE,CAAC;YACxD,MAAM,IAAI,KAAK,CAAC,mCAAmC,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC,CAAA;QAC9E,CAAC;IACH,CAAC;CACF"}
@@ -1,70 +0,0 @@
1
- import type { colorBulbServiceData } 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 WoBulb device.
7
- * @see https://github.com/OpenWonderLabs/SwitchBotAPI-BLE/blob/latest/devicetypes/colorbulb.md
8
- */
9
- export declare class WoBulb extends SwitchbotDevice {
10
- /**
11
- * Parses the service data for WoBulb.
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<colorBulbServiceData | null>} - Parsed service data or null if invalid.
16
- */
17
- static parseServiceData(serviceData: Buffer, manufacturerData: Buffer, emitLog: (level: string, message: string) => void): Promise<colorBulbServiceData | null>;
18
- constructor(peripheral: NobleTypes['peripheral'], noble: NobleTypes['noble']);
19
- /**
20
- * Reads the state of the bulb.
21
- * @returns {Promise<boolean>} - Resolves with a boolean indicating whether the bulb is ON (true) or OFF (false).
22
- */
23
- readState(): Promise<boolean>;
24
- /**
25
- * Sets the state of the bulb.
26
- * @param {number[]} reqByteArray - The request byte array.
27
- * @returns {Promise<boolean>} - Resolves with a boolean indicating whether the operation was successful.
28
- * @private
29
- */
30
- setState(reqByteArray: number[]): Promise<boolean>;
31
- /**
32
- * Turns on the bulb.
33
- * @returns {Promise<boolean>} - Resolves with a boolean indicating whether the bulb is ON (true).
34
- */
35
- turnOn(): Promise<boolean>;
36
- /**
37
- * Turns off the bulb.
38
- * @returns {Promise<boolean>} - Resolves with a boolean indicating whether the bulb is OFF (false).
39
- */
40
- turnOff(): Promise<boolean>;
41
- /**
42
- * Sets the brightness of the bulb.
43
- * @param {number} brightness - The brightness percentage (0-100).
44
- * @returns {Promise<boolean>} - Resolves with a boolean indicating whether the operation was successful.
45
- */
46
- setBrightness(brightness: number): Promise<boolean>;
47
- /**
48
- * Sets the color temperature of the bulb.
49
- * @param {number} color_temperature - The color temperature percentage (0-100).
50
- * @returns {Promise<boolean>} - Resolves with a boolean indicating whether the operation was successful.
51
- */
52
- setColorTemperature(color_temperature: number): Promise<boolean>;
53
- /**
54
- * Sets the RGB color of the bulb.
55
- * @param {number} brightness - The brightness percentage (0-100).
56
- * @param {number} red - The red color value (0-255).
57
- * @param {number} green - The green color value (0-255).
58
- * @param {number} blue - The blue color value (0-255).
59
- * @returns {Promise<boolean>} - Resolves with a boolean indicating whether the operation was successful.
60
- */
61
- setRGB(brightness: number, red: number, green: number, blue: number): Promise<boolean>;
62
- /**
63
- * Sends a command to the bulb.
64
- * @param {number[]} bytes - The command bytes.
65
- * @returns {Promise<boolean>} - Resolves with a boolean indicating whether the operation was successful.
66
- * @private
67
- */
68
- private operateBulb;
69
- }
70
- //# sourceMappingURL=wobulb.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"wobulb.d.ts","sourceRoot":"","sources":["../../src/device/wobulb.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAA;AACvE,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;;;;;;OAMG;WACU,gBAAgB,CAC3B,WAAW,EAAE,MAAM,EACnB,gBAAgB,EAAE,MAAM,EAExB,OAAO,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,KAAK,IAAI,GAChD,OAAO,CAAC,oBAAoB,GAAG,IAAI,CAAC;gBA2C3B,UAAU,EAAE,UAAU,CAAC,YAAY,CAAC,EAAE,KAAK,EAAE,UAAU,CAAC,OAAO,CAAC;IAI5E;;;OAGG;IACG,SAAS,IAAI,OAAO,CAAC,OAAO,CAAC;IAInC;;;;;OAKG;IACU,QAAQ,CAAC,YAAY,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,OAAO,CAAC;IAK/D;;;OAGG;IACG,MAAM,IAAI,OAAO,CAAC,OAAO,CAAC;IAIhC;;;OAGG;IACG,OAAO,IAAI,OAAO,CAAC,OAAO,CAAC;IAIjC;;;;OAIG;IACG,aAAa,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAOzD;;;;OAIG;IACG,mBAAmB,CAAC,i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