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,51 +0,0 @@
1
- import { SwitchbotDevice } from '../device.js';
2
- import { SwitchBotBLEModel, SwitchBotBLEModelFriendlyName, SwitchBotBLEModelName } from '../types/types.js';
3
- /**
4
- * Class representing a WoKeypad device.
5
- */
6
- export class WoKeypad extends SwitchbotDevice {
7
- /**
8
- * Parses the service data for WoKeypad.
9
- * @param {Buffer} serviceData - The service data buffer.
10
- * @param {Buffer} manufacturerData - The manufacturer data buffer.
11
- * @param {Function} emitLog - The function to emit log messages.
12
- * @returns {Promise<keypadDetectorServiceData | null>} - Parsed service data or null if invalid.
13
- */
14
- static async parseServiceData(serviceData, manufacturerData, emitLog) {
15
- if (!serviceData || serviceData.length < 3) {
16
- emitLog('debugerror', `[parseServiceDataForWoKeypad] Service Data Buffer length ${serviceData?.length ?? 0} < 3!`);
17
- return null;
18
- }
19
- if (!manufacturerData || manufacturerData.length < 2) {
20
- emitLog('debugerror', `[parseServiceDataForWoKeypad] Manufacturer Data Buffer length ${manufacturerData?.length ?? 0} < 2!`);
21
- return null;
22
- }
23
- const modelId = serviceData.readUInt8(0);
24
- if (modelId !== 0x26) {
25
- // Not a Keypad
26
- emitLog('debugerror', `[parseServiceDataForWoKeypad] Model ID ${modelId} !== 0x26!`);
27
- return null;
28
- }
29
- const eventFlags = serviceData.readUInt8(1);
30
- const keypadEventDetected = !!(eventFlags & 0b00000001); // Bit 0
31
- const deviceTampered = !!(eventFlags & 0b00000010); // Bit 1
32
- const batteryInfo = serviceData.readUInt8(2);
33
- const batteryLevel = batteryInfo & 0b01111111; // Bits 0-6
34
- const lowBattery = !!(batteryInfo & 0b10000000); // Bit 7
35
- // Manufacturer data can be processed here if needed
36
- const data = {
37
- model: SwitchBotBLEModel.Keypad,
38
- modelName: SwitchBotBLEModelName.Keypad,
39
- modelFriendlyName: SwitchBotBLEModelFriendlyName.Keypad,
40
- event: keypadEventDetected,
41
- tampered: deviceTampered,
42
- battery: batteryLevel,
43
- low_battery: lowBattery,
44
- };
45
- return data;
46
- }
47
- constructor(peripheral, noble) {
48
- super(peripheral, noble);
49
- }
50
- }
51
- //# sourceMappingURL=wokeypad.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"wokeypad.js","sourceRoot":"","sources":["../../src/device/wokeypad.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AAC9C,OAAO,EAAE,iBAAiB,EA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AAG,UAAU,CAAC,CAAA,CAAC,QAAQ;QAExD,oDAAoD;QAEpD,MAAM,IAAI,GAAG;YACX,KAAK,EAAE,iBAAiB,CAAC,MAAM;YAC/B,SAAS,EAAE,qBAAqB,CAAC,MAAM;YACvC,iBAAiB,EAAE,6BAA6B,CAAC,MAAM;YACvD,KAAK,EAAE,mBAAmB;YAC1B,QAAQ,EAAE,cAAc;YACxB,OAAO,EAAE,YAAY;YACrB,WAAW,EAAE,UAAU;SACxB,CAAA;QAED,OAAO,IAAiC,CAAA;IAC1C,CAAC;IAED,YAAY,UAAoC,EAAE,KAA0B;QAC1E,KAAK,CAAC,UAAU,EAAE,KAAK,CAAC,CAAA;IAC1B,CAAC;CACF"}
@@ -1,20 +0,0 @@
1
- import type { Buffer } from 'node:buffer';
2
- import type { waterLeakDetectorServiceData } from '../types/bledevicestatus.js';
3
- import type { NobleTypes } from '../types/types.js';
4
- import { SwitchbotDevice } from '../device.js';
5
- /**
6
- * Class representing a WoLeak device.
7
- * @see https://github.com/OpenWonderLabs/SwitchBotAPI-BLE/blob/latest/devicetypes/meter.md#outdoor-temperaturehumidity-sensor
8
- */
9
- export declare class WoLeak extends SwitchbotDevice {
10
- /**
11
- * Parses the service data for WoLeak.
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<leakServiceData | null>} - Parsed service data or null if invalid.
16
- */
17
- static parseServiceData(serviceData: Buffer, manufacturerData: Buffer, emitLog: (level: string, message: string) => void): Promise<waterLeakDetectorServiceData | null>;
18
- constructor(peripheral: NobleTypes['peripheral'], noble: NobleTypes['noble']);
19
- }
20
- //# sourceMappingURL=woleak.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"woleak.d.ts","sourceRoot":"","sources":["../../src/device/woleak.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AAEzC,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,6BAA6B,CAAA;AAC/E,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAA;AAEnD,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,EACxB,OAAO,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,KAAK,IAAI,GAChD,OAAO,CAAC,4BAA4B,GAAG,IAAI,CAAC;gBA0CnC,UAAU,EAAE,UAAU,CAAC,YAAY,CAAC,EAAE,KAAK,EAAE,UAAU,CAAC,OAAO,CAAC;CAG7E"}
@@ -1,52 +0,0 @@
1
- import { SwitchbotDevice } from '../device.js';
2
- import { SwitchBotBLEModel, SwitchBotBLEModelFriendlyName, SwitchBotBLEModelName } from '../types/types.js';
3
- /**
4
- * Class representing a WoLeak device.
5
- * @see https://github.com/OpenWonderLabs/SwitchBotAPI-BLE/blob/latest/devicetypes/meter.md#outdoor-temperaturehumidity-sensor
6
- */
7
- export class WoLeak extends SwitchbotDevice {
8
- /**
9
- * Parses the service data for WoLeak.
10
- * @param {Buffer} serviceData - The service data buffer.
11
- * @param {Buffer} manufacturerData - The manufacturer data buffer.
12
- * @param {Function} emitLog - The function to emit log messages.
13
- * @returns {Promise<leakServiceData | null>} - Parsed service data or null if invalid.
14
- */
15
- static async parseServiceData(serviceData, manufacturerData, emitLog) {
16
- if (!serviceData || serviceData.length < 3) {
17
- emitLog('debugerror', `[parseServiceDataForWoLeakDetector] Service Data Buffer length ${serviceData?.length ?? 0} < 3!`);
18
- return null;
19
- }
20
- if (!manufacturerData || manufacturerData.length < 2) {
21
- emitLog('debugerror', `[parseServiceDataForWoLeakDetector] Manufacturer Data Buffer length ${manufacturerData?.length ?? 0} < 2!`);
22
- return null;
23
- }
24
- const modelId = serviceData.readUInt8(0);
25
- if (modelId !== 0x26) {
26
- // Not a Water Leak Detector
27
- emitLog('debugerror', `[parseServiceDataForWoLeakDetector] Model ID ${modelId} !== 0x26!`);
28
- return null;
29
- }
30
- const eventFlags = serviceData.readUInt8(1);
31
- const waterLeakDetected = !!(eventFlags & 0b00000001); // Bit 0
32
- const deviceTampered = !!(eventFlags & 0b00000010); // Bit 1
33
- const batteryInfo = serviceData.readUInt8(2);
34
- const batteryLevel = batteryInfo & 0b01111111; // Bits 0-6
35
- const lowBattery = !!(batteryInfo & 0b10000000); // Bit 7
36
- // Manufacturer data can be processed here if needed
37
- const data = {
38
- model: SwitchBotBLEModel.Leak,
39
- modelName: SwitchBotBLEModelName.Leak,
40
- modelFriendlyName: SwitchBotBLEModelFriendlyName.Leak,
41
- leak: waterLeakDetected,
42
- tampered: deviceTampered,
43
- battery: batteryLevel,
44
- low_battery: lowBattery,
45
- };
46
- return data;
47
- }
48
- constructor(peripheral, noble) {
49
- super(peripheral, noble);
50
- }
51
- }
52
- //# sourceMappingURL=woleak.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"woleak.js","sourceRoot":"","sources":["../../src/device/woleak.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AAC9C,OAAO,EAAE,iBAAiB,EAAE,6BAA6B,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAA;AAE3G;;;GAGG;AACH,MAAM,OAAO,MAAO,SAAQ,eAAe;IACzC;;;;;;OAMG;IACH,MAAM,CAAC,KAAK,CAAC,gBAAgB,CAC3B,WAAmB,EACnB,gBAAwB,EACxB,OAAiD;QAEjD,IAAI,CAAC,WAAW,IAAI,WAAW,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YAC3C,OAAO,CAAC,YAAY,EAAE,kEAAkE,WAAW,EAAE,MAAM,IAAI,CAAC,OAAO,CAAC,CAAA;YACxH,OAAO,IAAI,CAAA;QACb,C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CAAC,UAAU,EAAE,KAAK,CAAC,CAAA;IAC1B,CAAC;CACF"}
@@ -1,52 +0,0 @@
1
- import type { plugMiniUSServiceData } 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 WoPlugMini device.
7
- * @see https://github.com/OpenWonderLabs/SwitchBotAPI-BLE/blob/latest/devicetypes/plugmini.md
8
- */
9
- export declare class WoPlugMiniUS extends SwitchbotDevice {
10
- constructor(peripheral: NobleTypes['peripheral'], noble: NobleTypes['noble']);
11
- /**
12
- * Parses the service data for WoPlugMini US.
13
- * @param {Buffer} manufacturerData - The manufacturer data buffer.
14
- * @param {Function} emitLog - The function to emit log messages.
15
- * @returns {Promise<plugMiniUSServiceData | null>} - Parsed service data or null if invalid.
16
- */
17
- static parseServiceData(manufacturerData: Buffer, emitLog: (level: string, message: string) => void): Promise<plugMiniUSServiceData | null>;
18
- /**
19
- * Reads the state of the plug.
20
- * @returns {Promise<boolean>} - Resolves with a boolean that tells whether the plug is ON (true) or OFF (false).
21
- */
22
- readState(): Promise<boolean>;
23
- /**
24
- * Sets the state of the plug.
25
- * @private
26
- * @param {number[]} reqByteArray - The request byte array.
27
- * @returns {Promise<boolean>} - Resolves with a boolean that tells whether the plug is ON (true) or OFF (false).
28
- */
29
- private setState;
30
- /**
31
- * Turns on the plug.
32
- * @returns {Promise<boolean>} - Resolves with a boolean that tells whether the plug is ON (true) or OFF (false).
33
- */
34
- turnOn(): Promise<boolean>;
35
- /**
36
- * Turns off the plug.
37
- * @returns {Promise<boolean>} - Resolves with a boolean that tells whether the plug is ON (true) or OFF (false).
38
- */
39
- turnOff(): Promise<boolean>;
40
- /**
41
- * Toggles the state of the plug.
42
- * @returns {Promise<boolean>} - Resolves with a boolean that tells whether the plug is ON (true) or OFF (false).
43
- */
44
- toggle(): Promise<boolean>;
45
- /**
46
- * Operates the plug with the given bytes.
47
- * @param {number[]} bytes - The byte array to send to the plug.
48
- * @returns {Promise<boolean>} - Resolves with a boolean that tells whether the plug is ON (true) or OFF (false).
49
- */
50
- operatePlug(bytes: number[]): Promise<boolean>;
51
- }
52
- //# sourceMappingURL=woplugmini.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"woplugmini.d.ts","sourceRoot":"","sources":["../../src/device/woplugmini.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,6BAA6B,CAAA;AACxE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAA;AAEnD,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AAEpC,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AAG9C;;;GAGG;AACH,qBAAa,YAAa,SAAQ,eAAe;gBACnC,UAAU,EAAE,UAAU,CAAC,YAAY,CAAC,EAAE,KAAK,EAAE,UAAU,CAAC,OAAO,CAAC;IAI5E;;;;;OAKG;WACU,gBAAgB,CAC3B,gBAAgB,EAAE,MAAM,EACxB,OAAO,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,KAAK,IAAI,GAChD,OAAO,CAAC,qBAAqB,GAAG,IAAI,CAAC;IAsCxC;;;OAGG;IACG,SAAS,IAAI,OAAO,CAAC,OAAO,CAAC;IAInC;;;;;OAKG;YACW,QAAQ;IAKtB;;;OAGG;IACG,MAAM,IAAI,OAAO,CAAC,OAAO,CAAC;IAIhC;;;OAGG;IACG,OAAO,IAAI,OAAO,CAAC,OAAO,CAAC;IAIjC;;;OAGG;IACG,MAAM,IAAI,OAAO,CAAC,OAAO,CAAC;IAIhC;;;;OAIG;IACU,WAAW,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,OAAO,CAAC;CAgB5D"}
@@ -1,110 +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 WoPlugMini device.
6
- * @see https://github.com/OpenWonderLabs/SwitchBotAPI-BLE/blob/latest/devicetypes/plugmini.md
7
- */
8
- export class WoPlugMiniUS extends SwitchbotDevice {
9
- constructor(peripheral, noble) {
10
- super(peripheral, noble);
11
- }
12
- /**
13
- * Parses the service data for WoPlugMini US.
14
- * @param {Buffer} manufacturerData - The manufacturer data buffer.
15
- * @param {Function} emitLog - The function to emit log messages.
16
- * @returns {Promise<plugMiniUSServiceData | null>} - Parsed service data or null if invalid.
17
- */
18
- static async parseServiceData(manufacturerData, emitLog) {
19
- if (manufacturerData.length !== 14) {
20
- emitLog('debugerror', `[parseServiceDataForWoPlugMini] Buffer length ${manufacturerData.length} should be 14`);
21
- return null;
22
- }
23
- const [byte9, byte10, byte11, byte12, byte13] = [
24
- manufacturerData.readUInt8(9),
25
- manufacturerData.readUInt8(10),
26
- manufacturerData.readUInt8(11),
27
- manufacturerData.readUInt8(12),
28
- manufacturerData.readUInt8(13),
29
- ];
30
- const state = byte9 === 0x00 ? 'off' : byte9 === 0x80 ? 'on' : null;
31
- const delay = !!(byte10 & 0b00000001);
32
- const timer = !!(byte10 & 0b00000010);
33
- const syncUtcTime = !!(byte10 & 0b00000100);
34
- const wifiRssi = byte11;
35
- const overload = !!(byte12 & 0b10000000);
36
- const currentPower = (((byte12 & 0b01111111) << 8) + byte13) / 10; // in watt
37
- const data = {
38
- model: SwitchBotBLEModel.PlugMiniUS,
39
- modelName: SwitchBotBLEModelName.PlugMini,
40
- modelFriendlyName: SwitchBotBLEModelFriendlyName.PlugMini,
41
- state: state ?? 'unknown',
42
- delay,
43
- timer,
44
- syncUtcTime,
45
- wifiRssi,
46
- overload,
47
- currentPower,
48
- };
49
- return data;
50
- }
51
- /**
52
- * Reads the state of the plug.
53
- * @returns {Promise<boolean>} - Resolves with a boolean that tells whether the plug is ON (true) or OFF (false).
54
- */
55
- async readState() {
56
- return this.operatePlug([0x57, 0x0F, 0x51, 0x01]);
57
- }
58
- /**
59
- * Sets the state of the plug.
60
- * @private
61
- * @param {number[]} reqByteArray - The request byte array.
62
- * @returns {Promise<boolean>} - Resolves with a boolean that tells whether the plug is ON (true) or OFF (false).
63
- */
64
- async setState(reqByteArray) {
65
- const base = [0x57, 0x0F, 0x50, 0x01];
66
- return this.operatePlug([...base, ...reqByteArray]);
67
- }
68
- /**
69
- * Turns on the plug.
70
- * @returns {Promise<boolean>} - Resolves with a boolean that tells whether the plug is ON (true) or OFF (false).
71
- */
72
- async turnOn() {
73
- return this.setState([0x01, 0x80]);
74
- }
75
- /**
76
- * Turns off the plug.
77
- * @returns {Promise<boolean>} - Resolves with a boolean that tells whether the plug is ON (true) or OFF (false).
78
- */
79
- async turnOff() {
80
- return this.setState([0x01, 0x00]);
81
- }
82
- /**
83
- * Toggles the state of the plug.
84
- * @returns {Promise<boolean>} - Resolves with a boolean that tells whether the plug is ON (true) or OFF (false).
85
- */
86
- async toggle() {
87
- return this.setState([0x02, 0x80]);
88
- }
89
- /**
90
- * Operates the plug with the given bytes.
91
- * @param {number[]} bytes - The byte array to send to the plug.
92
- * @returns {Promise<boolean>} - Resolves with a boolean that tells whether the plug is ON (true) or OFF (false).
93
- */
94
- async operatePlug(bytes) {
95
- const reqBuf = Buffer.from(bytes);
96
- const resBytes = await this.command(reqBuf);
97
- const resBuf = Buffer.from(resBytes);
98
- if (resBuf.length !== 2) {
99
- throw new Error(`Expecting a 2-byte response, got instead: 0x${resBuf.toString('hex')}`);
100
- }
101
- const code = resBuf.readUInt8(1);
102
- if (code === 0x00 || code === 0x80) {
103
- return code === 0x80;
104
- }
105
- else {
106
- throw new Error(`The device returned an error: 0x${resBuf.toString('hex')}`);
107
- }
108
- }
109
- }
110
- //# sourceMappingURL=woplugmini.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"woplugmini.js","sourceRoot":"","sources":["../../src/device/woplugmini.ts"],"names":[],"mappings":"AAOA,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GG;IACH,KAAK,CAAC,MAAM;QACV,OAAO,IAAI,CAAC,QAAQ,CAAC,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,CAAA;IACpC,CAAC;IAED;;;;OAIG;IACI,KAAK,CAAC,WAAW,CAAC,KAAe;QACtC,MAAM,MAAM,GAAG,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;QACjC,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAA;QAC3C,MAAM,MAAM,GAAG,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAA;QAEpC,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACxB,MAAM,IAAI,KAAK,CAAC,+CAA+C,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC,CAAA;QAC1F,CAAC;QAED,MAAM,IAAI,GAAG,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,CAAA;QAChC,IAAI,IAAI,KAAK,IAAI,IAAI,IAAI,KAAK,IAAI,EAAE,CAAC;YACnC,OAAO,IAAI,KAAK,IAAI,CAAA;QACtB,CAAC;aAAM,CAAC;YACN,MAAM,IAAI,KAAK,CAAC,mCAAmC,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC,CAAA;QAC9E,CAAC;IACH,CAAC;CACF"}
@@ -1,52 +0,0 @@
1
- import type { plugMiniJPServiceData } 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 WoPlugMini device.
7
- * @see https://github.com/OpenWonderLabs/SwitchBotAPI-BLE/blob/latest/devicetypes/plugmini.md
8
- */
9
- export declare class WoPlugMiniJP extends SwitchbotDevice {
10
- constructor(peripheral: NobleTypes['peripheral'], noble: NobleTypes['noble']);
11
- /**
12
- * Parses the service data for WoPlugMini JP.
13
- * @param {Buffer} manufacturerData - The manufacturer data buffer.
14
- * @param {Function} emitLog - The function to emit log messages.
15
- * @returns {Promise<plugMiniJPServiceData | null>} - Parsed service data or null if invalid.
16
- */
17
- static parseServiceData(manufacturerData: Buffer, emitLog: (level: string, message: string) => void): Promise<plugMiniJPServiceData | null>;
18
- /**
19
- * Reads the state of the plug.
20
- * @returns {Promise<boolean>} - Resolves with a boolean that tells whether the plug is ON (true) or OFF (false).
21
- */
22
- readState(): Promise<boolean>;
23
- /**
24
- * Sets the state of the plug.
25
- * @private
26
- * @param {number[]} reqByteArray - The request byte array.
27
- * @returns {Promise<boolean>} - Resolves with a boolean that tells whether the plug is ON (true) or OFF (false).
28
- */
29
- private setState;
30
- /**
31
- * Turns on the plug.
32
- * @returns {Promise<boolean>} - Resolves with a boolean that tells whether the plug is ON (true) or OFF (false).
33
- */
34
- turnOn(): Promise<boolean>;
35
- /**
36
- * Turns off the plug.
37
- * @returns {Promise<boolean>} - Resolves with a boolean that tells whether the plug is ON (true) or OFF (false).
38
- */
39
- turnOff(): Promise<boolean>;
40
- /**
41
- * Toggles the state of the plug.
42
- * @returns {Promise<boolean>} - Resolves with a boolean that tells whether the plug is ON (true) or OFF (false).
43
- */
44
- toggle(): Promise<boolean>;
45
- /**
46
- * Operates the plug with the given bytes.
47
- * @param {number[]} bytes - The byte array to send to the plug.
48
- * @returns {Promise<boolean>} - Resolves with a boolean that tells whether the plug is ON (true) or OFF (false).
49
- */
50
- operatePlug(bytes: number[]): Promise<boolean>;
51
- }
52
- //# sourceMappingURL=woplugmini_jp.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"woplugmini_jp.d.ts","sourceRoot":"","sources":["../../src/device/woplugmini_jp.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,6BAA6B,CAAA;AACxE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAA;AAEnD,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AAEpC,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AAG9C;;;GAGG;AACH,qBAAa,YAAa,SAAQ,eAAe;gBACnC,UAAU,EAAE,UAAU,CAAC,YAAY,CAAC,EAAE,KAAK,EAAE,UAAU,CAAC,OAAO,CAAC;IAI5E;;;;;OAKG;WACU,gBAAgB,CAC3B,gBAAgB,EAAE,MAAM,EACxB,OAAO,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,KAAK,IAAI,GAChD,OAAO,CAAC,qBAAqB,GAAG,IAAI,CAAC;IAsCxC;;;OAGG;IACG,SAAS,IAAI,OAAO,CAAC,OAAO,CAAC;IAInC;;;;;OAKG;YACW,QAAQ;IAKtB;;;OAGG;IACG,MAAM,IAAI,OAAO,CAAC,OAAO,CAAC;IAIhC;;;OAGG;IACG,OAAO,IAAI,OAAO,CAAC,OAAO,CAAC;IAIjC;;;OAGG;IACG,MAAM,IAAI,OAAO,CAAC,OAAO,CAAC;IAIhC;;;;OAIG;IACU,WAAW,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,OAAO,CAAC;CAgB5D"}
@@ -1,110 +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 WoPlugMini device.
6
- * @see https://github.com/OpenWonderLabs/SwitchBotAPI-BLE/blob/latest/devicetypes/plugmini.md
7
- */
8
- export class WoPlugMiniJP extends SwitchbotDevice {
9
- constructor(peripheral, noble) {
10
- super(peripheral, noble);
11
- }
12
- /**
13
- * Parses the service data for WoPlugMini JP.
14
- * @param {Buffer} manufacturerData - The manufacturer data buffer.
15
- * @param {Function} emitLog - The function to emit log messages.
16
- * @returns {Promise<plugMiniJPServiceData | null>} - Parsed service data or null if invalid.
17
- */
18
- static async parseServiceData(manufacturerData, emitLog) {
19
- if (manufacturerData.length !== 14) {
20
- emitLog('debugerror', `[parseServiceDataForWoPlugMiniJP] Buffer length ${manufacturerData.length} should be 14`);
21
- return null;
22
- }
23
- const [byte9, byte10, byte11, byte12, byte13] = [
24
- manufacturerData.readUInt8(9),
25
- manufacturerData.readUInt8(10),
26
- manufacturerData.readUInt8(11),
27
- manufacturerData.readUInt8(12),
28
- manufacturerData.readUInt8(13),
29
- ];
30
- const state = byte9 === 0x00 ? 'off' : byte9 === 0x80 ? 'on' : null;
31
- const delay = !!(byte10 & 0b00000001);
32
- const timer = !!(byte10 & 0b00000010);
33
- const syncUtcTime = !!(byte10 & 0b00000100);
34
- const wifiRssi = byte11;
35
- const overload = !!(byte12 & 0b10000000);
36
- const currentPower = (((byte12 & 0b01111111) << 8) + byte13) / 10; // in watt
37
- const data = {
38
- model: SwitchBotBLEModel.PlugMiniJP,
39
- modelName: SwitchBotBLEModelName.PlugMini,
40
- modelFriendlyName: SwitchBotBLEModelFriendlyName.PlugMini,
41
- state: state ?? 'unknown',
42
- delay,
43
- timer,
44
- syncUtcTime,
45
- wifiRssi,
46
- overload,
47
- currentPower,
48
- };
49
- return data;
50
- }
51
- /**
52
- * Reads the state of the plug.
53
- * @returns {Promise<boolean>} - Resolves with a boolean that tells whether the plug is ON (true) or OFF (false).
54
- */
55
- async readState() {
56
- return this.operatePlug([0x57, 0x0F, 0x51, 0x01]);
57
- }
58
- /**
59
- * Sets the state of the plug.
60
- * @private
61
- * @param {number[]} reqByteArray - The request byte array.
62
- * @returns {Promise<boolean>} - Resolves with a boolean that tells whether the plug is ON (true) or OFF (false).
63
- */
64
- async setState(reqByteArray) {
65
- const base = [0x57, 0x0F, 0x50, 0x01];
66
- return this.operatePlug([...base, ...reqByteArray]);
67
- }
68
- /**
69
- * Turns on the plug.
70
- * @returns {Promise<boolean>} - Resolves with a boolean that tells whether the plug is ON (true) or OFF (false).
71
- */
72
- async turnOn() {
73
- return this.setState([0x01, 0x80]);
74
- }
75
- /**
76
- * Turns off the plug.
77
- * @returns {Promise<boolean>} - Resolves with a boolean that tells whether the plug is ON (true) or OFF (false).
78
- */
79
- async turnOff() {
80
- return this.setState([0x01, 0x00]);
81
- }
82
- /**
83
- * Toggles the state of the plug.
84
- * @returns {Promise<boolean>} - Resolves with a boolean that tells whether the plug is ON (true) or OFF (false).
85
- */
86
- async toggle() {
87
- return this.setState([0x02, 0x80]);
88
- }
89
- /**
90
- * Operates the plug with the given bytes.
91
- * @param {number[]} bytes - The byte array to send to the plug.
92
- * @returns {Promise<boolean>} - Resolves with a boolean that tells whether the plug is ON (true) or OFF (false).
93
- */
94
- async operatePlug(bytes) {
95
- const reqBuf = Buffer.from(bytes);
96
- const resBytes = await this.command(reqBuf);
97
- const resBuf = Buffer.from(resBytes);
98
- if (resBuf.length !== 2) {
99
- throw new Error(`Expecting a 2-byte response, got instead: 0x${resBuf.toString('hex')}`);
100
- }
101
- const code = resBuf.readUInt8(1);
102
- if (code === 0x00 || code === 0x80) {
103
- return code === 0x80;
104
- }
105
- else {
106
- throw new Error(`The device returned an error: 0x${resBuf.toString('hex')}`);
107
- }
108
- }
109
- }
110
- //# sourceMappingURL=woplugmini_jp.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"woplugmini_jp.js","sourceRoot":"","sources":["../../src/device/woplugmini_jp.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,YAAa,SAAQ,eAAe;IAC/C,YAAY,UAAoC,EAAE,KAA0B;QAC1E,KAAK,CAAC,UAAU,EAAE,KAAK,CAAC,CAAA;IAC1B,CAAC;IAED;;;;;OAKG;IACH,MAAM,CAAC,KAAK,CAAC,gBAAgB,CAC3B,gBAAwB,EACxB,OAAiD;QAEj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,CAAC,EAAE,CAAC;YACxB,MAAM,IAAI,KAAK,CAAC,+CAA+C,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC,CAAA;QAC1F,CAAC;QAED,MAAM,IAAI,GAAG,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,CAAA;QAChC,IAAI,IAAI,KAAK,IAAI,IAAI,IAAI,KAAK,IAAI,EAAE,CAAC;YACnC,OAAO,IAAI,KAAK,IAAI,CAAA;QACtB,CAAC;aAAM,CAAC;YACN,MAAM,IAAI,KAAK,CAAC,mCAAmC,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC,CAAA;QAC9E,CAAC;IACH,CAAC;CACF"}
@@ -1,19 +0,0 @@
1
- import type { Buffer } from 'node:buffer';
2
- import type { motionSensorServiceData } from '../types/bledevicestatus.js';
3
- import type { NobleTypes } from '../types/types.js';
4
- import { SwitchbotDevice } from '../device.js';
5
- /**
6
- * Class representing a WoPresence device.
7
- * @see https://github.com/OpenWonderLabs/SwitchBotAPI-BLE/blob/latest/devicetypes/meter.md
8
- */
9
- export declare class WoPresence extends SwitchbotDevice {
10
- /**
11
- * Parses the service data for WoPresence.
12
- * @param {Buffer} serviceData - The service data buffer.
13
- * @param {Function} emitLog - The function to emit log messages.
14
- * @returns {Promise<motionSensorServiceData | null>} - Parsed service data or null if invalid.
15
- */
16
- static parseServiceData(serviceData: Buffer, emitLog: (level: string, message: string) => void): Promise<motionSensorServiceData | null>;
17
- constructor(peripheral: NobleTypes['peripheral'], noble: NobleTypes['noble']);
18
- }
19
- //# sourceMappingURL=wopresence.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"wopresence.d.ts","sourceRoot":"","sources":["../../src/device/wopresence.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AAEzC,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,6BAA6B,CAAA;AAC1E,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAA;AAEnD,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AAG9C;;;GAGG;AACH,qBAAa,UAAW,SAAQ,eAAe;IAC7C;;;;;OAKG;WACU,gBAAgB,CAC3B,WAAW,EAAE,MAAM,EACnB,OAAO,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,KAAK,IAAI,GAChD,OAAO,CAAC,uBAAuB,GAAG,IAAI,CAAC;gBAyB9B,UAAU,EAAE,UAAU,CAAC,YAAY,CAAC,EAAE,KAAK,EAAE,UAAU,CAAC,OAAO,CAAC;CAG7E"}
@@ -1,39 +0,0 @@
1
- import { SwitchbotDevice } from '../device.js';
2
- import { SwitchBotBLEModel, SwitchBotBLEModelFriendlyName, SwitchBotBLEModelName } from '../types/types.js';
3
- /**
4
- * Class representing a WoPresence device.
5
- * @see https://github.com/OpenWonderLabs/SwitchBotAPI-BLE/blob/latest/devicetypes/meter.md
6
- */
7
- export class WoPresence extends SwitchbotDevice {
8
- /**
9
- * Parses the service data for WoPresence.
10
- * @param {Buffer} serviceData - The service data buffer.
11
- * @param {Function} emitLog - The function to emit log messages.
12
- * @returns {Promise<motionSensorServiceData | null>} - Parsed service data or null if invalid.
13
- */
14
- static async parseServiceData(serviceData, emitLog) {
15
- if (serviceData.length !== 6) {
16
- emitLog('debugerror', `[parseServiceDataForWoPresence] Buffer length ${serviceData.length} !== 6!`);
17
- return null;
18
- }
19
- const [byte1, byte2, , , , byte5] = serviceData;
20
- const data = {
21
- model: SwitchBotBLEModel.MotionSensor,
22
- modelName: SwitchBotBLEModelName.MotionSensor,
23
- modelFriendlyName: SwitchBotBLEModelFriendlyName.MotionSensor,
24
- tested: !!(byte1 & 0b10000000),
25
- movement: !!(byte1 & 0b01000000),
26
- battery: byte2 & 0b01111111,
27
- led: (byte5 & 0b00100000) >> 5,
28
- iot: (byte5 & 0b00010000) >> 4,
29
- sense_distance: (byte5 & 0b00001100) >> 2,
30
- lightLevel: (byte5 & 0b00000011) === 1 ? 'dark' : (byte5 & 0b00000011) === 2 ? 'bright' : 'unknown',
31
- is_light: !!(byte5 & 0b00000010),
32
- };
33
- return data;
34
- }
35
- constructor(peripheral, noble) {
36
- super(peripheral, noble);
37
- }
38
- }
39
- //# sourceMappingURL=wopresence.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"wopresence.js","sourceRoot":"","sources":["../../src/device/wopresence.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AAC9C,OAAO,EAAE,iBAAiB,EAAE,6BAA6B,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAA;AAE3G;;;GAGG;AACH,MAAM,OAAO,UAAW,SAAQ,eAAe;IAC7C;;;;;OAKG;IACH,MAAM,CAAC,KAAK,CAAC,gBAAgB,CAC3B,WAAmB,EACnB,OAAiD;QAEjD,IAAI,WAAW,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YAC7B,OAAO,CAAC,YAAY,EAAE,iDAAiD,WAAW,CAAC,MAAM,SAAS,CAAC,CAAA;YACnG,OAAO,IAAI,CAAA;QACb,CAAC;QAED,MAAM,CAAC,KAAK,EAAE,KAAK,EAAE,AAAD,EAAG,AAAD,EAAG,AAAD,EAAG,KAAK,CAAC,GAAG,WAAW,CAAA;QAE/C,MAAM,IAAI,GAA4B;YACpC,KAAK,EAAE,iBAAiB,CAAC,YAAY;YACrC,SAAS,EAAE,qBAAqB,CAAC,YAAY;YAC7C,iBAAiB,EAAE,6BAA6B,CAAC,YAAY;YAC7D,MAAM,EAAE,CAAC,CAAC,CAAC,KAAK,GAAG,UAAU,CAAC;YAC9B,QAAQ,EAAE,CAAC,CAAC,CAAC,KAAK,GAAG,UAAU,CAAC;YAChC,OAAO,EAAE,KAAK,GAAG,UAAU;YAC3B,GAAG,EAAE,CAAC,KAAK,GAAG,UAAU,CAAC,IAAI,CAAC;YAC9B,GAAG,EAAE,CAAC,KAAK,GAAG,UAAU,CAAC,IAAI,CAAC;YAC9B,cAAc,EAAE,CAAC,KAAK,GAAG,UAAU,CAAC,IAAI,CAAC;YACzC,UAAU,EAAE,CAAC,KAAK,GAAG,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,KAAK,GAAG,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS;YACnG,QAAQ,EAAE,CAAC,CAAC,CAAC,KAAK,GAAG,UAAU,CAAC;SACjC,CAAA;QAED,OAAO,IAAI,CAAA;IACb,CAAC;IAED,YAAY,UAAoC,EAAE,KAA0B;QAC1E,KAAK,CAAC,UAAU,EAAE,KAAK,CAAC,CAAA;IAC1B,CAAC;CACF"}
@@ -1,36 +0,0 @@
1
- import type { relaySwitch1PlusServiceData } 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 WoRelaySwitch1Plus device.
7
- * @see https://github.com/OpenWonderLabs/SwitchBotAPI-BLE/
8
- */
9
- export declare class WoRelaySwitch1Plus extends SwitchbotDevice {
10
- private _iv;
11
- private _cipher;
12
- private _keyId;
13
- private _encryptionKey;
14
- constructor(peripheral: NobleTypes['peripheral'], noble: NobleTypes['noble']);
15
- /**
16
- * Parses the service data for WoRelaySwitch1Plus.
17
- * @param {Buffer} serviceData - The service data buffer.
18
- * @param {Buffer} manufacturerData - The manufacturer data buffer.
19
- * @param {Function} emitLog - The function to emit log messages.
20
- * @returns {Promise<relaySwitch1PlusServiceData | null>} - Parsed service data or null if invalid.
21
- */
22
- static parseServiceData(serviceData: Buffer, manufacturerData: Buffer, emitLog: (level: string, message: string) => void): Promise<relaySwitch1PlusServiceData | null>;
23
- turnOn(): Promise<boolean>;
24
- turnOff(): Promise<boolean>;
25
- toggle(): Promise<boolean>;
26
- getVoltageAndCurrent(): Promise<{
27
- voltage: number;
28
- current: number;
29
- } | null>;
30
- private _sendCommand;
31
- private _ensureEncryptionInitialized;
32
- private _getCipher;
33
- private _encrypt;
34
- private _decrypt;
35
- }
36
- //# sourceMappingURL=worelayswitch1plus.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"worelayswitch1plus.d.ts","sourceRoot":"","sources":["../../src/device/worelayswitch1plus.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,6BAA6B,CAAA;AAC9E,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAA;AAEnD,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AAGpC,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AAW9C;;;GAGG;AACH,qBAAa,kBAAmB,SAAQ,eAAe;IACrD,OAAO,CAAC,GAAG,CAAsB;IACjC,OAAO,CAAC,OAAO,CAAsB;IACrC,OAAO,CAAC,MAAM,CAAQ;IACtB,OAAO,CAAC,cAAc,CAAQ;gBAElB,UAAU,EAAE,UAAU,CAAC,YAAY,CAAC,EAAE,KAAK,EAAE,UAAU,CAAC,OAAO,CAAC;IAkB5E;;;;;;OAMG;WACU,gBAAgB,CAC3B,WAAW,EAAE,MAAM,EACnB,gBAAgB,EAAE,MAAM,EACxB,OAAO,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,KAAK,IAAI,GAChD,OAAO,CAAC,2BAA2B,GAAG,IAAI,CAAC;IAkBxC,MAAM,IAAI,OAAO,CAAC,OAAO,CAAC;IAU1B,OAAO,IAAI,OAAO,CAAC,OAAO,CAAC;IAU3B,MAAM,IAAI,OAAO,CAAC,OAAO,CAAC;IAK1B,oBAAoB,IAAI,OAAO,CAAC;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC;YAYpE,YAAY;YAeZ,4BAA4B;IAa1C,OAAO,CAAC,UAAU;IAOlB,OAAO,CAAC,QAAQ;IAShB,OAAO,CAAC,QAAQ;CAQjB"}