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":"wobulb.js","sourceRoot":"","sources":["../../src/device/wobulb.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"wobulb.js","sourceRoot":"","sources":["../../src/device/wobulb.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,M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-ble.js';
|
|
1
2
|
import { Buffer } from 'node:buffer';
|
|
2
3
|
import { SwitchbotDevice } from '../device.js';
|
|
3
4
|
/**
|
|
5
|
+
* Class representing a WoCeilingLight device.
|
|
4
6
|
* @see https://github.com/OpenWonderLabs/SwitchBotAPI-BLE/blob/latest/devicetypes/colorbulb.md
|
|
5
7
|
*/
|
|
6
8
|
export declare class WoCeilingLight extends SwitchbotDevice {
|
|
7
|
-
static
|
|
8
|
-
static parseServiceData_Pro(manufacturerData: Buffer, onlog: ((message: string) => void) | undefined): Promise<object | null>;
|
|
9
|
+
static switchBotBLE: SwitchBotBLE;
|
|
9
10
|
/**
|
|
10
|
-
*
|
|
11
|
+
* Parses the service data for WoCeilingLight.
|
|
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(manufacturerData: Buffer): Promise<object | null>;
|
|
13
16
|
/**
|
|
14
|
-
*
|
|
17
|
+
* Parses the service data for WoCeilingLight Pro.
|
|
18
|
+
* @param {Buffer} manufacturerData - The manufacturer data buffer.
|
|
19
|
+
* @returns {Promise<object | null>} - Parsed service data or null if invalid.
|
|
15
20
|
*/
|
|
16
|
-
|
|
21
|
+
static parseServiceData_Pro(manufacturerData: Buffer): Promise<object | null>;
|
|
17
22
|
/**
|
|
18
|
-
*
|
|
23
|
+
* Reads the state of the ceiling light.
|
|
24
|
+
* @returns {Promise<boolean>} - Resolves with a boolean indicating whether the light is ON (true) or OFF (false).
|
|
19
25
|
*/
|
|
20
|
-
|
|
26
|
+
readState(): Promise<boolean>;
|
|
21
27
|
/**
|
|
22
|
-
*
|
|
28
|
+
* Sets the state of the ceiling light.
|
|
29
|
+
* @param {number[]} reqByteArray - The request byte array.
|
|
30
|
+
* @returns {Promise<boolean>} - Resolves with a boolean indicating whether the operation was successful.
|
|
23
31
|
*/
|
|
24
|
-
|
|
32
|
+
setState(reqByteArray: number[]): Promise<boolean>;
|
|
25
33
|
/**
|
|
26
|
-
*
|
|
34
|
+
* Turns on the ceiling light.
|
|
35
|
+
* @returns {Promise<boolean>} - Resolves with a boolean indicating whether the light is ON (true).
|
|
27
36
|
*/
|
|
28
|
-
|
|
37
|
+
turnOn(): Promise<boolean>;
|
|
29
38
|
/**
|
|
30
|
-
*
|
|
39
|
+
* Turns off the ceiling light.
|
|
40
|
+
* @returns {Promise<boolean>} - Resolves with a boolean indicating whether the light is OFF (false).
|
|
31
41
|
*/
|
|
32
|
-
|
|
42
|
+
turnOff(): Promise<boolean>;
|
|
33
43
|
/**
|
|
34
|
-
*
|
|
35
|
-
* @param
|
|
36
|
-
* @
|
|
37
|
-
* @param blue
|
|
44
|
+
* Sets the brightness of the ceiling light.
|
|
45
|
+
* @param {number} brightness - The brightness percentage (0-100).
|
|
46
|
+
* @returns {Promise<boolean>} - Resolves with a boolean indicating whether the operation was successful.
|
|
38
47
|
*/
|
|
39
|
-
|
|
48
|
+
setBrightness(brightness: number): Promise<boolean>;
|
|
40
49
|
/**
|
|
41
|
-
*
|
|
50
|
+
* Sets the color temperature of the ceiling light.
|
|
51
|
+
* @param {number} color_temperature - The color temperature percentage (0-100).
|
|
52
|
+
* @returns {Promise<boolean>} - Resolves with a boolean indicating whether the operation was successful.
|
|
42
53
|
*/
|
|
43
|
-
|
|
54
|
+
setColorTemperature(color_temperature: number): Promise<boolean>;
|
|
55
|
+
/**
|
|
56
|
+
* Sets the RGB color of the ceiling light.
|
|
57
|
+
* @param {number} brightness - The brightness percentage (0-100).
|
|
58
|
+
* @param {number} red - The red color value (0-255).
|
|
59
|
+
* @param {number} green - The green color value (0-255).
|
|
60
|
+
* @param {number} blue - The blue color value (0-255).
|
|
61
|
+
* @returns {Promise<boolean>} - Resolves with a boolean indicating whether the operation was successful.
|
|
62
|
+
*/
|
|
63
|
+
setRGB(brightness: number, red: number, green: number, blue: number): Promise<boolean>;
|
|
64
|
+
/**
|
|
65
|
+
* Sends a command to the ceiling light.
|
|
66
|
+
* @param {number[]} bytes - The command bytes.
|
|
67
|
+
* @returns {Promise<boolean>} - Resolves with a boolean indicating whether the operation was successful.
|
|
68
|
+
*/
|
|
69
|
+
operateCeilingLight(bytes: number[]): Promise<boolean>;
|
|
44
70
|
}
|
|
45
71
|
//# sourceMappingURL=woceilinglight.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"woceilinglight.d.ts","sourceRoot":"","sources":["../../src/device/woceilinglight.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"woceilinglight.d.ts","sourceRoot":"","sources":["../../src/device/woceilinglight.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,cAAe,SAAQ,eAAe;IACjD,MAAM,CAAC,YAAY,EAAE,YAAY,CAAA;IACjC;;;;OAIG;WACU,gBAAgB,CAC3B,gBAAgB,EAAE,MAAM,GACvB,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;IAqCzB;;;;OAIG;WACU,oBAAoB,CAC/B,gBAAgB,EAAE,MAAM,GACvB,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;IAqCzB;;;OAGG;IACG,SAAS,IAAI,OAAO,CAAC,OAAO,CAAC;IAInC;;;;OAIG;IACG,QAAQ,CAAC,YAAY,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,OAAO,CAAC;IAKxD;;;OAGG;IACG,MAAM,IAAI,OAAO,CAAC,OAAO,CAAC;IAIhC;;;OAGG;IACG,OAAO,IAAI,OAAO,CAAC,OAAO,CAAC;IAIjC;;;;OAIG;IACG,aAAa,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAOzD;;;;OAIG;IACG,mBAAmB,CAAC,iBAAiB,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAOtE;;;;;;;OAOG;IACG,MAAM,CAAC,UAAU,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAY5F;;;;OAIG;IACU,mBAAmB,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,OAAO,CAAC;CAYpE"}
|
|
@@ -1,235 +1,155 @@
|
|
|
1
1
|
import { Buffer } from 'node:buffer';
|
|
2
|
-
/* Copyright(C) 2024, donavanbecker (https://github.com/donavanbecker). All rights reserved.
|
|
3
|
-
*
|
|
4
|
-
* woceilinglight.ts: Switchbot BLE API registration.
|
|
5
|
-
*/
|
|
6
2
|
import { SwitchbotDevice } from '../device.js';
|
|
7
3
|
import { SwitchBotBLEModel, SwitchBotBLEModelFriendlyName, SwitchBotBLEModelName } from '../types/types.js';
|
|
8
4
|
/**
|
|
5
|
+
* Class representing a WoCeilingLight device.
|
|
9
6
|
* @see https://github.com/OpenWonderLabs/SwitchBotAPI-BLE/blob/latest/devicetypes/colorbulb.md
|
|
10
7
|
*/
|
|
11
8
|
export class WoCeilingLight extends SwitchbotDevice {
|
|
12
|
-
static
|
|
9
|
+
static switchBotBLE;
|
|
10
|
+
/**
|
|
11
|
+
* Parses the service data for WoCeilingLight.
|
|
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(manufacturerData) {
|
|
13
16
|
if (manufacturerData.length !== 13) {
|
|
14
|
-
|
|
15
|
-
onlog(`[parseServiceDataForWoCeilingLight] Buffer length ${manufacturerData.length} !== 13!`);
|
|
16
|
-
}
|
|
17
|
+
this.switchBotBLE.emitLog('error', `[parseServiceDataForWoCeilingLight] Buffer length ${manufacturerData.length} !== 13!`);
|
|
17
18
|
return null;
|
|
18
19
|
}
|
|
19
|
-
const byte1
|
|
20
|
-
|
|
21
|
-
const byte3 = manufacturerData.readUInt8(3); // bulb R
|
|
22
|
-
const byte4 = manufacturerData.readUInt8(4); // bulb G
|
|
23
|
-
const byte5 = manufacturerData.readUInt8(5); // bulb B
|
|
24
|
-
const byte6 = manufacturerData.readUInt8(6); // bulb temperature
|
|
25
|
-
const byte7 = manufacturerData.readUInt8(7);
|
|
26
|
-
const byte8 = manufacturerData.readUInt8(8);
|
|
27
|
-
const byte9 = manufacturerData.readUInt8(9);
|
|
28
|
-
const byte10 = manufacturerData.readUInt8(10); // bulb mode
|
|
29
|
-
const power = byte1;
|
|
30
|
-
const red = byte3;
|
|
31
|
-
const green = byte4;
|
|
32
|
-
const blue = byte5;
|
|
33
|
-
const color_temperature = byte6;
|
|
34
|
-
const state = !!(byte7 & 0b01111111);
|
|
35
|
-
const brightness = byte7 & 0b01111111;
|
|
36
|
-
const delay = byte8 & 0b10000000;
|
|
37
|
-
const preset = byte8 & 0b00001000;
|
|
38
|
-
const color_mode = byte8 & 0b00000111;
|
|
39
|
-
const speed = byte9 & 0b01111111;
|
|
40
|
-
const loop_index = byte10 & 0b11111110;
|
|
41
|
-
const data = {
|
|
20
|
+
const [, byte1, , byte3, byte4, byte5, byte6, byte7, byte8, byte9, byte10,] = manufacturerData;
|
|
21
|
+
return {
|
|
42
22
|
model: SwitchBotBLEModel.CeilingLight,
|
|
43
23
|
modelName: SwitchBotBLEModelName.CeilingLight,
|
|
44
24
|
modelFriendlyName: SwitchBotBLEModelFriendlyName.CeilingLight,
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
brightness,
|
|
52
|
-
delay,
|
|
53
|
-
preset,
|
|
54
|
-
color_mode,
|
|
55
|
-
speed,
|
|
56
|
-
loop_index,
|
|
25
|
+
power: byte1,
|
|
26
|
+
red: byte3,
|
|
27
|
+
green: byte4,
|
|
28
|
+
blue: byte5,
|
|
29
|
+
color_temperature: byte6,
|
|
30
|
+
state: !!(byte7 & 0b01111111),
|
|
31
|
+
brightness: byte7 & 0b01111111,
|
|
32
|
+
delay: !!(byte8 & 0b10000000),
|
|
33
|
+
preset: !!(byte8 & 0b00001000),
|
|
34
|
+
color_mode: byte8 & 0b00000111,
|
|
35
|
+
speed: byte9 & 0b01111111,
|
|
36
|
+
loop_index: byte10 & 0b11111110,
|
|
57
37
|
};
|
|
58
|
-
return data;
|
|
59
38
|
}
|
|
60
|
-
|
|
39
|
+
/**
|
|
40
|
+
* Parses the service data for WoCeilingLight Pro.
|
|
41
|
+
* @param {Buffer} manufacturerData - The manufacturer data buffer.
|
|
42
|
+
* @returns {Promise<object | null>} - Parsed service data or null if invalid.
|
|
43
|
+
*/
|
|
44
|
+
static async parseServiceData_Pro(manufacturerData) {
|
|
61
45
|
if (manufacturerData.length !== 13) {
|
|
62
|
-
|
|
63
|
-
onlog(`[parseServiceDataForWoCeilingLightPro] Buffer length ${manufacturerData.length} !== 13!`);
|
|
64
|
-
}
|
|
46
|
+
this.switchBotBLE.emitLog('error', `[parseServiceDataForWoCeilingLightPro] Buffer length ${manufacturerData.length} !== 13!`);
|
|
65
47
|
return null;
|
|
66
48
|
}
|
|
67
|
-
const byte1
|
|
68
|
-
|
|
69
|
-
const byte3 = manufacturerData.readUInt8(3); // bulb R
|
|
70
|
-
const byte4 = manufacturerData.readUInt8(4); // bulb G
|
|
71
|
-
const byte5 = manufacturerData.readUInt8(5); // bulb B
|
|
72
|
-
const byte6 = manufacturerData.readUInt8(6); // bulb temperature
|
|
73
|
-
const byte7 = manufacturerData.readUInt8(7);
|
|
74
|
-
const byte8 = manufacturerData.readUInt8(8);
|
|
75
|
-
const byte9 = manufacturerData.readUInt8(9);
|
|
76
|
-
const byte10 = manufacturerData.readUInt8(10); // bulb mode
|
|
77
|
-
const power = byte1;
|
|
78
|
-
const red = byte3;
|
|
79
|
-
const green = byte4;
|
|
80
|
-
const blue = byte5;
|
|
81
|
-
const color_temperature = byte6;
|
|
82
|
-
const state = !!(byte7 & 0b01111111);
|
|
83
|
-
const brightness = byte7 & 0b01111111;
|
|
84
|
-
const delay = byte8 & 0b10000000;
|
|
85
|
-
const preset = byte8 & 0b00001000;
|
|
86
|
-
const color_mode = byte8 & 0b00000111;
|
|
87
|
-
const speed = byte9 & 0b01111111;
|
|
88
|
-
const loop_index = byte10 & 0b11111110;
|
|
89
|
-
const data = {
|
|
49
|
+
const [, byte1, , byte3, byte4, byte5, byte6, byte7, byte8, byte9, byte10,] = manufacturerData;
|
|
50
|
+
return {
|
|
90
51
|
model: SwitchBotBLEModel.CeilingLightPro,
|
|
91
52
|
modelName: SwitchBotBLEModelName.CeilingLightPro,
|
|
92
53
|
modelFriendlyName: SwitchBotBLEModelFriendlyName.CeilingLightPro,
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
brightness,
|
|
100
|
-
delay,
|
|
101
|
-
preset,
|
|
102
|
-
color_mode,
|
|
103
|
-
speed,
|
|
104
|
-
loop_index,
|
|
54
|
+
power: byte1,
|
|
55
|
+
red: byte3,
|
|
56
|
+
green: byte4,
|
|
57
|
+
blue: byte5,
|
|
58
|
+
color_temperature: byte6,
|
|
59
|
+
state: !!(byte7 & 0b01111111),
|
|
60
|
+
brightness: byte7 & 0b01111111,
|
|
61
|
+
delay: !!(byte8 & 0b10000000),
|
|
62
|
+
preset: !!(byte8 & 0b00001000),
|
|
63
|
+
color_mode: byte8 & 0b00000111,
|
|
64
|
+
speed: byte9 & 0b01111111,
|
|
65
|
+
loop_index: byte10 & 0b11111110,
|
|
105
66
|
};
|
|
106
|
-
return data;
|
|
107
67
|
}
|
|
108
68
|
/**
|
|
109
|
-
*
|
|
69
|
+
* Reads the state of the ceiling light.
|
|
70
|
+
* @returns {Promise<boolean>} - Resolves with a boolean indicating whether the light is ON (true) or OFF (false).
|
|
110
71
|
*/
|
|
111
72
|
async readState() {
|
|
112
|
-
return
|
|
73
|
+
return this.operateCeilingLight([0x57, 0x0F, 0x48, 0x01]);
|
|
113
74
|
}
|
|
114
75
|
/**
|
|
115
|
-
*
|
|
76
|
+
* Sets the state of the ceiling light.
|
|
77
|
+
* @param {number[]} reqByteArray - The request byte array.
|
|
78
|
+
* @returns {Promise<boolean>} - Resolves with a boolean indicating whether the operation was successful.
|
|
116
79
|
*/
|
|
117
80
|
async setState(reqByteArray) {
|
|
118
81
|
const base = [0x57, 0x0F, 0x47, 0x01];
|
|
119
|
-
return
|
|
82
|
+
return this.operateCeilingLight(base.concat(reqByteArray));
|
|
120
83
|
}
|
|
121
84
|
/**
|
|
122
|
-
*
|
|
85
|
+
* Turns on the ceiling light.
|
|
86
|
+
* @returns {Promise<boolean>} - Resolves with a boolean indicating whether the light is ON (true).
|
|
123
87
|
*/
|
|
124
88
|
async turnOn() {
|
|
125
|
-
return
|
|
89
|
+
return this.setState([0x01, 0x01]);
|
|
126
90
|
}
|
|
127
91
|
/**
|
|
128
|
-
*
|
|
92
|
+
* Turns off the ceiling light.
|
|
93
|
+
* @returns {Promise<boolean>} - Resolves with a boolean indicating whether the light is OFF (false).
|
|
129
94
|
*/
|
|
130
95
|
async turnOff() {
|
|
131
|
-
return
|
|
96
|
+
return this.setState([0x01, 0x02]);
|
|
132
97
|
}
|
|
133
98
|
/**
|
|
134
|
-
*
|
|
99
|
+
* Sets the brightness of the ceiling light.
|
|
100
|
+
* @param {number} brightness - The brightness percentage (0-100).
|
|
101
|
+
* @returns {Promise<boolean>} - Resolves with a boolean indicating whether the operation was successful.
|
|
135
102
|
*/
|
|
136
103
|
async setBrightness(brightness) {
|
|
137
|
-
if (typeof brightness !== 'number') {
|
|
138
|
-
throw new TypeError(`
|
|
139
|
-
}
|
|
140
|
-
if (brightness > 100) {
|
|
141
|
-
brightness = 100;
|
|
142
|
-
}
|
|
143
|
-
else if (brightness < 0) {
|
|
144
|
-
brightness = 0;
|
|
104
|
+
if (typeof brightness !== 'number' || brightness < 0 || brightness > 100) {
|
|
105
|
+
throw new TypeError(`Invalid brightness value: ${brightness}`);
|
|
145
106
|
}
|
|
146
|
-
return
|
|
107
|
+
return this.setState([0x02, 0x14, brightness]);
|
|
147
108
|
}
|
|
148
109
|
/**
|
|
149
|
-
*
|
|
110
|
+
* Sets the color temperature of the ceiling light.
|
|
111
|
+
* @param {number} color_temperature - The color temperature percentage (0-100).
|
|
112
|
+
* @returns {Promise<boolean>} - Resolves with a boolean indicating whether the operation was successful.
|
|
150
113
|
*/
|
|
151
114
|
async setColorTemperature(color_temperature) {
|
|
152
|
-
if (typeof color_temperature !== 'number') {
|
|
153
|
-
throw new TypeError(`
|
|
115
|
+
if (typeof color_temperature !== 'number' || color_temperature < 0 || color_temperature > 100) {
|
|
116
|
+
throw new TypeError(`Invalid color temperature value: ${color_temperature}`);
|
|
154
117
|
}
|
|
155
|
-
|
|
156
|
-
color_temperature = 100;
|
|
157
|
-
}
|
|
158
|
-
else if (color_temperature < 0) {
|
|
159
|
-
color_temperature = 0;
|
|
160
|
-
}
|
|
161
|
-
return await this.setState([0x02, 0x17, color_temperature]);
|
|
118
|
+
return this.setState([0x02, 0x17, color_temperature]);
|
|
162
119
|
}
|
|
163
120
|
/**
|
|
164
|
-
*
|
|
165
|
-
* @param
|
|
166
|
-
* @param
|
|
167
|
-
* @param
|
|
121
|
+
* Sets the RGB color of the ceiling light.
|
|
122
|
+
* @param {number} brightness - The brightness percentage (0-100).
|
|
123
|
+
* @param {number} red - The red color value (0-255).
|
|
124
|
+
* @param {number} green - The green color value (0-255).
|
|
125
|
+
* @param {number} blue - The blue color value (0-255).
|
|
126
|
+
* @returns {Promise<boolean>} - Resolves with a boolean indicating whether the operation was successful.
|
|
168
127
|
*/
|
|
169
128
|
async setRGB(brightness, red, green, blue) {
|
|
170
|
-
if (typeof brightness !== 'number'
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
throw new TypeError(
|
|
129
|
+
if (typeof brightness !== 'number' || brightness < 0 || brightness > 100
|
|
130
|
+
|| typeof red !== 'number' || red < 0 || red > 255
|
|
131
|
+
|| typeof green !== 'number' || green < 0 || green > 255
|
|
132
|
+
|| typeof blue !== 'number' || blue < 0 || blue > 255) {
|
|
133
|
+
throw new TypeError('Invalid RGB or brightness values');
|
|
175
134
|
}
|
|
176
|
-
|
|
177
|
-
throw new TypeError(`The type of target green is incorrect: ${typeof green}`);
|
|
178
|
-
}
|
|
179
|
-
if (typeof blue !== 'number') {
|
|
180
|
-
throw new TypeError(`The type of target blue is incorrect: ${typeof blue}`);
|
|
181
|
-
}
|
|
182
|
-
if (brightness > 100) {
|
|
183
|
-
brightness = 100;
|
|
184
|
-
}
|
|
185
|
-
else if (brightness < 0) {
|
|
186
|
-
brightness = 0;
|
|
187
|
-
}
|
|
188
|
-
if (red > 255) {
|
|
189
|
-
red = 255;
|
|
190
|
-
}
|
|
191
|
-
else if (red < 0) {
|
|
192
|
-
red = 0;
|
|
193
|
-
}
|
|
194
|
-
if (green > 255) {
|
|
195
|
-
green = 255;
|
|
196
|
-
}
|
|
197
|
-
else if (green < 0) {
|
|
198
|
-
green = 0;
|
|
199
|
-
}
|
|
200
|
-
if (blue > 255) {
|
|
201
|
-
blue = 255;
|
|
202
|
-
}
|
|
203
|
-
else if (blue < 0) {
|
|
204
|
-
blue = 0;
|
|
205
|
-
}
|
|
206
|
-
return await this.setState([0x02, 0x12, brightness, red, green, blue]);
|
|
135
|
+
return this.setState([0x02, 0x12, brightness, red, green, blue]);
|
|
207
136
|
}
|
|
208
137
|
/**
|
|
209
|
-
*
|
|
138
|
+
* Sends a command to the ceiling light.
|
|
139
|
+
* @param {number[]} bytes - The command bytes.
|
|
140
|
+
* @returns {Promise<boolean>} - Resolves with a boolean indicating whether the operation was successful.
|
|
210
141
|
*/
|
|
211
|
-
async
|
|
212
|
-
const
|
|
213
|
-
await this.command(
|
|
214
|
-
|
|
215
|
-
const
|
|
216
|
-
if (
|
|
217
|
-
|
|
218
|
-
if (code === 0x00 || code === 0x80) {
|
|
219
|
-
const is_on = code === 0x80;
|
|
220
|
-
return is_on;
|
|
221
|
-
}
|
|
222
|
-
else {
|
|
223
|
-
throw new Error(`The device returned an error: 0x${res_buf.toString('hex')}`);
|
|
224
|
-
}
|
|
225
|
-
}
|
|
226
|
-
else {
|
|
227
|
-
throw new Error(`Expecting a 2-byte response, got instead: 0x${res_buf.toString('hex')}`);
|
|
142
|
+
async operateCeilingLight(bytes) {
|
|
143
|
+
const reqBuf = Buffer.from(bytes);
|
|
144
|
+
const resBuf = await this.command(reqBuf);
|
|
145
|
+
if (resBuf.length === 2) {
|
|
146
|
+
const code = resBuf.readUInt8(1);
|
|
147
|
+
if (code === 0x00 || code === 0x80) {
|
|
148
|
+
return code === 0x80;
|
|
228
149
|
}
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
});
|
|
150
|
+
throw new Error(`The device returned an error: 0x${resBuf.toString('hex')}`);
|
|
151
|
+
}
|
|
152
|
+
throw new Error(`Expecting a 2-byte response, got instead: 0x${resBuf.toString('hex')}`);
|
|
233
153
|
}
|
|
234
154
|
}
|
|
235
155
|
//# sourceMappingURL=woceilinglight.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"woceilinglight.js","sourceRoot":"","sources":["../../src/device/woceilinglight.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"woceilinglight.js","sourceRoot":"","sources":["../../src/device/woceilinglight.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,cAAe,SAAQ,eAAe;IACjD,MAAM,CAAC,YAAY,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eACrD,OAAO,IAAI,KAAK,QAAQ,IAAI,IAAI,GAAG,CAAC,IAAI,IAAI,GAAG,GAAG,EACrD,CAAC;YACD,MAAM,IAAI,SAAS,CAAC,kCAAkC,CAAC,CAAA;QACzD,CAAC;QACD,OAAO,IAAI,CAAC,QAAQ,CAAC,CAAC,IAAI,EAAE,IAAI,EAAE,UAAU,EAAE,GAAG,EAAE,KAAK,EAAE,IAAI,CAAC,CAAC,CAAA;IAClE,CAAC;IAED;;;;OAIG;IACI,KAAK,CAAC,mBAAmB,CAAC,KAAe;QAC9C,MAAM,MAAM,GAAG,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;QACjC,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAA;QACzC,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACxB,MAAM,IAAI,GAAG,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,CAAA;YAChC,IAAI,IAAI,KAAK,IAAI,IAAI,IAAI,KAAK,IAAI,EAAE,CAAC;gBACnC,OAAO,IAAI,KAAK,IAAI,CAAA;YACtB,CAAC;YACD,MAAM,IAAI,KAAK,CAAC,mCAAmC,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC,CAAA;QAC9E,CAAC;QACD,MAAM,IAAI,KAAK,CAAC,+CAA+C,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC,CAAA;IAC1F,CAAC;CACF"}
|
|
@@ -1,6 +1,17 @@
|
|
|
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 WoContact device.
|
|
6
|
+
* @see https://github.com/OpenWonderLabs/SwitchBotAPI-BLE/blob/latest/devicetypes/contactsensor.md
|
|
7
|
+
*/
|
|
3
8
|
export declare class WoContact extends SwitchbotDevice {
|
|
4
|
-
static
|
|
9
|
+
static switchBotBLE: SwitchBotBLE;
|
|
10
|
+
/**
|
|
11
|
+
* Parses the service data for WoContact.
|
|
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>;
|
|
5
16
|
}
|
|
6
17
|
//# sourceMappingURL=wocontact.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wocontact.d.ts","sourceRoot":"","sources":["../../src/device/wocontact.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"wocontact.d.ts","sourceRoot":"","sources":["../../src/device/wocontact.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,SAAU,SAAQ,eAAe;IAC5C,MAAM,CAAC,YAAY,EAAE,YAAY,CAAA;IACjC;;;;OAIG;WACU,gBAAgB,CAC3B,WAAW,EAAE,MAAM,GAClB,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;CAgC1B"}
|
package/dist/device/wocontact.js
CHANGED
|
@@ -1,30 +1,32 @@
|
|
|
1
|
-
/* Copyright(C) 2024, donavanbecker (https://github.com/donavanbecker). All rights reserved.
|
|
2
|
-
*
|
|
3
|
-
* wocontact.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 WoContact device.
|
|
5
|
+
* @see https://github.com/OpenWonderLabs/SwitchBotAPI-BLE/blob/latest/devicetypes/contactsensor.md
|
|
6
|
+
*/
|
|
7
7
|
export class WoContact extends SwitchbotDevice {
|
|
8
|
-
static
|
|
8
|
+
static switchBotBLE;
|
|
9
|
+
/**
|
|
10
|
+
* Parses the service data for WoContact.
|
|
11
|
+
* @param {Buffer} serviceData - The service data buffer.
|
|
12
|
+
* @returns {Promise<object | null>} - Parsed service data or null if invalid.
|
|
13
|
+
*/
|
|
14
|
+
static async parseServiceData(serviceData) {
|
|
9
15
|
if (serviceData.length !== 9) {
|
|
10
|
-
|
|
11
|
-
onlog(`[parseServiceDataForWoContact] Buffer length ${serviceData.length} !== 9!`);
|
|
12
|
-
}
|
|
16
|
+
this.switchBotBLE.emitLog('error', `[parseServiceDataForWoContact] Buffer length ${serviceData.length} !== 9!`);
|
|
13
17
|
return null;
|
|
14
18
|
}
|
|
15
|
-
const byte1 = serviceData
|
|
16
|
-
const byte2 = serviceData.readUInt8(2);
|
|
17
|
-
const byte3 = serviceData.readUInt8(3);
|
|
18
|
-
const byte8 = serviceData.readUInt8(8);
|
|
19
|
+
const [byte1, byte2, byte3, , , , , , byte8] = serviceData;
|
|
19
20
|
const hallState = (byte3 >> 1) & 0b00000011;
|
|
20
|
-
const tested = byte1 & 0b10000000;
|
|
21
|
-
const movement =
|
|
22
|
-
const battery = byte2 & 0b01111111;
|
|
23
|
-
const contact_open = (byte3 & 0b00000010)
|
|
24
|
-
const contact_timeout = (byte3 & 0b00000100)
|
|
25
|
-
const lightLevel = byte3 & 0b00000001;
|
|
21
|
+
const tested = Boolean(byte1 & 0b10000000);
|
|
22
|
+
const movement = Boolean(byte1 & 0b01000000);
|
|
23
|
+
const battery = byte2 & 0b01111111;
|
|
24
|
+
const contact_open = Boolean(byte3 & 0b00000010);
|
|
25
|
+
const contact_timeout = Boolean(byte3 & 0b00000100);
|
|
26
|
+
const lightLevel = byte3 & 0b00000001 ? 'bright' : 'dark';
|
|
26
27
|
const button_count = byte8 & 0b00001111;
|
|
27
|
-
const
|
|
28
|
+
const doorState = hallState === 0 ? 'close' : hallState === 1 ? 'open' : 'timeout no closed';
|
|
29
|
+
return {
|
|
28
30
|
model: SwitchBotBLEModel.ContactSensor,
|
|
29
31
|
modelName: SwitchBotBLEModelName.ContactSensor,
|
|
30
32
|
modelFriendlyName: SwitchBotBLEModelFriendlyName.ContactSensor,
|
|
@@ -33,11 +35,10 @@ export class WoContact extends SwitchbotDevice {
|
|
|
33
35
|
battery,
|
|
34
36
|
contact_open,
|
|
35
37
|
contact_timeout,
|
|
36
|
-
lightLevel
|
|
38
|
+
lightLevel,
|
|
37
39
|
button_count,
|
|
38
|
-
doorState
|
|
40
|
+
doorState,
|
|
39
41
|
};
|
|
40
|
-
return data;
|
|
41
42
|
}
|
|
42
43
|
}
|
|
43
44
|
//# sourceMappingURL=wocontact.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wocontact.js","sourceRoot":"","sources":["../../src/device/wocontact.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"wocontact.js","sourceRoot":"","sources":["../../src/device/wocontact.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,SAAU,SAAQ,eAAe;IAC5C,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,gDAAgD,WAAW,CAAC,MAAM,SAAS,CAAC,CAAA;YAC/G,OAAO,IAAI,CAAA;QACb,CAAC;QAED,MAAM,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,A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