node-switchbot 2.5.0-beta.3 → 2.5.0-beta.31
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.
- package/.github/workflows/beta-release.yml +25 -2
- package/.github/workflows/release.yml +13 -0
- package/BLE.md +1109 -0
- package/CHANGELOG.md +14 -0
- package/OpenAPI.md +172 -0
- package/README.md +20 -1189
- package/branding/Node_x_SwitchBot.svg +9 -0
- package/branding/icon.png +0 -0
- package/branding/switchbot.png +0 -0
- package/dist/advertising.d.ts +32 -21
- package/dist/advertising.d.ts.map +1 -1
- package/dist/advertising.js +72 -76
- package/dist/advertising.js.map +1 -1
- package/dist/device/woblindtilt.d.ts +21 -51
- package/dist/device/woblindtilt.d.ts.map +1 -1
- package/dist/device/woblindtilt.js +40 -103
- package/dist/device/woblindtilt.js.map +1 -1
- package/dist/device/wobulb.d.ts +42 -15
- package/dist/device/wobulb.d.ts.map +1 -1
- package/dist/device/wobulb.js +71 -131
- package/dist/device/wobulb.js.map +1 -1
- package/dist/device/woceilinglight.d.ts +47 -21
- package/dist/device/woceilinglight.d.ts.map +1 -1
- package/dist/device/woceilinglight.js +94 -174
- package/dist/device/woceilinglight.js.map +1 -1
- package/dist/device/wocontact.d.ts +12 -1
- package/dist/device/wocontact.d.ts.map +1 -1
- package/dist/device/wocontact.js +23 -22
- package/dist/device/wocontact.js.map +1 -1
- package/dist/device/wocurtain.d.ts +40 -1
- package/dist/device/wocurtain.d.ts.map +1 -1
- package/dist/device/wocurtain.js +68 -106
- package/dist/device/wocurtain.js.map +1 -1
- package/dist/device/wohand.d.ts +38 -2
- package/dist/device/wohand.d.ts.map +1 -1
- package/dist/device/wohand.js +54 -92
- package/dist/device/wohand.js.map +1 -1
- package/dist/device/wohub2.d.ts +12 -1
- package/dist/device/wohub2.d.ts.map +1 -1
- package/dist/device/wohub2.js +21 -29
- package/dist/device/wohub2.js.map +1 -1
- package/dist/device/wohumi.d.ts +38 -2
- package/dist/device/wohumi.d.ts.map +1 -1
- package/dist/device/wohumi.js +51 -86
- package/dist/device/wohumi.js.map +1 -1
- package/dist/device/woiosensorth.d.ts +13 -1
- package/dist/device/woiosensorth.d.ts.map +1 -1
- package/dist/device/woiosensorth.js +25 -29
- package/dist/device/woiosensorth.js.map +1 -1
- package/dist/device/woplugmini.d.ts +44 -12
- package/dist/device/woplugmini.d.ts.map +1 -1
- package/dist/device/woplugmini.js +68 -80
- package/dist/device/woplugmini.js.map +1 -1
- package/dist/device/wopresence.d.ts +12 -1
- package/dist/device/wopresence.d.ts.map +1 -1
- package/dist/device/wopresence.js +21 -27
- package/dist/device/wopresence.js.map +1 -1
- package/dist/device/wosensorth.d.ts +18 -2
- package/dist/device/wosensorth.d.ts.map +1 -1
- package/dist/device/wosensorth.js +33 -50
- package/dist/device/wosensorth.js.map +1 -1
- package/dist/device/wosmartlock.d.ts +58 -13
- package/dist/device/wosmartlock.d.ts.map +1 -1
- package/dist/device/wosmartlock.js +108 -195
- package/dist/device/wosmartlock.js.map +1 -1
- package/dist/device/wosmartlockpro.d.ts +63 -18
- package/dist/device/wosmartlockpro.d.ts.map +1 -1
- package/dist/device/wosmartlockpro.js +116 -204
- package/dist/device/wosmartlockpro.js.map +1 -1
- package/dist/device/wostrip.d.ts +38 -18
- package/dist/device/wostrip.d.ts.map +1 -1
- package/dist/device/wostrip.js +79 -125
- package/dist/device/wostrip.js.map +1 -1
- package/dist/device.d.ts +85 -222
- package/dist/device.d.ts.map +1 -1
- package/dist/device.js +123 -407
- package/dist/device.js.map +1 -1
- package/dist/index.d.ts +9 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +9 -1
- package/dist/index.js.map +1 -1
- package/dist/parameter-checker.d.ts +79 -19
- package/dist/parameter-checker.d.ts.map +1 -1
- package/dist/parameter-checker.js +140 -335
- package/dist/parameter-checker.js.map +1 -1
- package/dist/settings.d.ts +46 -0
- package/dist/settings.d.ts.map +1 -1
- package/dist/settings.js +46 -2
- package/dist/settings.js.map +1 -1
- package/dist/{switchbot.d.ts → switchbot-ble.d.ts} +14 -8
- package/dist/switchbot-ble.d.ts.map +1 -0
- package/dist/switchbot-ble.js +428 -0
- package/dist/switchbot-ble.js.map +1 -0
- package/dist/switchbot-openapi.d.ts +131 -0
- package/dist/switchbot-openapi.d.ts.map +1 -0
- package/dist/switchbot-openapi.js +311 -0
- package/dist/switchbot-openapi.js.map +1 -0
- package/dist/test/advertising.test.d.ts +2 -0
- package/dist/test/advertising.test.d.ts.map +1 -0
- package/dist/test/advertising.test.js +96 -0
- package/dist/test/advertising.test.js.map +1 -0
- package/dist/test/device.test.d.ts +2 -0
- package/dist/test/device.test.d.ts.map +1 -0
- package/dist/test/device.test.js +38 -0
- package/dist/test/device.test.js.map +1 -0
- package/dist/test/index.test.d.ts +2 -0
- package/dist/test/index.test.d.ts.map +1 -0
- package/dist/test/index.test.js +35 -0
- package/dist/test/index.test.js.map +1 -0
- package/dist/test/parameter-checker.test.d.ts +2 -0
- package/dist/test/parameter-checker.test.d.ts.map +1 -0
- package/dist/test/parameter-checker.test.js +108 -0
- package/dist/test/parameter-checker.test.js.map +1 -0
- package/dist/test/settings.test.d.ts +2 -0
- package/dist/test/settings.test.d.ts.map +1 -0
- package/dist/test/settings.test.js +49 -0
- package/dist/test/settings.test.js.map +1 -0
- package/dist/test/switchbot-openapi.test.d.ts +2 -0
- package/dist/test/switchbot-openapi.test.d.ts.map +1 -0
- package/dist/test/switchbot-openapi.test.js +96 -0
- package/dist/test/switchbot-openapi.test.js.map +1 -0
- package/dist/test/switchbot.test.d.ts +2 -0
- package/dist/test/switchbot.test.d.ts.map +1 -0
- package/dist/test/switchbot.test.js +106 -0
- package/dist/test/switchbot.test.js.map +1 -0
- package/dist/test/woblindtilt.test.d.ts.map +1 -0
- package/dist/test/woblindtilt.test.js +2 -0
- package/dist/test/woblindtilt.test.js.map +1 -0
- package/dist/{device → test}/wobulb.test.d.ts.map +1 -1
- package/dist/test/wobulb.test.js +2 -0
- package/dist/test/wobulb.test.js.map +1 -0
- package/dist/test/woceilinglight.test.d.ts.map +1 -0
- package/dist/test/woceilinglight.test.js +2 -0
- package/dist/test/woceilinglight.test.js.map +1 -0
- package/dist/test/wocontact.test.d.ts.map +1 -0
- package/dist/test/wocontact.test.js +2 -0
- package/dist/test/wocontact.test.js.map +1 -0
- package/dist/test/wocurtain.test.d.ts.map +1 -0
- package/dist/test/wocurtain.test.js +2 -0
- package/dist/test/wocurtain.test.js.map +1 -0
- package/dist/{device → test}/wohand.test.d.ts.map +1 -1
- package/dist/test/wohand.test.js +2 -0
- package/dist/test/wohand.test.js.map +1 -0
- package/dist/test/wohub2.test.d.ts +2 -0
- package/dist/test/wohub2.test.d.ts.map +1 -0
- package/dist/test/wohub2.test.js +2 -0
- package/dist/test/wohub2.test.js.map +1 -0
- package/dist/{device → test}/wohumi.test.d.ts.map +1 -1
- package/dist/test/wohumi.test.js +2 -0
- package/dist/test/wohumi.test.js.map +1 -0
- package/dist/test/woiosensorth.test.d.ts.map +1 -0
- package/dist/test/woiosensorth.test.js +2 -0
- package/dist/test/woiosensorth.test.js.map +1 -0
- package/dist/test/woplugmini.test.d.ts.map +1 -0
- package/dist/test/woplugmini.test.js +2 -0
- package/dist/test/woplugmini.test.js.map +1 -0
- package/dist/test/wopresence.test.d.ts.map +1 -0
- package/dist/test/wopresence.test.js +2 -0
- package/dist/test/wopresence.test.js.map +1 -0
- package/dist/test/wosensorth.test.d.ts.map +1 -0
- package/dist/test/wosensorth.test.js +2 -0
- package/dist/test/wosensorth.test.js.map +1 -0
- package/dist/test/wosmartlock.test.d.ts.map +1 -0
- package/dist/test/wosmartlock.test.js +2 -0
- package/dist/test/wosmartlock.test.js.map +1 -0
- package/dist/test/wosmartlockpro.test.d.ts.map +1 -0
- package/dist/test/wosmartlockpro.test.js +2 -0
- package/dist/test/wosmartlockpro.test.js.map +1 -0
- package/dist/{device → test}/wostrip.test.d.ts.map +1 -1
- package/dist/test/wostrip.test.js +2 -0
- package/dist/test/wostrip.test.js.map +1 -0
- package/dist/types/bledevicestatus.d.ts +4 -12
- package/dist/types/bledevicestatus.d.ts.map +1 -1
- package/dist/types/devicelist.d.ts.map +1 -1
- package/dist/types/devicelist.js +0 -4
- package/dist/types/devicelist.js.map +1 -1
- package/dist/types/devicepush.d.ts +13 -0
- package/dist/types/devicepush.d.ts.map +1 -0
- package/dist/types/devicepush.js +2 -0
- package/dist/types/devicepush.js.map +1 -0
- package/dist/types/deviceresponse.d.ts +2 -3
- package/dist/types/deviceresponse.d.ts.map +1 -1
- package/dist/types/devicestatus.d.ts.map +1 -1
- package/dist/types/devicewebhookstatus.d.ts +32 -0
- package/dist/types/devicewebhookstatus.d.ts.map +1 -1
- package/dist/types/irdevicelist.d.ts.map +1 -1
- package/dist/types/types.d.ts +61 -120
- package/dist/types/types.d.ts.map +1 -1
- package/dist/types/types.js +10 -0
- package/dist/types/types.js.map +1 -1
- package/docs/assets/highlight.css +12 -47
- package/docs/assets/main.js +1 -1
- package/docs/assets/navigation.js +1 -1
- package/docs/assets/search.js +1 -1
- package/docs/classes/SwitchBotBLE.html +61 -0
- package/docs/classes/SwitchBotOpenAPI.html +47 -0
- package/docs/classes/SwitchbotDevice.html +28 -33
- package/docs/enums/LogLevel.html +6 -0
- package/docs/enums/SwitchBotBLEModel.html +2 -2
- package/docs/enums/SwitchBotBLEModelFriendlyName.html +2 -2
- package/docs/enums/SwitchBotBLEModelName.html +2 -2
- package/docs/enums/SwitchBotModel.html +2 -2
- package/docs/hierarchy.html +1 -0
- package/docs/index.html +16 -993
- package/docs/interfaces/Ad-1.html +5 -0
- package/docs/interfaces/AdvertisementData.html +3 -0
- package/docs/interfaces/Chars.html +4 -0
- package/docs/interfaces/ErrorObject.html +3 -0
- package/docs/interfaces/Params.html +6 -0
- package/docs/interfaces/ServiceData.html +2 -0
- package/docs/interfaces/SwitchBotBLEDevice.html +21 -0
- package/docs/interfaces/WebhookDetail.html +6 -0
- package/docs/interfaces/ad.html +5 -0
- package/docs/interfaces/body.html +3 -0
- package/docs/interfaces/bodyChange.html +4 -0
- package/docs/interfaces/deleteWebhookResponse.html +4 -0
- package/docs/interfaces/device.html +7 -0
- package/docs/interfaces/deviceList.html +2 -0
- package/docs/interfaces/deviceStatus.html +7 -0
- package/docs/interfaces/deviceStatusRequest.html +4 -0
- package/docs/interfaces/deviceWebhook.html +4 -0
- package/docs/interfaces/deviceWebhookContext.html +4 -0
- package/docs/interfaces/devices.html +4 -0
- package/docs/interfaces/infraredRemoteList.html +2 -0
- package/docs/interfaces/irdevice.html +5 -0
- package/docs/interfaces/pushResponse.html +4 -0
- package/docs/interfaces/queryWebhookResponse.html +4 -0
- package/docs/interfaces/setupWebhookResponse.html +4 -0
- package/docs/interfaces/switchbot.html +3 -0
- package/docs/interfaces/updateWebhookResponse.html +4 -0
- package/docs/interfaces/webhookRequest.html +4 -0
- package/docs/media/BLE.md +1109 -0
- package/docs/media/OpenAPI.md +172 -0
- package/docs/modules.html +136 -3
- package/docs/types/MacAddress.html +1 -0
- package/docs/types/batteryCirculatorFan.html +1 -0
- package/docs/types/batteryCirculatorFanServiceData.html +1 -0
- package/docs/types/batteryCirculatorFanStatus.html +1 -0
- package/docs/types/batteryCirculatorFanWebhookContext.html +1 -0
- package/docs/types/blindTilt.html +1 -0
- package/docs/types/blindTiltServiceData.html +1 -0
- package/docs/types/blindTiltStatus.html +1 -0
- package/docs/types/blindTiltWebhookContext.html +1 -0
- package/docs/types/bot.html +1 -0
- package/docs/types/botServiceData.html +1 -0
- package/docs/types/botStatus.html +1 -0
- package/docs/types/botWebhookContext.html +1 -0
- package/docs/types/ceilingLight.html +1 -0
- package/docs/types/ceilingLightPro.html +1 -0
- package/docs/types/ceilingLightProServiceData.html +1 -0
- package/docs/types/ceilingLightProStatus.html +1 -0
- package/docs/types/ceilingLightProWebhookContext.html +1 -0
- package/docs/types/ceilingLightServiceData.html +1 -0
- package/docs/types/ceilingLightStatus.html +1 -0
- package/docs/types/ceilingLightWebhookContext.html +1 -0
- package/docs/types/colorBulb.html +1 -0
- package/docs/types/colorBulbServiceData.html +1 -0
- package/docs/types/colorBulbStatus.html +1 -0
- package/docs/types/colorBulbWebhookContext.html +1 -0
- package/docs/types/contactSensor.html +1 -0
- package/docs/types/contactSensorServiceData.html +1 -0
- package/docs/types/contactSensorStatus.html +1 -0
- package/docs/types/contactSensorWebhookContext.html +1 -0
- package/docs/types/curtain.html +1 -0
- package/docs/types/curtain3.html +1 -0
- package/docs/types/curtain3ServiceData.html +1 -0
- package/docs/types/curtain3WebhookContext.html +1 -0
- package/docs/types/curtainServiceData.html +1 -0
- package/docs/types/curtainStatus.html +1 -0
- package/docs/types/curtainWebhookContext.html +1 -0
- package/docs/types/floorCleaningRobotS10.html +1 -0
- package/docs/types/floorCleaningRobotS10Status.html +1 -0
- package/docs/types/floorCleaningRobotS10WebhookContext.html +1 -0
- package/docs/types/hub2.html +1 -0
- package/docs/types/hub2ServiceData.html +1 -0
- package/docs/types/hub2Status.html +1 -0
- package/docs/types/hub2WebhookContext.html +1 -0
- package/docs/types/humidifier.html +1 -0
- package/docs/types/humidifierServiceData.html +1 -0
- package/docs/types/humidifierStatus.html +1 -0
- package/docs/types/humidifierWebhookContext.html +1 -0
- package/docs/types/indoorCam.html +1 -0
- package/docs/types/indoorCameraWebhookContext.html +1 -0
- package/docs/types/keypad.html +1 -0
- package/docs/types/keypadTouch.html +1 -0
- package/docs/types/keypadTouchWebhookContext.html +1 -0
- package/docs/types/keypadWebhookContext.html +1 -0
- package/docs/types/lock.html +1 -0
- package/docs/types/lockPro.html +1 -0
- package/docs/types/lockProServiceData.html +1 -0
- package/docs/types/lockProStatus.html +1 -0
- package/docs/types/lockProWebhookContext.html +1 -0
- package/docs/types/lockServiceData.html +1 -0
- package/docs/types/lockStatus.html +1 -0
- package/docs/types/lockWebhookContext.html +1 -0
- package/docs/types/meter.html +1 -0
- package/docs/types/meterPlus.html +1 -0
- package/docs/types/meterPlusServiceData.html +1 -0
- package/docs/types/meterPlusStatus.html +1 -0
- package/docs/types/meterPlusWebhookContext.html +1 -0
- package/docs/types/meterServiceData.html +1 -0
- package/docs/types/meterStatus.html +1 -0
- package/docs/types/meterWebhookContext.html +1 -0
- package/docs/types/motionSensor.html +1 -0
- package/docs/types/motionSensorServiceData.html +1 -0
- package/docs/types/motionSensorStatus.html +1 -0
- package/docs/types/motionSensorWebhookContext.html +1 -0
- package/docs/types/outdoorMeter.html +1 -0
- package/docs/types/outdoorMeterServiceData.html +1 -0
- package/docs/types/outdoorMeterStatus.html +1 -0
- package/docs/types/outdoorMeterWebhookContext.html +1 -0
- package/docs/types/panTiltCamWebhookContext.html +1 -0
- package/docs/types/pantiltCam.html +1 -0
- package/docs/types/pantiltCam2k.html +1 -0
- package/docs/types/plug.html +1 -0
- package/docs/types/plugMini.html +1 -0
- package/docs/types/plugMiniJPServiceData.html +1 -0
- package/docs/types/plugMiniJPWebhookContext.html +1 -0
- package/docs/types/plugMiniStatus.html +1 -0
- package/docs/types/plugMiniUSServiceData.html +1 -0
- package/docs/types/plugMiniUSWebhookContext.html +1 -0
- package/docs/types/plugStatus.html +1 -0
- package/docs/types/plugWebhookContext.html +1 -0
- package/docs/types/remote.html +1 -0
- package/docs/types/robotVacuumCleanerS1.html +1 -0
- package/docs/types/robotVacuumCleanerS1Plus.html +1 -0
- package/docs/types/robotVacuumCleanerS1PlusStatus.html +1 -0
- package/docs/types/robotVacuumCleanerS1PlusWebhookContext.html +1 -0
- package/docs/types/robotVacuumCleanerS1Status.html +1 -0
- package/docs/types/robotVacuumCleanerS1WebhookContext.html +1 -0
- package/docs/types/robotVacuumCleanerServiceData.html +1 -0
- package/docs/types/stripLight.html +1 -0
- package/docs/types/stripLightServiceData.html +1 -0
- package/docs/types/stripLightStatus.html +1 -0
- package/docs/types/stripLightWebhookContext.html +1 -0
- package/docs/types/waterLeakDetector.html +1 -0
- package/docs/types/waterLeakDetectorServiceData.html +1 -0
- package/docs/types/waterLeakDetectorStatus.html +1 -0
- package/docs/types/waterLeakDetectorWebhookContext.html +1 -0
- package/package.json +12 -10
- package/dist/device/woblindtilt.test.d.ts.map +0 -1
- package/dist/device/woblindtilt.test.js +0 -26
- package/dist/device/woblindtilt.test.js.map +0 -1
- package/dist/device/wobulb.test.js +0 -52
- package/dist/device/wobulb.test.js.map +0 -1
- package/dist/device/woceilinglight.test.d.ts.map +0 -1
- package/dist/device/woceilinglight.test.js +0 -63
- package/dist/device/woceilinglight.test.js.map +0 -1
- package/dist/device/wocontact.test.d.ts.map +0 -1
- package/dist/device/wocontact.test.js +0 -34
- package/dist/device/wocontact.test.js.map +0 -1
- package/dist/device/wocurtain.test.d.ts.map +0 -1
- package/dist/device/wocurtain.test.js +0 -33
- package/dist/device/wocurtain.test.js.map +0 -1
- package/dist/device/wohand.test.js +0 -62
- package/dist/device/wohand.test.js.map +0 -1
- package/dist/device/wohand2.test.d.ts +0 -2
- package/dist/device/wohand2.test.d.ts.map +0 -1
- package/dist/device/wohand2.test.js +0 -50
- package/dist/device/wohand2.test.js.map +0 -1
- package/dist/device/wohumi.test.js +0 -61
- package/dist/device/wohumi.test.js.map +0 -1
- package/dist/device/woiosensorth.test.d.ts.map +0 -1
- package/dist/device/woiosensorth.test.js +0 -39
- package/dist/device/woiosensorth.test.js.map +0 -1
- package/dist/device/woplugmini.test.d.ts.map +0 -1
- package/dist/device/woplugmini.test.js +0 -91
- package/dist/device/woplugmini.test.js.map +0 -1
- package/dist/device/wopresence.test.d.ts.map +0 -1
- package/dist/device/wopresence.test.js +0 -42
- package/dist/device/wopresence.test.js.map +0 -1
- package/dist/device/wosensorth.test.d.ts.map +0 -1
- package/dist/device/wosensorth.test.js +0 -59
- package/dist/device/wosensorth.test.js.map +0 -1
- package/dist/device/wosmartlock.test.d.ts.map +0 -1
- package/dist/device/wosmartlock.test.js +0 -84
- package/dist/device/wosmartlock.test.js.map +0 -1
- package/dist/device/wosmartlockpro.test.d.ts.map +0 -1
- package/dist/device/wosmartlockpro.test.js +0 -124
- package/dist/device/wosmartlockpro.test.js.map +0 -1
- package/dist/device/wostrip.test.js +0 -115
- package/dist/device/wostrip.test.js.map +0 -1
- package/dist/switchbot.d.ts.map +0 -1
- package/dist/switchbot.js +0 -259
- package/dist/switchbot.js.map +0 -1
- package/dist/types/pushbody.d.ts +0 -6
- package/dist/types/pushbody.d.ts.map +0 -1
- package/dist/types/pushbody.js +0 -2
- package/dist/types/pushbody.js.map +0 -1
- package/docs/classes/SwitchBot.html +0 -16
- package/docs/types/SwitchBotBLEDevice.html +0 -1
- /package/dist/{device → test}/woblindtilt.test.d.ts +0 -0
- /package/dist/{device → test}/wobulb.test.d.ts +0 -0
- /package/dist/{device → test}/woceilinglight.test.d.ts +0 -0
- /package/dist/{device → test}/wocontact.test.d.ts +0 -0
- /package/dist/{device → test}/wocurtain.test.d.ts +0 -0
- /package/dist/{device → test}/wohand.test.d.ts +0 -0
- /package/dist/{device → test}/wohumi.test.d.ts +0 -0
- /package/dist/{device → test}/woiosensorth.test.d.ts +0 -0
- /package/dist/{device → test}/woplugmini.test.d.ts +0 -0
- /package/dist/{device → test}/wopresence.test.d.ts +0 -0
- /package/dist/{device → test}/wosensorth.test.d.ts +0 -0
- /package/dist/{device → test}/wosmartlock.test.d.ts +0 -0
- /package/dist/{device → test}/wosmartlockpro.test.d.ts +0 -0
- /package/dist/{device → test}/wostrip.test.d.ts +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wohub2.js","sourceRoot":"","sources":["../../src/device/wohub2.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"wohub2.js","sourceRoot":"","sources":["../../src/device/wohub2.ts"],"names":[],"mappings":"AAQA,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,MAAM,CAAC,YAAY,CAAc;I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
CHANGED
|
@@ -1,12 +1,48 @@
|
|
|
1
|
+
import type { SwitchBotBLE } from '../switchbot-ble.js';
|
|
1
2
|
import { Buffer } from 'node:buffer';
|
|
2
3
|
import { SwitchbotDevice } from '../device.js';
|
|
4
|
+
/**
|
|
5
|
+
* Class representing a WoHumi device.
|
|
6
|
+
* @see https://github.com/OpenWonderLabs/SwitchBotAPI-BLE/tree/latest/devicetypes
|
|
7
|
+
*/
|
|
3
8
|
export declare class WoHumi extends SwitchbotDevice {
|
|
4
|
-
static
|
|
9
|
+
static switchBotBLE: SwitchBotBLE;
|
|
10
|
+
/**
|
|
11
|
+
* Parses the service data for WoHumi.
|
|
12
|
+
* @param {Buffer} serviceData - The service data buffer.
|
|
13
|
+
* @returns {Promise<object | null>} - Parsed service data or null if invalid.
|
|
14
|
+
*/
|
|
15
|
+
static parseServiceData(serviceData: Buffer): Promise<object | null>;
|
|
16
|
+
/**
|
|
17
|
+
* Sends a command to the humidifier.
|
|
18
|
+
* @param {number[]} bytes - The command bytes.
|
|
19
|
+
* @returns {Promise<void>}
|
|
20
|
+
*/
|
|
21
|
+
operateHumi(bytes: number[]): Promise<void>;
|
|
22
|
+
/**
|
|
23
|
+
* Presses the humidifier button.
|
|
24
|
+
* @returns {Promise<void>}
|
|
25
|
+
*/
|
|
5
26
|
press(): Promise<void>;
|
|
27
|
+
/**
|
|
28
|
+
* Turns on the humidifier.
|
|
29
|
+
* @returns {Promise<void>}
|
|
30
|
+
*/
|
|
6
31
|
turnOn(): Promise<void>;
|
|
32
|
+
/**
|
|
33
|
+
* Turns off the humidifier.
|
|
34
|
+
* @returns {Promise<void>}
|
|
35
|
+
*/
|
|
7
36
|
turnOff(): Promise<void>;
|
|
37
|
+
/**
|
|
38
|
+
* Decreases the humidifier setting.
|
|
39
|
+
* @returns {Promise<void>}
|
|
40
|
+
*/
|
|
8
41
|
down(): Promise<void>;
|
|
42
|
+
/**
|
|
43
|
+
* Increases the humidifier setting.
|
|
44
|
+
* @returns {Promise<void>}
|
|
45
|
+
*/
|
|
9
46
|
up(): Promise<void>;
|
|
10
|
-
operateHumi(bytes: number[]): Promise<void>;
|
|
11
47
|
}
|
|
12
48
|
//# sourceMappingURL=wohumi.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wohumi.d.ts","sourceRoot":"","sources":["../../src/device/wohumi.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"wohumi.d.ts","sourceRoot":"","sources":["../../src/device/wohumi.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA;AAEvD,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AAEpC,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AAG9C;;;GAGG;AACH,qBAAa,MAAO,SAAQ,eAAe;IACzC,MAAM,CAAC,YAAY,EAAE,YAAY,CAAA;IACjC;;;;OAIG;WACU,gBAAgB,CAC3B,WAAW,EAAE,MAAM,GAClB,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;IAyBzB;;;;OAIG;IACU,WAAW,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAUxD;;;OAGG;IACG,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAI5B;;;OAGG;IACG,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC;IAI7B;;;OAGG;IACG,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IAI9B;;;OAGG;IACG,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAI3B;;;OAGG;IACG,EAAE,IAAI,OAAO,CAAC,IAAI,CAAC;CAG1B"}
|
package/dist/device/wohumi.js
CHANGED
|
@@ -1,16 +1,20 @@
|
|
|
1
1
|
import { Buffer } from 'node:buffer';
|
|
2
|
-
/* Copyright(C) 2024, donavanbecker (https://github.com/donavanbecker). All rights reserved.
|
|
3
|
-
*
|
|
4
|
-
* wohumi.ts: Switchbot BLE API registration.
|
|
5
|
-
*/
|
|
6
2
|
import { SwitchbotDevice } from '../device.js';
|
|
7
3
|
import { SwitchBotBLEModel, SwitchBotBLEModelFriendlyName, SwitchBotBLEModelName } from '../types/types.js';
|
|
4
|
+
/**
|
|
5
|
+
* Class representing a WoHumi device.
|
|
6
|
+
* @see https://github.com/OpenWonderLabs/SwitchBotAPI-BLE/tree/latest/devicetypes
|
|
7
|
+
*/
|
|
8
8
|
export class WoHumi extends SwitchbotDevice {
|
|
9
|
-
static
|
|
9
|
+
static switchBotBLE;
|
|
10
|
+
/**
|
|
11
|
+
* Parses the service data for WoHumi.
|
|
12
|
+
* @param {Buffer} serviceData - The service data buffer.
|
|
13
|
+
* @returns {Promise<object | null>} - Parsed service data or null if invalid.
|
|
14
|
+
*/
|
|
15
|
+
static async parseServiceData(serviceData) {
|
|
10
16
|
if (serviceData.length !== 8) {
|
|
11
|
-
|
|
12
|
-
onlog(`[parseServiceDataForWoHumi] Buffer length ${serviceData.length} !== 8!`);
|
|
13
|
-
}
|
|
17
|
+
this.switchBotBLE.emitLog('error', `[parseServiceDataForWoHumi] Buffer length ${serviceData.length} !== 8!`);
|
|
14
18
|
return null;
|
|
15
19
|
}
|
|
16
20
|
const byte1 = serviceData.readUInt8(1);
|
|
@@ -19,7 +23,7 @@ export class WoHumi extends SwitchbotDevice {
|
|
|
19
23
|
const autoMode = !!(byte4 & 0b10000000); // 1 - auto
|
|
20
24
|
const percentage = byte4 & 0b01111111; // 0-100%, 101/102/103 - Quick gear 1/2/3
|
|
21
25
|
const humidity = autoMode ? 0 : percentage === 101 ? 33 : percentage === 102 ? 66 : percentage === 103 ? 100 : percentage;
|
|
22
|
-
|
|
26
|
+
return {
|
|
23
27
|
model: SwitchBotBLEModel.Humidifier,
|
|
24
28
|
modelName: SwitchBotBLEModelName.Humidifier,
|
|
25
29
|
modelFriendlyName: SwitchBotBLEModelFriendlyName.Humidifier,
|
|
@@ -28,93 +32,54 @@ export class WoHumi extends SwitchbotDevice {
|
|
|
28
32
|
percentage: autoMode ? 0 : percentage,
|
|
29
33
|
humidity,
|
|
30
34
|
};
|
|
31
|
-
return data;
|
|
32
35
|
}
|
|
33
|
-
|
|
34
|
-
*
|
|
35
|
-
* -
|
|
36
|
-
*
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
36
|
+
/**
|
|
37
|
+
* Sends a command to the humidifier.
|
|
38
|
+
* @param {number[]} bytes - The command bytes.
|
|
39
|
+
* @returns {Promise<void>}
|
|
40
|
+
*/
|
|
41
|
+
async operateHumi(bytes) {
|
|
42
|
+
const reqBuf = Buffer.from(bytes);
|
|
43
|
+
const resBuf = await this.command(reqBuf);
|
|
44
|
+
const code = resBuf.readUInt8(0);
|
|
45
|
+
if (resBuf.length !== 3 || (code !== 0x01 && code !== 0x05)) {
|
|
46
|
+
throw new Error(`The device returned an error: 0x${resBuf.toString('hex')}`);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Presses the humidifier button.
|
|
51
|
+
* @returns {Promise<void>}
|
|
52
|
+
*/
|
|
44
53
|
async press() {
|
|
45
|
-
|
|
54
|
+
await this.operateHumi([0x57, 0x01, 0x00]);
|
|
46
55
|
}
|
|
47
|
-
|
|
48
|
-
*
|
|
49
|
-
*
|
|
50
|
-
|
|
51
|
-
* [Arguments]
|
|
52
|
-
* - none
|
|
53
|
-
*
|
|
54
|
-
* [Return value]
|
|
55
|
-
* - Promise object
|
|
56
|
-
* Nothing will be passed to the `resolve()`.
|
|
57
|
-
* ---------------------------------------------------------------- */
|
|
56
|
+
/**
|
|
57
|
+
* Turns on the humidifier.
|
|
58
|
+
* @returns {Promise<void>}
|
|
59
|
+
*/
|
|
58
60
|
async turnOn() {
|
|
59
|
-
|
|
61
|
+
await this.operateHumi([0x57, 0x01, 0x01]);
|
|
60
62
|
}
|
|
61
|
-
|
|
62
|
-
*
|
|
63
|
-
*
|
|
64
|
-
|
|
65
|
-
* [Arguments]
|
|
66
|
-
* - none
|
|
67
|
-
*
|
|
68
|
-
* [Return value]
|
|
69
|
-
* - Promise object
|
|
70
|
-
* Nothing will be passed to the `resolve()`.
|
|
71
|
-
* ---------------------------------------------------------------- */
|
|
63
|
+
/**
|
|
64
|
+
* Turns off the humidifier.
|
|
65
|
+
* @returns {Promise<void>}
|
|
66
|
+
*/
|
|
72
67
|
async turnOff() {
|
|
73
|
-
|
|
68
|
+
await this.operateHumi([0x57, 0x01, 0x02]);
|
|
74
69
|
}
|
|
75
|
-
|
|
76
|
-
*
|
|
77
|
-
*
|
|
78
|
-
|
|
79
|
-
* [Arguments]
|
|
80
|
-
* - none
|
|
81
|
-
*
|
|
82
|
-
* [Return value]
|
|
83
|
-
* - Promise object
|
|
84
|
-
* Nothing will be passed to the `resolve()`.
|
|
85
|
-
* ---------------------------------------------------------------- */
|
|
70
|
+
/**
|
|
71
|
+
* Decreases the humidifier setting.
|
|
72
|
+
* @returns {Promise<void>}
|
|
73
|
+
*/
|
|
86
74
|
async down() {
|
|
87
|
-
|
|
75
|
+
await this.operateHumi([0x57, 0x01, 0x03]);
|
|
88
76
|
}
|
|
89
|
-
|
|
90
|
-
*
|
|
91
|
-
*
|
|
92
|
-
|
|
93
|
-
* [Arguments]
|
|
94
|
-
* - none
|
|
95
|
-
*
|
|
96
|
-
* [Return value]
|
|
97
|
-
* - Promise object
|
|
98
|
-
* Nothing will be passed to the `resolve()`.
|
|
99
|
-
* ---------------------------------------------------------------- */
|
|
77
|
+
/**
|
|
78
|
+
* Increases the humidifier setting.
|
|
79
|
+
* @returns {Promise<void>}
|
|
80
|
+
*/
|
|
100
81
|
async up() {
|
|
101
|
-
|
|
102
|
-
}
|
|
103
|
-
async operateHumi(bytes) {
|
|
104
|
-
const req_buf = Buffer.from(bytes);
|
|
105
|
-
await this.command(req_buf)
|
|
106
|
-
.then((res_buf) => {
|
|
107
|
-
const code = res_buf.readUInt8(0);
|
|
108
|
-
if (res_buf.length === 3 && (code === 0x01 || code === 0x05)) {
|
|
109
|
-
// Intentionally left empty
|
|
110
|
-
}
|
|
111
|
-
else {
|
|
112
|
-
throw new Error(`The device returned an error: 0x${res_buf.toString('hex')}`);
|
|
113
|
-
}
|
|
114
|
-
})
|
|
115
|
-
.catch((error) => {
|
|
116
|
-
throw error;
|
|
117
|
-
});
|
|
82
|
+
await this.operateHumi([0x57, 0x01, 0x04]);
|
|
118
83
|
}
|
|
119
84
|
}
|
|
120
85
|
//# sourceMappingURL=wohumi.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wohumi.js","sourceRoot":"","sources":["../../src/device/wohumi.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"wohumi.js","sourceRoot":"","sources":["../../src/device/wohumi.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AAEpC,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AAC9C,OAAO,EAAE,iBAAiB,EAAE,6BAA6B,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAA;AAE3G;;;GAGG;AACH,MAAM,OAAO,MAAO,SAAQ,eAAe;IACzC,MAAM,CAAC,YAAY,CAAc;IACjC;;;;OAIG;IACH,MAAM,CAAC,KAAK,CAAC,gBAAgB,CAC3B,WAAmB;QAEnB,IAAI,WAAW,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YAC7B,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC,OAAO,EAAE,6CAA6C,WAAW,CAAC,MAAM,SAAS,CAAC,CAAA;YAC5G,OAAO,IAAI,CAAA;QACb,CAAC;QAED,MAAM,KAAK,GAAG,WAAW,CAAC,SAAS,CAAC,CAAC,CAAC,CAAA;QACtC,MAAM,KAAK,GAAG,WAAW,CAAC,SAAS,CAAC,CAAC,CAAC,CAAA;QAEtC,MAAM,OAAO,GAAG,CAAC,CAAC,CAAC,KAAK,GA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KAAK;QACT,MAAM,IAAI,CAAC,WAAW,CAAC,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC,CAAA;IAC5C,CAAC;IAED;;;OAGG;IACH,KAAK,CAAC,MAAM;QACV,MAAM,IAAI,CAAC,WAAW,CAAC,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC,CAAA;IAC5C,CAAC;IAED;;;OAGG;IACH,KAAK,CAAC,OAAO;QACX,MAAM,IAAI,CAAC,WAAW,CAAC,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC,CAAA;IAC5C,CAAC;IAED;;;OAGG;IACH,KAAK,CAAC,IAAI;QACR,MAAM,IAAI,CAAC,WAAW,CAAC,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC,CAAA;IAC5C,CAAC;IAED;;;OAGG;IACH,KAAK,CAAC,EAAE;QACN,MAAM,IAAI,CAAC,WAAW,CAAC,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC,CAAA;IAC5C,CAAC;CACF"}
|
|
@@ -1,6 +1,18 @@
|
|
|
1
1
|
import type { Buffer } from 'node:buffer';
|
|
2
|
+
import type { SwitchBotBLE } from '../switchbot-ble.js';
|
|
2
3
|
import { SwitchbotDevice } from '../device.js';
|
|
4
|
+
/**
|
|
5
|
+
* Class representing a WoIOSensorTH device.
|
|
6
|
+
* @see https://github.com/OpenWonderLabs/SwitchBotAPI-BLE/blob/latest/devicetypes/meter.md#outdoor-temperaturehumidity-sensor
|
|
7
|
+
*/
|
|
3
8
|
export declare class WoIOSensorTH extends SwitchbotDevice {
|
|
4
|
-
static
|
|
9
|
+
static switchBotBLE: SwitchBotBLE;
|
|
10
|
+
/**
|
|
11
|
+
* Parses the service data for WoIOSensorTH.
|
|
12
|
+
* @param {Buffer} serviceData - The service data buffer.
|
|
13
|
+
* @param {Buffer} manufacturerData - The manufacturer data buffer.
|
|
14
|
+
* @returns {Promise<object | null>} - Parsed service data or null if invalid.
|
|
15
|
+
*/
|
|
16
|
+
static parseServiceData(serviceData: Buffer, manufacturerData: Buffer): Promise<object | null>;
|
|
5
17
|
}
|
|
6
18
|
//# sourceMappingURL=woiosensorth.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"woiosensorth.d.ts","sourceRoot":"","sources":["../../src/device/woiosensorth.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"woiosensorth.d.ts","sourceRoot":"","sources":["../../src/device/woiosensorth.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AAEzC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA;AAEvD,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AAG9C;;;GAGG;AACH,qBAAa,YAAa,SAAQ,eAAe;IAC/C,MAAM,CAAC,YAAY,EAAE,YAAY,CAAA;IACjC;;;;;OAKG;WACU,gBAAgB,CAC3B,WAAW,EAAE,MAAM,EACnB,gBAAgB,EAAE,MAAM,GACvB,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;CAgC1B"}
|
|
@@ -1,49 +1,45 @@
|
|
|
1
|
-
/* Copyright(C) 2024, donavanbecker (https://github.com/donavanbecker). All rights reserved.
|
|
2
|
-
*
|
|
3
|
-
* woiosensorth.ts: Switchbot BLE API registration.
|
|
4
|
-
*/
|
|
5
1
|
import { SwitchbotDevice } from '../device.js';
|
|
6
2
|
import { SwitchBotBLEModel, SwitchBotBLEModelFriendlyName, SwitchBotBLEModelName } from '../types/types.js';
|
|
3
|
+
/**
|
|
4
|
+
* Class representing a WoIOSensorTH device.
|
|
5
|
+
* @see https://github.com/OpenWonderLabs/SwitchBotAPI-BLE/blob/latest/devicetypes/meter.md#outdoor-temperaturehumidity-sensor
|
|
6
|
+
*/
|
|
7
7
|
export class WoIOSensorTH extends SwitchbotDevice {
|
|
8
|
-
static
|
|
8
|
+
static switchBotBLE;
|
|
9
|
+
/**
|
|
10
|
+
* Parses the service data for WoIOSensorTH.
|
|
11
|
+
* @param {Buffer} serviceData - The service data buffer.
|
|
12
|
+
* @param {Buffer} manufacturerData - The manufacturer data buffer.
|
|
13
|
+
* @returns {Promise<object | null>} - Parsed service data or null if invalid.
|
|
14
|
+
*/
|
|
15
|
+
static async parseServiceData(serviceData, manufacturerData) {
|
|
9
16
|
if (serviceData.length !== 3) {
|
|
10
|
-
|
|
11
|
-
onlog(`[parseServiceDataForWoIOSensorTH] Service Data Buffer length ${serviceData.length} !== 3!`);
|
|
12
|
-
}
|
|
17
|
+
this.switchBotBLE.emitLog('error', `[parseServiceDataForWoIOSensorTH] Service Data Buffer length ${serviceData.length} !== 3!`);
|
|
13
18
|
return null;
|
|
14
19
|
}
|
|
15
20
|
if (manufacturerData.length !== 14) {
|
|
16
|
-
|
|
17
|
-
onlog(`[parseServiceDataForWoIOSensorTH] Manufacturer Data Buffer length ${manufacturerData.length} !== 14!`);
|
|
18
|
-
}
|
|
21
|
+
this.switchBotBLE.emitLog('error', `[parseServiceDataForWoIOSensorTH] Manufacturer Data Buffer length ${manufacturerData.length} !== 14!`);
|
|
19
22
|
return null;
|
|
20
23
|
}
|
|
21
|
-
const mdByte10 =
|
|
22
|
-
|
|
23
|
-
|
|
24
|
+
const [mdByte10, mdByte11, mdByte12] = [
|
|
25
|
+
manufacturerData.readUInt8(10),
|
|
26
|
+
manufacturerData.readUInt8(11),
|
|
27
|
+
manufacturerData.readUInt8(12),
|
|
28
|
+
];
|
|
24
29
|
const sdByte2 = serviceData.readUInt8(2);
|
|
25
|
-
const
|
|
26
|
-
const
|
|
27
|
-
const
|
|
28
|
-
|
|
30
|
+
const tempSign = mdByte11 & 0b10000000 ? 1 : -1;
|
|
31
|
+
const tempC = tempSign * ((mdByte11 & 0b01111111) + (mdByte10 & 0b00001111) / 10);
|
|
32
|
+
const tempF = Math.round(((tempC * 9) / 5 + 32) * 10) / 10;
|
|
33
|
+
return {
|
|
29
34
|
model: SwitchBotBLEModel.OutdoorMeter,
|
|
30
35
|
modelName: SwitchBotBLEModelName.OutdoorMeter,
|
|
31
36
|
modelFriendlyName: SwitchBotBLEModelFriendlyName.OutdoorMeter,
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
* Use the `celsius` and `fahrenheit` properties directly instead.
|
|
35
|
-
*/
|
|
36
|
-
temperature: {
|
|
37
|
-
c: temp_c,
|
|
38
|
-
f: temp_f,
|
|
39
|
-
},
|
|
40
|
-
celsius: temp_c,
|
|
41
|
-
fahrenheit: temp_f,
|
|
37
|
+
celsius: tempC,
|
|
38
|
+
fahrenheit: tempF,
|
|
42
39
|
fahrenheit_mode: !!(mdByte12 & 0b10000000),
|
|
43
40
|
humidity: mdByte12 & 0b01111111,
|
|
44
41
|
battery: sdByte2 & 0b01111111,
|
|
45
42
|
};
|
|
46
|
-
return data;
|
|
47
43
|
}
|
|
48
44
|
}
|
|
49
45
|
//# sourceMappingURL=woiosensorth.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"woiosensorth.js","sourceRoot":"","sources":["../../src/device/woiosensorth.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"woiosensorth.js","sourceRoot":"","sources":["../../src/device/woiosensorth.ts"],"names":[],"mappings":"AAQA,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,MAAM,CAAC,YAAY,CAAc;IACjC;;;;;OAKG;IACH,MAAM,CAAC,KAAK,CAAC,gBAAgB,CAC3B,WAAmB,EACnB,gBAAwB;QAExB,IAAI,WAAW,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YAC7B,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC,OAAO,EAAE,gEAAgE,WAAW,CA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AAG,UAAU;SAC9B,CAAA;IACH,CAAC;CACF"}
|
|
@@ -1,31 +1,63 @@
|
|
|
1
|
+
import type { SwitchBotBLE } from '../switchbot-ble.js';
|
|
1
2
|
import { Buffer } from 'node:buffer';
|
|
2
3
|
import { SwitchbotDevice } from '../device.js';
|
|
3
4
|
/**
|
|
5
|
+
* Class representing a WoPlugMini device.
|
|
4
6
|
* @see https://github.com/OpenWonderLabs/SwitchBotAPI-BLE/blob/latest/devicetypes/plugmini.md
|
|
5
7
|
*/
|
|
6
8
|
export declare class WoPlugMini extends SwitchbotDevice {
|
|
7
|
-
static
|
|
8
|
-
static parseServiceData_JP(manufacturerData: Buffer, onlog: ((message: string) => void) | undefined): Promise<object | null>;
|
|
9
|
+
static switchBotBLE: SwitchBotBLE;
|
|
9
10
|
/**
|
|
10
|
-
*
|
|
11
|
+
* Parses the service data for WoPlugMini US.
|
|
12
|
+
* @param {Buffer} manufacturerData - The manufacturer data buffer.
|
|
13
|
+
* @returns {Promise<object | null>} - Parsed service data or null if invalid.
|
|
11
14
|
*/
|
|
12
|
-
|
|
15
|
+
static parseServiceData_US(manufacturerData: Buffer): Promise<object | null>;
|
|
13
16
|
/**
|
|
17
|
+
* Parses the service data for WoPlugMini JP.
|
|
18
|
+
* @param {Buffer} manufacturerData - The manufacturer data buffer.
|
|
19
|
+
* @returns {Promise<object | null>} - Parsed service data or null if invalid.
|
|
20
|
+
*/
|
|
21
|
+
static parseServiceData_JP(manufacturerData: Buffer): Promise<object | null>;
|
|
22
|
+
/**
|
|
23
|
+
* Parses the service data for WoPlugMini.
|
|
24
|
+
* @param {Buffer} manufacturerData - The manufacturer data buffer.
|
|
25
|
+
* @param {SwitchBotBLEModel} model - The model of the plug mini.
|
|
26
|
+
* @returns {Promise<object | null>} - Parsed service data or null if invalid.
|
|
27
|
+
*/
|
|
28
|
+
private static parseServiceData;
|
|
29
|
+
/**
|
|
30
|
+
* Reads the state of the plug.
|
|
31
|
+
* @returns {Promise<boolean>} - Resolves with a boolean that tells whether the plug is ON (true) or OFF (false).
|
|
32
|
+
*/
|
|
33
|
+
readState(): Promise<boolean>;
|
|
34
|
+
/**
|
|
35
|
+
* Sets the state of the plug.
|
|
14
36
|
* @private
|
|
37
|
+
* @param {number[]} reqByteArray - The request byte array.
|
|
38
|
+
* @returns {Promise<boolean>} - Resolves with a boolean that tells whether the plug is ON (true) or OFF (false).
|
|
39
|
+
*/
|
|
40
|
+
private setState;
|
|
41
|
+
/**
|
|
42
|
+
* Turns on the plug.
|
|
43
|
+
* @returns {Promise<boolean>} - Resolves with a boolean that tells whether the plug is ON (true) or OFF (false).
|
|
15
44
|
*/
|
|
16
|
-
|
|
45
|
+
turnOn(): Promise<boolean>;
|
|
17
46
|
/**
|
|
18
|
-
*
|
|
47
|
+
* Turns off the plug.
|
|
48
|
+
* @returns {Promise<boolean>} - Resolves with a boolean that tells whether the plug is ON (true) or OFF (false).
|
|
19
49
|
*/
|
|
20
|
-
|
|
50
|
+
turnOff(): Promise<boolean>;
|
|
21
51
|
/**
|
|
22
|
-
*
|
|
52
|
+
* Toggles the state of the plug.
|
|
53
|
+
* @returns {Promise<boolean>} - Resolves with a boolean that tells whether the plug is ON (true) or OFF (false).
|
|
23
54
|
*/
|
|
24
|
-
|
|
55
|
+
toggle(): Promise<boolean>;
|
|
25
56
|
/**
|
|
26
|
-
*
|
|
57
|
+
* Operates the plug with the given bytes.
|
|
58
|
+
* @param {number[]} bytes - The byte array to send to the plug.
|
|
59
|
+
* @returns {Promise<boolean>} - Resolves with a boolean that tells whether the plug is ON (true) or OFF (false).
|
|
27
60
|
*/
|
|
28
|
-
|
|
29
|
-
operatePlug(bytes: number[]): Promise<void>;
|
|
61
|
+
operatePlug(bytes: number[]): Promise<boolean>;
|
|
30
62
|
}
|
|
31
63
|
//# sourceMappingURL=woplugmini.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"woplugmini.d.ts","sourceRoot":"","sources":["../../src/device/woplugmini.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"woplugmini.d.ts","sourceRoot":"","sources":["../../src/device/woplugmini.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA;AAEvD,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AAEpC,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AAG9C;;;GAGG;AACH,qBAAa,UAAW,SAAQ,eAAe;IAC7C,MAAM,CAAC,YAAY,EAAE,YAAY,CAAA;IACjC;;;;OAIG;WACU,mBAAmB,CAC9B,gBAAgB,EAAE,MAAM,GACvB,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;IAIzB;;;;OAIG;WACU,mBAAmB,CAC9B,gBAAgB,EAAE,MAAM,GACvB,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;IAIzB;;;;;OAKG;mBACkB,gBAAgB;IAuCrC;;;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"}
|