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.
- package/.github/npm-version-script-esm.js +97 -0
- package/.github/workflows/beta-release.yml +1 -1
- package/.github/workflows/release.yml +1 -1
- package/BLE.md +14 -13
- package/CHANGELOG.md +68 -1
- package/OpenAPI.md +13 -12
- package/branding/Node_x_SwitchBot.svg +2 -3
- package/dist/device.d.ts +1193 -3
- package/dist/device.d.ts.map +1 -1
- package/dist/device.js +2478 -2
- package/dist/device.js.map +1 -1
- package/dist/index.d.ts +0 -17
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +0 -17
- package/dist/index.js.map +1 -1
- package/dist/{test/index.test.d.ts.map → index.test.d.ts.map} +1 -1
- package/dist/{test/index.test.js → index.test.js} +1 -1
- package/dist/index.test.js.map +1 -0
- package/dist/parameter-checker.d.ts +1 -1
- package/dist/parameter-checker.d.ts.map +1 -1
- package/dist/settings.d.ts +12 -28
- package/dist/settings.d.ts.map +1 -1
- package/dist/settings.js +24 -22
- package/dist/settings.js.map +1 -1
- package/dist/{test/settings.test.d.ts.map → settings.test.d.ts.map} +1 -1
- package/dist/{test/settings.test.js → settings.test.js} +6 -6
- package/dist/{test/settings.test.js.map → settings.test.js.map} +1 -1
- package/dist/switchbot-ble.d.ts +1 -1
- package/dist/switchbot-ble.d.ts.map +1 -1
- package/dist/switchbot-ble.js +8 -27
- package/dist/switchbot-ble.js.map +1 -1
- package/dist/switchbot-openapi.d.ts +33 -22
- package/dist/switchbot-openapi.d.ts.map +1 -1
- package/dist/switchbot-openapi.js +104 -64
- package/dist/switchbot-openapi.js.map +1 -1
- package/dist/types/bledevicestatus.d.ts +32 -8
- package/dist/types/bledevicestatus.d.ts.map +1 -1
- package/dist/types/devicestatus.d.ts +35 -1
- package/dist/types/devicestatus.d.ts.map +1 -1
- package/dist/types/devicewebhookstatus.d.ts +38 -1
- package/dist/types/devicewebhookstatus.d.ts.map +1 -1
- package/dist/types/types.d.ts +0 -223
- package/dist/types/types.d.ts.map +1 -1
- package/dist/types/types.js +1 -144
- package/dist/types/types.js.map +1 -1
- package/docs/assets/hierarchy.js +1 -0
- package/docs/assets/icons.js +1 -1
- package/docs/assets/icons.svg +1 -1
- package/docs/assets/main.js +5 -5
- package/docs/assets/navigation.js +1 -1
- package/docs/assets/search.js +1 -1
- package/docs/assets/style.css +1405 -1288
- package/docs/classes/Advertising.html +10 -10
- package/docs/classes/SwitchBotBLE.html +13 -13
- package/docs/classes/SwitchBotOpenAPI.html +38 -28
- package/docs/classes/SwitchbotDevice.html +26 -23
- package/docs/classes/WoBlindTilt.html +45 -42
- package/docs/classes/WoBulb.html +42 -39
- package/docs/classes/WoCeilingLight.html +50 -47
- package/docs/classes/WoContact.html +30 -27
- package/docs/classes/WoCurtain.html +40 -37
- package/docs/classes/WoHand.html +37 -34
- package/docs/classes/WoHub2.html +30 -27
- package/docs/classes/WoHumi.html +45 -40
- package/docs/classes/WoHumi2.html +67 -0
- package/docs/classes/WoIOSensorTH.html +30 -27
- package/docs/classes/WoKeypad.html +52 -0
- package/docs/classes/WoLeak.html +53 -0
- package/docs/classes/WoPlugMiniJP.html +78 -0
- package/docs/classes/WoPlugMiniUS.html +39 -36
- package/docs/classes/WoPresence.html +30 -27
- package/docs/classes/WoRelaySwitch1.html +57 -0
- package/docs/classes/WoRelaySwitch1PM.html +57 -0
- package/docs/classes/WoRemote.html +52 -0
- package/docs/classes/WoSensorTH.html +27 -24
- package/docs/classes/WoSensorTHPlus.html +46 -0
- package/docs/classes/WoSensorTHPro.html +46 -0
- package/docs/classes/WoSensorTHProCO2.html +46 -0
- package/docs/classes/WoSmartLock.html +49 -46
- package/docs/classes/WoSmartLockPro.html +49 -46
- package/docs/classes/WoStrip.html +44 -41
- package/docs/enums/LogLevel.html +10 -10
- package/docs/enums/SwitchBotBLEModel.html +29 -27
- package/docs/enums/SwitchBotBLEModelFriendlyName.html +30 -26
- package/docs/enums/SwitchBotBLEModelName.html +28 -26
- package/docs/enums/SwitchBotModel.html +47 -43
- package/docs/hierarchy.html +1 -1
- package/docs/index.html +13 -13
- package/docs/interfaces/AdvertisementData.html +3 -3
- package/docs/interfaces/Chars.html +2 -2
- package/docs/interfaces/ErrorObject.html +2 -2
- package/docs/interfaces/NobleTypes.html +2 -2
- package/docs/interfaces/Params.html +2 -2
- package/docs/interfaces/Rule.html +4 -4
- package/docs/interfaces/ServiceData.html +2 -2
- package/docs/interfaces/SwitchBotBLEDevice.html +23 -23
- package/docs/interfaces/WebhookDetail.html +4 -4
- package/docs/interfaces/ad.html +3 -3
- package/docs/interfaces/body.html +3 -3
- package/docs/interfaces/bodyChange.html +3 -3
- package/docs/interfaces/deleteWebhookResponse.html +3 -3
- package/docs/interfaces/device.html +6 -6
- package/docs/interfaces/deviceList.html +2 -2
- package/docs/interfaces/deviceStatus.html +6 -6
- package/docs/interfaces/deviceStatusRequest.html +3 -3
- package/docs/interfaces/deviceWebhook.html +4 -4
- package/docs/interfaces/deviceWebhookContext.html +4 -4
- package/docs/interfaces/devices.html +3 -3
- package/docs/interfaces/infraredRemoteList.html +2 -2
- package/docs/interfaces/irdevice.html +5 -5
- package/docs/interfaces/pushResponse.html +3 -3
- package/docs/interfaces/queryWebhookResponse.html +3 -3
- package/docs/interfaces/setupWebhookResponse.html +3 -3
- package/docs/interfaces/switchbot.html +2 -2
- package/docs/interfaces/updateWebhookResponse.html +3 -3
- package/docs/interfaces/webhookRequest.html +3 -3
- package/docs/media/BLE.md +14 -13
- package/docs/media/OpenAPI.md +13 -12
- package/docs/modules.html +1 -170
- package/docs/types/MacAddress.html +1 -1
- package/docs/types/batteryCirculatorFan.html +1 -1
- package/docs/types/batteryCirculatorFanServiceData.html +1 -1
- package/docs/types/batteryCirculatorFanStatus.html +1 -1
- package/docs/types/batteryCirculatorFanWebhookContext.html +1 -1
- package/docs/types/blindTilt.html +1 -1
- package/docs/types/blindTiltServiceData.html +1 -1
- package/docs/types/blindTiltStatus.html +1 -1
- package/docs/types/blindTiltWebhookContext.html +1 -1
- package/docs/types/bot.html +1 -1
- package/docs/types/botServiceData.html +1 -1
- package/docs/types/botStatus.html +1 -1
- package/docs/types/botWebhookContext.html +1 -1
- package/docs/types/ceilingLight.html +1 -1
- package/docs/types/ceilingLightPro.html +1 -1
- package/docs/types/ceilingLightProServiceData.html +1 -1
- package/docs/types/ceilingLightProStatus.html +1 -1
- package/docs/types/ceilingLightProWebhookContext.html +1 -1
- package/docs/types/ceilingLightServiceData.html +1 -1
- package/docs/types/ceilingLightStatus.html +1 -1
- package/docs/types/ceilingLightWebhookContext.html +1 -1
- package/docs/types/circulatorFanStatus.html +1 -0
- package/docs/types/circulatorFanWebhookContext.html +1 -0
- package/docs/types/colorBulb.html +1 -1
- package/docs/types/colorBulbServiceData.html +1 -1
- package/docs/types/colorBulbStatus.html +1 -1
- package/docs/types/colorBulbWebhookContext.html +1 -1
- package/docs/types/contactSensor.html +1 -1
- package/docs/types/contactSensorServiceData.html +1 -1
- package/docs/types/contactSensorStatus.html +1 -1
- package/docs/types/contactSensorWebhookContext.html +1 -1
- package/docs/types/curtain.html +1 -1
- package/docs/types/curtain3.html +1 -1
- package/docs/types/curtain3ServiceData.html +1 -1
- package/docs/types/curtain3WebhookContext.html +1 -1
- package/docs/types/curtainServiceData.html +1 -1
- package/docs/types/curtainStatus.html +1 -1
- package/docs/types/curtainWebhookContext.html +1 -1
- package/docs/types/floorCleaningRobotS10.html +1 -1
- package/docs/types/floorCleaningRobotS10Status.html +1 -1
- package/docs/types/floorCleaningRobotS10WebhookContext.html +1 -1
- package/docs/types/hub2.html +1 -1
- package/docs/types/hub2ServiceData.html +1 -1
- package/docs/types/hub2Status.html +1 -1
- package/docs/types/hub2WebhookContext.html +1 -1
- package/docs/types/humidifier.html +1 -1
- package/docs/types/humidifier2ServiceData.html +1 -0
- package/docs/types/humidifier2Status.html +1 -0
- package/docs/types/humidifier2WebhookContext.html +1 -0
- package/docs/types/humidifierServiceData.html +1 -1
- package/docs/types/humidifierStatus.html +1 -1
- package/docs/types/humidifierWebhookContext.html +1 -1
- package/docs/types/indoorCam.html +1 -1
- package/docs/types/indoorCameraWebhookContext.html +1 -1
- package/docs/types/keypad.html +1 -1
- package/docs/types/keypadDetectorServiceData.html +1 -1
- package/docs/types/keypadTouch.html +1 -1
- package/docs/types/keypadTouchWebhookContext.html +1 -1
- package/docs/types/keypadWebhookContext.html +1 -1
- package/docs/types/lock.html +1 -1
- package/docs/types/lockPro.html +1 -1
- package/docs/types/lockProServiceData.html +1 -1
- package/docs/types/lockProStatus.html +1 -1
- package/docs/types/lockProWebhookContext.html +1 -1
- package/docs/types/lockServiceData.html +1 -1
- package/docs/types/lockStatus.html +1 -1
- package/docs/types/lockWebhookContext.html +1 -1
- package/docs/types/meter.html +1 -1
- package/docs/types/meterPlus.html +1 -1
- package/docs/types/meterPlusServiceData.html +1 -1
- package/docs/types/meterPlusStatus.html +1 -1
- package/docs/types/meterPlusWebhookContext.html +1 -1
- package/docs/types/meterPro.html +1 -1
- package/docs/types/meterProCO2ServiceData.html +1 -1
- package/docs/types/meterProCO2Status.html +1 -1
- package/docs/types/meterProCO2WebhookContext.html +1 -1
- package/docs/types/meterProServiceData.html +1 -1
- package/docs/types/meterProStatus.html +1 -1
- package/docs/types/meterProWebhookContext.html +1 -1
- package/docs/types/meterServiceData.html +1 -1
- package/docs/types/meterStatus.html +1 -1
- package/docs/types/meterWebhookContext.html +1 -1
- package/docs/types/motionSensor.html +1 -1
- package/docs/types/motionSensorServiceData.html +1 -1
- package/docs/types/motionSensorStatus.html +1 -1
- package/docs/types/motionSensorWebhookContext.html +1 -1
- package/docs/types/onadvertisement.html +1 -1
- package/docs/types/ondiscover.html +1 -1
- package/docs/types/outdoorMeter.html +1 -1
- package/docs/types/outdoorMeterServiceData.html +1 -1
- package/docs/types/outdoorMeterStatus.html +1 -1
- package/docs/types/outdoorMeterWebhookContext.html +1 -1
- package/docs/types/panTiltCamWebhookContext.html +1 -1
- package/docs/types/pantiltCam.html +1 -1
- package/docs/types/pantiltCam2k.html +1 -1
- package/docs/types/plug.html +1 -1
- package/docs/types/plugMini.html +1 -1
- package/docs/types/plugMiniJPServiceData.html +1 -1
- package/docs/types/plugMiniJPWebhookContext.html +1 -1
- package/docs/types/plugMiniStatus.html +1 -1
- package/docs/types/plugMiniUSServiceData.html +1 -1
- package/docs/types/plugMiniUSWebhookContext.html +1 -1
- package/docs/types/plugStatus.html +1 -1
- package/docs/types/plugWebhookContext.html +1 -1
- package/docs/types/relaySwitch1Context.html +1 -0
- package/docs/types/relaySwitch1PMContext.html +1 -0
- package/docs/types/relaySwitch1PMServiceData.html +1 -1
- package/docs/types/relaySwitch1PMStatus.html +1 -0
- package/docs/types/relaySwitch1ServiceData.html +1 -0
- package/docs/types/relaySwitch1Status.html +1 -0
- package/docs/types/remote.html +1 -1
- package/docs/types/remoteServiceData.html +1 -0
- package/docs/types/robotVacuumCleanerS1.html +1 -1
- package/docs/types/robotVacuumCleanerS1Plus.html +1 -1
- package/docs/types/robotVacuumCleanerS1PlusStatus.html +1 -1
- package/docs/types/robotVacuumCleanerS1PlusWebhookContext.html +1 -1
- package/docs/types/robotVacuumCleanerS1Status.html +1 -1
- package/docs/types/robotVacuumCleanerS1WebhookContext.html +1 -1
- package/docs/types/robotVacuumCleanerServiceData.html +1 -1
- package/docs/types/stripLight.html +1 -1
- package/docs/types/stripLightServiceData.html +1 -1
- package/docs/types/stripLightStatus.html +1 -1
- package/docs/types/stripLightWebhookContext.html +1 -1
- package/docs/types/waterLeakDetector.html +1 -1
- package/docs/types/waterLeakDetectorServiceData.html +1 -1
- package/docs/types/waterLeakDetectorStatus.html +1 -1
- package/docs/types/waterLeakDetectorWebhookContext.html +1 -1
- package/package.json +16 -19
- package/.github/npm-version-script.cjs +0 -81
- package/dist/advertising.d.ts +0 -44
- package/dist/advertising.d.ts.map +0 -1
- package/dist/advertising.js +0 -163
- package/dist/advertising.js.map +0 -1
- package/dist/device/woblindtilt.d.ts +0 -78
- package/dist/device/woblindtilt.d.ts.map +0 -1
- package/dist/device/woblindtilt.js +0 -181
- package/dist/device/woblindtilt.js.map +0 -1
- package/dist/device/wobulb.d.ts +0 -70
- package/dist/device/wobulb.d.ts.map +0 -1
- package/dist/device/wobulb.js +0 -136
- package/dist/device/wobulb.js.map +0 -1
- package/dist/device/woceilinglight.d.ts +0 -74
- package/dist/device/woceilinglight.d.ts.map +0 -1
- package/dist/device/woceilinglight.js +0 -161
- package/dist/device/woceilinglight.js.map +0 -1
- package/dist/device/wocontact.d.ts +0 -19
- package/dist/device/wocontact.d.ts.map +0 -1
- package/dist/device/wocontact.js +0 -48
- package/dist/device/wocontact.js.map +0 -1
- package/dist/device/wocurtain.d.ts +0 -52
- package/dist/device/wocurtain.d.ts.map +0 -1
- package/dist/device/wocurtain.js +0 -135
- package/dist/device/wocurtain.js.map +0 -1
- package/dist/device/wohand.d.ts +0 -50
- package/dist/device/wohand.d.ts.map +0 -1
- package/dist/device/wohand.js +0 -82
- package/dist/device/wohand.js.map +0 -1
- package/dist/device/wohub2.d.ts +0 -19
- package/dist/device/wohub2.d.ts.map +0 -1
- package/dist/device/wohub2.js +0 -40
- package/dist/device/wohub2.js.map +0 -1
- package/dist/device/wohumi.d.ts +0 -50
- package/dist/device/wohumi.d.ts.map +0 -1
- package/dist/device/wohumi.js +0 -89
- package/dist/device/wohumi.js.map +0 -1
- package/dist/device/woiosensorth.d.ts +0 -20
- package/dist/device/woiosensorth.d.ts.map +0 -1
- package/dist/device/woiosensorth.js +0 -49
- package/dist/device/woiosensorth.js.map +0 -1
- package/dist/device/wokeypad.d.ts +0 -19
- package/dist/device/wokeypad.d.ts.map +0 -1
- package/dist/device/wokeypad.js +0 -51
- package/dist/device/wokeypad.js.map +0 -1
- package/dist/device/woleak.d.ts +0 -20
- package/dist/device/woleak.d.ts.map +0 -1
- package/dist/device/woleak.js +0 -52
- package/dist/device/woleak.js.map +0 -1
- package/dist/device/woplugmini.d.ts +0 -52
- package/dist/device/woplugmini.d.ts.map +0 -1
- package/dist/device/woplugmini.js +0 -110
- package/dist/device/woplugmini.js.map +0 -1
- package/dist/device/woplugmini_jp.d.ts +0 -52
- package/dist/device/woplugmini_jp.d.ts.map +0 -1
- package/dist/device/woplugmini_jp.js +0 -110
- package/dist/device/woplugmini_jp.js.map +0 -1
- package/dist/device/wopresence.d.ts +0 -19
- package/dist/device/wopresence.d.ts.map +0 -1
- package/dist/device/wopresence.js +0 -39
- package/dist/device/wopresence.js.map +0 -1
- package/dist/device/worelayswitch1plus.d.ts +0 -36
- package/dist/device/worelayswitch1plus.d.ts.map +0 -1
- package/dist/device/worelayswitch1plus.js +0 -141
- package/dist/device/worelayswitch1plus.js.map +0 -1
- package/dist/device/worelayswitch1pm.d.ts +0 -36
- package/dist/device/worelayswitch1pm.d.ts.map +0 -1
- package/dist/device/worelayswitch1pm.js +0 -144
- package/dist/device/worelayswitch1pm.js.map +0 -1
- package/dist/device/wosensorth.d.ts +0 -13
- package/dist/device/wosensorth.d.ts.map +0 -1
- package/dist/device/wosensorth.js +0 -38
- package/dist/device/wosensorth.js.map +0 -1
- package/dist/device/wosensorthplus.d.ts +0 -13
- package/dist/device/wosensorthplus.d.ts.map +0 -1
- package/dist/device/wosensorthplus.js +0 -38
- package/dist/device/wosensorthplus.js.map +0 -1
- package/dist/device/wosensorthpro.d.ts +0 -13
- package/dist/device/wosensorthpro.d.ts.map +0 -1
- package/dist/device/wosensorthpro.js +0 -38
- package/dist/device/wosensorthpro.js.map +0 -1
- package/dist/device/wosensorthproco2.d.ts +0 -13
- package/dist/device/wosensorthproco2.d.ts.map +0 -1
- package/dist/device/wosensorthproco2.js +0 -40
- package/dist/device/wosensorthproco2.js.map +0 -1
- package/dist/device/wosmartlock.d.ts +0 -86
- package/dist/device/wosmartlock.d.ts.map +0 -1
- package/dist/device/wosmartlock.js +0 -198
- package/dist/device/wosmartlock.js.map +0 -1
- package/dist/device/wosmartlockpro.d.ts +0 -86
- package/dist/device/wosmartlockpro.d.ts.map +0 -1
- package/dist/device/wosmartlockpro.js +0 -200
- package/dist/device/wosmartlockpro.js.map +0 -1
- package/dist/device/wostrip.d.ts +0 -63
- package/dist/device/wostrip.d.ts.map +0 -1
- package/dist/device/wostrip.js +0 -131
- package/dist/device/wostrip.js.map +0 -1
- package/dist/test/advertising.test.d.ts +0 -2
- package/dist/test/advertising.test.d.ts.map +0 -1
- package/dist/test/advertising.test.js +0 -99
- package/dist/test/advertising.test.js.map +0 -1
- package/dist/test/device.test.d.ts +0 -2
- package/dist/test/device.test.d.ts.map +0 -1
- package/dist/test/device.test.js +0 -38
- package/dist/test/device.test.js.map +0 -1
- package/dist/test/index.test.js.map +0 -1
- package/dist/test/parameter-checker.test.d.ts +0 -2
- package/dist/test/parameter-checker.test.d.ts.map +0 -1
- package/dist/test/parameter-checker.test.js +0 -108
- package/dist/test/parameter-checker.test.js.map +0 -1
- package/dist/test/switchbot-ble.test.d.ts +0 -2
- package/dist/test/switchbot-ble.test.d.ts.map +0 -1
- package/dist/test/switchbot-ble.test.js +0 -45
- package/dist/test/switchbot-ble.test.js.map +0 -1
- package/dist/test/switchbot-openapi.test.d.ts +0 -2
- package/dist/test/switchbot-openapi.test.d.ts.map +0 -1
- package/dist/test/switchbot-openapi.test.js +0 -96
- package/dist/test/switchbot-openapi.test.js.map +0 -1
- package/dist/test/woblindtilt.test.d.ts +0 -2
- package/dist/test/woblindtilt.test.d.ts.map +0 -1
- package/dist/test/woblindtilt.test.js +0 -76
- package/dist/test/woblindtilt.test.js.map +0 -1
- package/dist/test/wobulb.test.d.ts +0 -2
- package/dist/test/wobulb.test.d.ts.map +0 -1
- package/dist/test/wobulb.test.js +0 -95
- package/dist/test/wobulb.test.js.map +0 -1
- package/dist/test/woceilinglight.test.d.ts +0 -2
- package/dist/test/woceilinglight.test.d.ts.map +0 -1
- package/dist/test/woceilinglight.test.js +0 -81
- package/dist/test/woceilinglight.test.js.map +0 -1
- package/dist/test/wocontact.test.d.ts +0 -2
- package/dist/test/wocontact.test.d.ts.map +0 -1
- package/dist/test/wocontact.test.js +0 -65
- package/dist/test/wocontact.test.js.map +0 -1
- package/dist/test/wocurtain.test.d.ts +0 -2
- package/dist/test/wocurtain.test.d.ts.map +0 -1
- package/dist/test/wocurtain.test.js +0 -75
- package/dist/test/wocurtain.test.js.map +0 -1
- package/dist/test/wohand.test.d.ts +0 -2
- package/dist/test/wohand.test.d.ts.map +0 -1
- package/dist/test/wohand.test.js +0 -56
- package/dist/test/wohand.test.js.map +0 -1
- package/dist/test/wohub2.test.d.ts +0 -2
- package/dist/test/wohub2.test.d.ts.map +0 -1
- package/dist/test/wohub2.test.js +0 -80
- package/dist/test/wohub2.test.js.map +0 -1
- package/dist/test/wohumi.test.d.ts +0 -2
- package/dist/test/wohumi.test.d.ts.map +0 -1
- package/dist/test/wohumi.test.js +0 -82
- package/dist/test/wohumi.test.js.map +0 -1
- package/dist/test/woiosensorth.test.d.ts +0 -2
- package/dist/test/woiosensorth.test.d.ts.map +0 -1
- package/dist/test/woiosensorth.test.js +0 -40
- package/dist/test/woiosensorth.test.js.map +0 -1
- package/dist/test/wokeypad.test.d.ts +0 -2
- package/dist/test/wokeypad.test.d.ts.map +0 -1
- package/dist/test/wokeypad.test.js +0 -46
- package/dist/test/wokeypad.test.js.map +0 -1
- package/dist/test/woleak.test.d.ts +0 -2
- package/dist/test/woleak.test.d.ts.map +0 -1
- package/dist/test/woleak.test.js +0 -51
- package/dist/test/woleak.test.js.map +0 -1
- package/dist/test/woplugmini.test.d.ts +0 -2
- package/dist/test/woplugmini.test.d.ts.map +0 -1
- package/dist/test/woplugmini.test.js +0 -90
- package/dist/test/woplugmini.test.js.map +0 -1
- package/dist/test/woplugmini_jp.test.d.ts +0 -2
- package/dist/test/woplugmini_jp.test.d.ts.map +0 -1
- package/dist/test/woplugmini_jp.test.js +0 -90
- package/dist/test/woplugmini_jp.test.js.map +0 -1
- package/dist/test/wopresence.test.d.ts +0 -2
- package/dist/test/wopresence.test.d.ts.map +0 -1
- package/dist/test/wopresence.test.js +0 -68
- package/dist/test/wopresence.test.js.map +0 -1
- package/dist/test/wosensorth.test.d.ts +0 -2
- package/dist/test/wosensorth.test.d.ts.map +0 -1
- package/dist/test/wosensorth.test.js +0 -29
- package/dist/test/wosensorth.test.js.map +0 -1
- package/dist/test/wosensorthplus.test.d.ts +0 -2
- package/dist/test/wosensorthplus.test.d.ts.map +0 -1
- package/dist/test/wosensorthplus.test.js +0 -29
- package/dist/test/wosensorthplus.test.js.map +0 -1
- package/dist/test/wosensorthpro.test.d.ts +0 -2
- package/dist/test/wosensorthpro.test.d.ts.map +0 -1
- package/dist/test/wosensorthpro.test.js +0 -29
- package/dist/test/wosensorthpro.test.js.map +0 -1
- package/dist/test/wosensorthproco2.test.d.ts +0 -2
- package/dist/test/wosensorthproco2.test.d.ts.map +0 -1
- package/dist/test/wosensorthproco2.test.js +0 -32
- package/dist/test/wosensorthproco2.test.js.map +0 -1
- package/dist/test/wosmartlock.test.d.ts +0 -2
- package/dist/test/wosmartlock.test.d.ts.map +0 -1
- package/dist/test/wosmartlock.test.js +0 -151
- package/dist/test/wosmartlock.test.js.map +0 -1
- package/dist/test/wosmartlockpro.test.d.ts +0 -2
- package/dist/test/wosmartlockpro.test.d.ts.map +0 -1
- package/dist/test/wosmartlockpro.test.js +0 -150
- package/dist/test/wosmartlockpro.test.js.map +0 -1
- package/dist/test/wostrip.test.d.ts +0 -2
- package/dist/test/wostrip.test.d.ts.map +0 -1
- package/dist/test/wostrip.test.js +0 -102
- package/dist/test/wostrip.test.js.map +0 -1
- package/docs/types/relaySwitch1PlusServiceData.html +0 -1
- /package/dist/{test/index.test.d.ts → index.test.d.ts} +0 -0
- /package/dist/{test/settings.test.d.ts → settings.test.d.ts} +0 -0
package/dist/device/wobulb.js
DELETED
|
@@ -1,136 +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 WoBulb device.
|
|
6
|
-
* @see https://github.com/OpenWonderLabs/SwitchBotAPI-BLE/blob/latest/devicetypes/colorbulb.md
|
|
7
|
-
*/
|
|
8
|
-
export class WoBulb extends SwitchbotDevice {
|
|
9
|
-
/**
|
|
10
|
-
* Parses the service data for WoBulb.
|
|
11
|
-
* @param {Buffer} serviceData - The service data buffer.
|
|
12
|
-
* @param {Buffer} manufacturerData - The manufacturer data buffer.
|
|
13
|
-
* @param {Function} emitLog - The function to emit log messages.
|
|
14
|
-
* @returns {Promise<colorBulbServiceData | null>} - Parsed service data or null if invalid.
|
|
15
|
-
*/
|
|
16
|
-
static async parseServiceData(serviceData, manufacturerData,
|
|
17
|
-
// eslint-disable-next-line unused-imports/no-unused-vars
|
|
18
|
-
emitLog) {
|
|
19
|
-
if (serviceData.length !== 18) {
|
|
20
|
-
// emitLog('debugerror', `[parseServiceDataForWoBulb] Buffer length ${serviceData.length} !== 18!`)
|
|
21
|
-
return null;
|
|
22
|
-
}
|
|
23
|
-
if (manufacturerData.length !== 13) {
|
|
24
|
-
// emitLog('debugerror', `[parseServiceDataForWoBulb] Buffer length ${manufacturerData.length} !== 13!`)
|
|
25
|
-
return null;
|
|
26
|
-
}
|
|
27
|
-
const [, byte1, , byte3, byte4, byte5, byte6, byte7, byte8, byte9, byte10,] = manufacturerData;
|
|
28
|
-
const data = {
|
|
29
|
-
model: SwitchBotBLEModel.ColorBulb,
|
|
30
|
-
modelName: SwitchBotBLEModelName.ColorBulb,
|
|
31
|
-
modelFriendlyName: SwitchBotBLEModelFriendlyName.ColorBulb,
|
|
32
|
-
power: !!byte1,
|
|
33
|
-
red: byte3,
|
|
34
|
-
green: byte4,
|
|
35
|
-
blue: byte5,
|
|
36
|
-
color_temperature: byte6,
|
|
37
|
-
state: !!(byte7 & 0b01111111),
|
|
38
|
-
brightness: byte7 & 0b01111111,
|
|
39
|
-
delay: (byte8 & 0b10000000) >> 7,
|
|
40
|
-
preset: (byte8 & 0b00001000) >> 3,
|
|
41
|
-
color_mode: byte8 & 0b00000111,
|
|
42
|
-
speed: byte9 & 0b01111111,
|
|
43
|
-
loop_index: byte10 & 0b11111110,
|
|
44
|
-
};
|
|
45
|
-
return data;
|
|
46
|
-
}
|
|
47
|
-
constructor(peripheral, noble) {
|
|
48
|
-
super(peripheral, noble);
|
|
49
|
-
}
|
|
50
|
-
/**
|
|
51
|
-
* Reads the state of the bulb.
|
|
52
|
-
* @returns {Promise<boolean>} - Resolves with a boolean indicating whether the bulb is ON (true) or OFF (false).
|
|
53
|
-
*/
|
|
54
|
-
async readState() {
|
|
55
|
-
return this.operateBulb([0x57, 0x0F, 0x48, 0x01]);
|
|
56
|
-
}
|
|
57
|
-
/**
|
|
58
|
-
* Sets the state of the bulb.
|
|
59
|
-
* @param {number[]} reqByteArray - The request byte array.
|
|
60
|
-
* @returns {Promise<boolean>} - Resolves with a boolean indicating whether the operation was successful.
|
|
61
|
-
* @private
|
|
62
|
-
*/
|
|
63
|
-
async setState(reqByteArray) {
|
|
64
|
-
const base = [0x57, 0x0F, 0x47, 0x01];
|
|
65
|
-
return this.operateBulb(base.concat(reqByteArray));
|
|
66
|
-
}
|
|
67
|
-
/**
|
|
68
|
-
* Turns on the bulb.
|
|
69
|
-
* @returns {Promise<boolean>} - Resolves with a boolean indicating whether the bulb is ON (true).
|
|
70
|
-
*/
|
|
71
|
-
async turnOn() {
|
|
72
|
-
return this.setState([0x01, 0x01]);
|
|
73
|
-
}
|
|
74
|
-
/**
|
|
75
|
-
* Turns off the bulb.
|
|
76
|
-
* @returns {Promise<boolean>} - Resolves with a boolean indicating whether the bulb is OFF (false).
|
|
77
|
-
*/
|
|
78
|
-
async turnOff() {
|
|
79
|
-
return this.setState([0x01, 0x02]);
|
|
80
|
-
}
|
|
81
|
-
/**
|
|
82
|
-
* Sets the brightness of the bulb.
|
|
83
|
-
* @param {number} brightness - The brightness percentage (0-100).
|
|
84
|
-
* @returns {Promise<boolean>} - Resolves with a boolean indicating whether the operation was successful.
|
|
85
|
-
*/
|
|
86
|
-
async setBrightness(brightness) {
|
|
87
|
-
if (brightness < 0 || brightness > 100) {
|
|
88
|
-
throw new RangeError('Brightness must be between 0 and 100');
|
|
89
|
-
}
|
|
90
|
-
return this.setState([0x02, 0x14, brightness]);
|
|
91
|
-
}
|
|
92
|
-
/**
|
|
93
|
-
* Sets the color temperature of the bulb.
|
|
94
|
-
* @param {number} color_temperature - The color temperature percentage (0-100).
|
|
95
|
-
* @returns {Promise<boolean>} - Resolves with a boolean indicating whether the operation was successful.
|
|
96
|
-
*/
|
|
97
|
-
async setColorTemperature(color_temperature) {
|
|
98
|
-
if (color_temperature < 0 || color_temperature > 100) {
|
|
99
|
-
throw new RangeError('Color temperature must be between 0 and 100');
|
|
100
|
-
}
|
|
101
|
-
return this.setState([0x02, 0x17, color_temperature]);
|
|
102
|
-
}
|
|
103
|
-
/**
|
|
104
|
-
* Sets the RGB color of the bulb.
|
|
105
|
-
* @param {number} brightness - The brightness percentage (0-100).
|
|
106
|
-
* @param {number} red - The red color value (0-255).
|
|
107
|
-
* @param {number} green - The green color value (0-255).
|
|
108
|
-
* @param {number} blue - The blue color value (0-255).
|
|
109
|
-
* @returns {Promise<boolean>} - Resolves with a boolean indicating whether the operation was successful.
|
|
110
|
-
*/
|
|
111
|
-
async setRGB(brightness, red, green, blue) {
|
|
112
|
-
if (brightness < 0 || brightness > 100 || red < 0 || red > 255 || green < 0 || green > 255 || blue < 0 || blue > 255) {
|
|
113
|
-
throw new RangeError('Invalid RGB or brightness values');
|
|
114
|
-
}
|
|
115
|
-
return this.setState([0x02, 0x12, brightness, red, green, blue]);
|
|
116
|
-
}
|
|
117
|
-
/**
|
|
118
|
-
* Sends a command to the bulb.
|
|
119
|
-
* @param {number[]} bytes - The command bytes.
|
|
120
|
-
* @returns {Promise<boolean>} - Resolves with a boolean indicating whether the operation was successful.
|
|
121
|
-
* @private
|
|
122
|
-
*/
|
|
123
|
-
async operateBulb(bytes) {
|
|
124
|
-
const reqBuf = Buffer.from(bytes);
|
|
125
|
-
const resBuf = await this.command(reqBuf);
|
|
126
|
-
if (resBuf.length === 2) {
|
|
127
|
-
const code = resBuf.readUInt8(1);
|
|
128
|
-
if (code === 0x00 || code === 0x80) {
|
|
129
|
-
return code === 0x80;
|
|
130
|
-
}
|
|
131
|
-
throw new Error(`The device returned an error: 0x${resBuf.toString('hex')}`);
|
|
132
|
-
}
|
|
133
|
-
throw new Error(`Expecting a 2-byte response, got instead: 0x${resBuf.toString('hex')}`);
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
//# sourceMappingURL=wobulb.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"wobulb.js","sourceRoot":"","sources":["../../src/device/wobulb.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,MAAO,SAAQ,eAAe;IACzC;;;;;;OAMG;IACH,MAAM,CAAC,KAAK,CAAC,gBAAgB,CAC3B,WAAmB,EACnB,gBAAwB;IACxB,yDAAyD;IACzD,OAAiD;QAEjD,IAAI,WAAW,CAAC,MAAM,KAAK,EAAE,EAAE,CAAC;YAC9B,mGAAmG;YACnG,OAAO,IAAI,CAAA;QACb,CAAC;QACD,IAAI,gBAAgB,CAAC,MAAM,KAAK,EAAE,EAAE,CAAC;YACnC,wGAAwG;YACxG,OAAO,IAAI,CAAA;QACb,CAAC;QAED,MAAM,CACJ,AADK,EACH,KAAK,EAAE,AAAD,EACR,KAAK,EACL,KAAK,EACL,KAAK,EACL,KAAK,EAC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E,GAAG,EAAE,KAAK,EAAE,IAAI,CAAC,CAAC,CAAA;IAClE,CAAC;IAED;;;;;OAKG;IACK,KAAK,CAAC,WAAW,CAAC,KAAe;QACvC,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,74 +0,0 @@
|
|
|
1
|
-
import type { ceilingLightProServiceData, ceilingLightServiceData } 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 WoCeilingLight device.
|
|
7
|
-
* @see https://github.com/OpenWonderLabs/SwitchBotAPI-BLE/blob/latest/devicetypes/colorbulb.md
|
|
8
|
-
*/
|
|
9
|
-
export declare class WoCeilingLight extends SwitchbotDevice {
|
|
10
|
-
/**
|
|
11
|
-
* Parses the service data for WoCeilingLight.
|
|
12
|
-
* @param {Buffer} manufacturerData - The manufacturer data buffer.
|
|
13
|
-
* @param {Function} emitLog - The function to emit log messages.
|
|
14
|
-
* @returns {Promise<ceilingLightServiceData | null>} - Parsed service data or null if invalid.
|
|
15
|
-
*/
|
|
16
|
-
static parseServiceData(manufacturerData: Buffer, emitLog: (level: string, message: string) => void): Promise<ceilingLightServiceData | null>;
|
|
17
|
-
/**
|
|
18
|
-
* Parses the service data for WoCeilingLight Pro.
|
|
19
|
-
* @param {Buffer} manufacturerData - The manufacturer data buffer.
|
|
20
|
-
* @param {Function} emitLog - The function to emit log messages.
|
|
21
|
-
* @returns {Promise<ceilingLightProServiceData | null>} - Parsed service data or null if invalid.
|
|
22
|
-
*/
|
|
23
|
-
static parseServiceData_Pro(manufacturerData: Buffer, emitLog: (level: string, message: string) => void): Promise<ceilingLightProServiceData | null>;
|
|
24
|
-
constructor(peripheral: NobleTypes['peripheral'], noble: NobleTypes['noble']);
|
|
25
|
-
/**
|
|
26
|
-
* Reads the state of the ceiling light.
|
|
27
|
-
* @returns {Promise<boolean>} - Resolves with a boolean indicating whether the light is ON (true) or OFF (false).
|
|
28
|
-
*/
|
|
29
|
-
readState(): Promise<boolean>;
|
|
30
|
-
/**
|
|
31
|
-
* Sets the state of the ceiling light.
|
|
32
|
-
* @param {number[]} reqByteArray - The request byte array.
|
|
33
|
-
* @returns {Promise<boolean>} - Resolves with a boolean indicating whether the operation was successful.
|
|
34
|
-
*/
|
|
35
|
-
setState(reqByteArray: number[]): Promise<boolean>;
|
|
36
|
-
/**
|
|
37
|
-
* Turns on the ceiling light.
|
|
38
|
-
* @returns {Promise<boolean>} - Resolves with a boolean indicating whether the light is ON (true).
|
|
39
|
-
*/
|
|
40
|
-
turnOn(): Promise<boolean>;
|
|
41
|
-
/**
|
|
42
|
-
* Turns off the ceiling light.
|
|
43
|
-
* @returns {Promise<boolean>} - Resolves with a boolean indicating whether the light is OFF (false).
|
|
44
|
-
*/
|
|
45
|
-
turnOff(): Promise<boolean>;
|
|
46
|
-
/**
|
|
47
|
-
* Sets the brightness of the ceiling light.
|
|
48
|
-
* @param {number} brightness - The brightness percentage (0-100).
|
|
49
|
-
* @returns {Promise<boolean>} - Resolves with a boolean indicating whether the operation was successful.
|
|
50
|
-
*/
|
|
51
|
-
setBrightness(brightness: number): Promise<boolean>;
|
|
52
|
-
/**
|
|
53
|
-
* Sets the color temperature of the ceiling light.
|
|
54
|
-
* @param {number} color_temperature - The color temperature percentage (0-100).
|
|
55
|
-
* @returns {Promise<boolean>} - Resolves with a boolean indicating whether the operation was successful.
|
|
56
|
-
*/
|
|
57
|
-
setColorTemperature(color_temperature: number): Promise<boolean>;
|
|
58
|
-
/**
|
|
59
|
-
* Sets the RGB color of the ceiling light.
|
|
60
|
-
* @param {number} brightness - The brightness percentage (0-100).
|
|
61
|
-
* @param {number} red - The red color value (0-255).
|
|
62
|
-
* @param {number} green - The green color value (0-255).
|
|
63
|
-
* @param {number} blue - The blue color value (0-255).
|
|
64
|
-
* @returns {Promise<boolean>} - Resolves with a boolean indicating whether the operation was successful.
|
|
65
|
-
*/
|
|
66
|
-
setRGB(brightness: number, red: number, green: number, blue: number): Promise<boolean>;
|
|
67
|
-
/**
|
|
68
|
-
* Sends a command to the ceiling light.
|
|
69
|
-
* @param {number[]} bytes - The command bytes.
|
|
70
|
-
* @returns {Promise<boolean>} - Resolves with a boolean indicating whether the operation was successful.
|
|
71
|
-
*/
|
|
72
|
-
operateCeilingLight(bytes: number[]): Promise<boolean>;
|
|
73
|
-
}
|
|
74
|
-
//# sourceMappingURL=woceilinglight.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"woceilinglight.d.ts","sourceRoot":"","sources":["../../src/device/woceilinglight.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,0BAA0B,EAAE,uBAAuB,EAAE,MAAM,6BAA6B,CAAA;AACtG,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAA;AAEnD,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AAEpC,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AAG9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er';
|
|
2
|
-
import { SwitchbotDevice } from '../device.js';
|
|
3
|
-
import { SwitchBotBLEModel, SwitchBotBLEModelFriendlyName, SwitchBotBLEModelName } from '../types/types.js';
|
|
4
|
-
/**
|
|
5
|
-
* Class representing a WoCeilingLight device.
|
|
6
|
-
* @see https://github.com/OpenWonderLabs/SwitchBotAPI-BLE/blob/latest/devicetypes/colorbulb.md
|
|
7
|
-
*/
|
|
8
|
-
export class WoCeilingLight extends SwitchbotDevice {
|
|
9
|
-
/**
|
|
10
|
-
* Parses the service data for WoCeilingLight.
|
|
11
|
-
* @param {Buffer} manufacturerData - The manufacturer data buffer.
|
|
12
|
-
* @param {Function} emitLog - The function to emit log messages.
|
|
13
|
-
* @returns {Promise<ceilingLightServiceData | null>} - Parsed service data or null if invalid.
|
|
14
|
-
*/
|
|
15
|
-
static async parseServiceData(manufacturerData, emitLog) {
|
|
16
|
-
if (manufacturerData.length !== 13) {
|
|
17
|
-
emitLog('debugerror', `[parseServiceDataForWoCeilingLight] Buffer length ${manufacturerData.length} !== 13!`);
|
|
18
|
-
return null;
|
|
19
|
-
}
|
|
20
|
-
const [, byte1, , byte3, byte4, byte5, byte6, byte7, byte8, byte9, byte10,] = manufacturerData;
|
|
21
|
-
const data = {
|
|
22
|
-
model: SwitchBotBLEModel.CeilingLight,
|
|
23
|
-
modelName: SwitchBotBLEModelName.CeilingLight,
|
|
24
|
-
modelFriendlyName: SwitchBotBLEModelFriendlyName.CeilingLight,
|
|
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) ? 1 : 0,
|
|
33
|
-
preset: (byte8 & 0b00001000) ? 1 : 0,
|
|
34
|
-
color_mode: byte8 & 0b00000111,
|
|
35
|
-
speed: byte9 & 0b01111111,
|
|
36
|
-
loop_index: byte10 & 0b11111110,
|
|
37
|
-
};
|
|
38
|
-
return data;
|
|
39
|
-
}
|
|
40
|
-
/**
|
|
41
|
-
* Parses the service data for WoCeilingLight Pro.
|
|
42
|
-
* @param {Buffer} manufacturerData - The manufacturer data buffer.
|
|
43
|
-
* @param {Function} emitLog - The function to emit log messages.
|
|
44
|
-
* @returns {Promise<ceilingLightProServiceData | null>} - Parsed service data or null if invalid.
|
|
45
|
-
*/
|
|
46
|
-
static async parseServiceData_Pro(manufacturerData, emitLog) {
|
|
47
|
-
if (manufacturerData.length !== 13) {
|
|
48
|
-
emitLog('debugerror', `[parseServiceDataForWoCeilingLightPro] Buffer length ${manufacturerData.length} !== 13!`);
|
|
49
|
-
return null;
|
|
50
|
-
}
|
|
51
|
-
const [, byte1, , byte3, byte4, byte5, byte6, byte7, byte8, byte9, byte10,] = manufacturerData;
|
|
52
|
-
const data = {
|
|
53
|
-
model: SwitchBotBLEModel.CeilingLightPro,
|
|
54
|
-
modelName: SwitchBotBLEModelName.CeilingLightPro,
|
|
55
|
-
modelFriendlyName: SwitchBotBLEModelFriendlyName.CeilingLightPro,
|
|
56
|
-
power: !!byte1,
|
|
57
|
-
red: byte3,
|
|
58
|
-
green: byte4,
|
|
59
|
-
blue: byte5,
|
|
60
|
-
color_temperature: byte6,
|
|
61
|
-
state: !!(byte7 & 0b01111111),
|
|
62
|
-
brightness: byte7 & 0b01111111,
|
|
63
|
-
delay: (byte8 & 0b10000000) ? 1 : 0,
|
|
64
|
-
preset: (byte8 & 0b00001000) ? 1 : 0,
|
|
65
|
-
color_mode: byte8 & 0b00000111,
|
|
66
|
-
speed: byte9 & 0b01111111,
|
|
67
|
-
loop_index: byte10 & 0b11111110,
|
|
68
|
-
};
|
|
69
|
-
return data;
|
|
70
|
-
}
|
|
71
|
-
constructor(peripheral, noble) {
|
|
72
|
-
super(peripheral, noble);
|
|
73
|
-
}
|
|
74
|
-
/**
|
|
75
|
-
* Reads the state of the ceiling light.
|
|
76
|
-
* @returns {Promise<boolean>} - Resolves with a boolean indicating whether the light is ON (true) or OFF (false).
|
|
77
|
-
*/
|
|
78
|
-
async readState() {
|
|
79
|
-
return this.operateCeilingLight([0x57, 0x0F, 0x48, 0x01]);
|
|
80
|
-
}
|
|
81
|
-
/**
|
|
82
|
-
* Sets the state of the ceiling light.
|
|
83
|
-
* @param {number[]} reqByteArray - The request byte array.
|
|
84
|
-
* @returns {Promise<boolean>} - Resolves with a boolean indicating whether the operation was successful.
|
|
85
|
-
*/
|
|
86
|
-
async setState(reqByteArray) {
|
|
87
|
-
const base = [0x57, 0x0F, 0x47, 0x01];
|
|
88
|
-
return this.operateCeilingLight(base.concat(reqByteArray));
|
|
89
|
-
}
|
|
90
|
-
/**
|
|
91
|
-
* Turns on the ceiling light.
|
|
92
|
-
* @returns {Promise<boolean>} - Resolves with a boolean indicating whether the light is ON (true).
|
|
93
|
-
*/
|
|
94
|
-
async turnOn() {
|
|
95
|
-
return this.setState([0x01, 0x01]);
|
|
96
|
-
}
|
|
97
|
-
/**
|
|
98
|
-
* Turns off the ceiling light.
|
|
99
|
-
* @returns {Promise<boolean>} - Resolves with a boolean indicating whether the light is OFF (false).
|
|
100
|
-
*/
|
|
101
|
-
async turnOff() {
|
|
102
|
-
return this.setState([0x01, 0x02]);
|
|
103
|
-
}
|
|
104
|
-
/**
|
|
105
|
-
* Sets the brightness of the ceiling light.
|
|
106
|
-
* @param {number} brightness - The brightness percentage (0-100).
|
|
107
|
-
* @returns {Promise<boolean>} - Resolves with a boolean indicating whether the operation was successful.
|
|
108
|
-
*/
|
|
109
|
-
async setBrightness(brightness) {
|
|
110
|
-
if (typeof brightness !== 'number' || brightness < 0 || brightness > 100) {
|
|
111
|
-
throw new TypeError(`Invalid brightness value: ${brightness}`);
|
|
112
|
-
}
|
|
113
|
-
return this.setState([0x02, 0x14, brightness]);
|
|
114
|
-
}
|
|
115
|
-
/**
|
|
116
|
-
* Sets the color temperature of the ceiling light.
|
|
117
|
-
* @param {number} color_temperature - The color temperature percentage (0-100).
|
|
118
|
-
* @returns {Promise<boolean>} - Resolves with a boolean indicating whether the operation was successful.
|
|
119
|
-
*/
|
|
120
|
-
async setColorTemperature(color_temperature) {
|
|
121
|
-
if (typeof color_temperature !== 'number' || color_temperature < 0 || color_temperature > 100) {
|
|
122
|
-
throw new TypeError(`Invalid color temperature value: ${color_temperature}`);
|
|
123
|
-
}
|
|
124
|
-
return this.setState([0x02, 0x17, color_temperature]);
|
|
125
|
-
}
|
|
126
|
-
/**
|
|
127
|
-
* Sets the RGB color of the ceiling light.
|
|
128
|
-
* @param {number} brightness - The brightness percentage (0-100).
|
|
129
|
-
* @param {number} red - The red color value (0-255).
|
|
130
|
-
* @param {number} green - The green color value (0-255).
|
|
131
|
-
* @param {number} blue - The blue color value (0-255).
|
|
132
|
-
* @returns {Promise<boolean>} - Resolves with a boolean indicating whether the operation was successful.
|
|
133
|
-
*/
|
|
134
|
-
async setRGB(brightness, red, green, blue) {
|
|
135
|
-
if (typeof brightness !== 'number' || brightness < 0 || brightness > 100
|
|
136
|
-
|| typeof red !== 'number' || red < 0 || red > 255
|
|
137
|
-
|| typeof green !== 'number' || green < 0 || green > 255
|
|
138
|
-
|| typeof blue !== 'number' || blue < 0 || blue > 255) {
|
|
139
|
-
throw new TypeError('Invalid RGB or brightness values');
|
|
140
|
-
}
|
|
141
|
-
return this.setState([0x02, 0x12, brightness, red, green, blue]);
|
|
142
|
-
}
|
|
143
|
-
/**
|
|
144
|
-
* Sends a command to the ceiling light.
|
|
145
|
-
* @param {number[]} bytes - The command bytes.
|
|
146
|
-
* @returns {Promise<boolean>} - Resolves with a boolean indicating whether the operation was successful.
|
|
147
|
-
*/
|
|
148
|
-
async operateCeilingLight(bytes) {
|
|
149
|
-
const reqBuf = Buffer.from(bytes);
|
|
150
|
-
const resBuf = await this.command(reqBuf);
|
|
151
|
-
if (resBuf.length === 2) {
|
|
152
|
-
const code = resBuf.readUInt8(1);
|
|
153
|
-
if (code === 0x00 || code === 0x80) {
|
|
154
|
-
return code === 0x80;
|
|
155
|
-
}
|
|
156
|
-
throw new Error(`The device returned an error: 0x${resBuf.toString('hex')}`);
|
|
157
|
-
}
|
|
158
|
-
throw new Error(`Expecting a 2-byte response, got instead: 0x${resBuf.toString('hex')}`);
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
//# sourceMappingURL=woceilinglight.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"woceilinglight.js","sourceRoot":"","sources":["../../src/device/woceilinglight.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,cAAe,SAAQ,eAAe;IACjD;;;;;OAKG;IACH,MAAM,CAAC,KAAK,CAAC,gBAAgB,CAC3B,gBAAwB,EACxB,OAAiD;QAEjD,IAAI,gBAAgB,CAAC,MAAM,KAAK,EAAE,EAAE,CAAC;YACnC,OAAO,CAAC,YAAY,EAAE,qDAAqD,gBAAgB,CAAC,MAAM,UAAU,CAAC,CAAA;YAC7G,OAAO,IAAI,CAAA;QACb,CAAC;QAED,MAAM,CACJ,AADK,EACH,KAAK,EAAE,AAAD,EACR,KAAK,EACL,KAAK,EACL,KAAK,EACL,KAAK,EACL,KAAK,EACL,KAAK,EACL,KAAK,EACL,MAAM,EACP,GAAG,gBAAgB,CAAA;QAEpB,MAAM,IAAI,GAA4B;YACpC,KAAK,EAAE,iBAAiB,CAAC,YAAY;YACrC,SAAS,EAAE,qBAAqB,CAAC,YAAY;YAC7C,iBAAiB,EAAE,6BAA6B,CAAC,YAAY;YAC7D,KAAK,EAAE,CAAC,CAAC,KAAK;YACd,GAAG,EAAE,KAAK;YACV,KAAK,EAAE,KA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,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,19 +0,0 @@
|
|
|
1
|
-
import type { Buffer } from 'node:buffer';
|
|
2
|
-
import type { contactSensorServiceData } from '../types/bledevicestatus.js';
|
|
3
|
-
import type { NobleTypes } from '../types/types.js';
|
|
4
|
-
import { SwitchbotDevice } from '../device.js';
|
|
5
|
-
/**
|
|
6
|
-
* Class representing a WoContact device.
|
|
7
|
-
* @see https://github.com/OpenWonderLabs/SwitchBotAPI-BLE/blob/latest/devicetypes/contactsensor.md
|
|
8
|
-
*/
|
|
9
|
-
export declare class WoContact extends SwitchbotDevice {
|
|
10
|
-
/**
|
|
11
|
-
* Parses the service data for WoContact.
|
|
12
|
-
* @param {Buffer} serviceData - The service data buffer.
|
|
13
|
-
* @param {Function} emitLog - The function to emit log messages.
|
|
14
|
-
* @returns {Promise<contactSensorServiceData | null>} - Parsed service data or null if invalid.
|
|
15
|
-
*/
|
|
16
|
-
static parseServiceData(serviceData: Buffer, emitLog: (level: string, message: string) => void): Promise<contactSensorServiceData | null>;
|
|
17
|
-
constructor(peripheral: NobleTypes['peripheral'], noble: NobleTypes['noble']);
|
|
18
|
-
}
|
|
19
|
-
//# sourceMappingURL=wocontact.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
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,wBAAwB,EAAE,MAAM,6BAA6B,CAAA;AAC3E,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAA;AAEnD,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AAG9C;;;GAGG;AACH,qBAAa,SAAU,SAAQ,eAAe;IAC5C;;;;;OAKG;WACU,gBAAgB,CAC3B,WAAW,EAAE,MAAM,EACnB,OAAO,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,KAAK,IAAI,GAChD,OAAO,CAAC,wBAAwB,GAAG,IAAI,CAAC;gBAmC/B,UAAU,EAAE,UAAU,CAAC,YAAY,CAAC,EAAE,KAAK,EAAE,UAAU,CAAC,OAAO,CAAC;CAG7E"}
|
package/dist/device/wocontact.js
DELETED
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import { SwitchbotDevice } from '../device.js';
|
|
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
|
-
export class WoContact extends SwitchbotDevice {
|
|
8
|
-
/**
|
|
9
|
-
* Parses the service data for WoContact.
|
|
10
|
-
* @param {Buffer} serviceData - The service data buffer.
|
|
11
|
-
* @param {Function} emitLog - The function to emit log messages.
|
|
12
|
-
* @returns {Promise<contactSensorServiceData | null>} - Parsed service data or null if invalid.
|
|
13
|
-
*/
|
|
14
|
-
static async parseServiceData(serviceData, emitLog) {
|
|
15
|
-
if (serviceData.length !== 9) {
|
|
16
|
-
emitLog('debugerror', `[parseServiceDataForWoContact] Buffer length ${serviceData.length} !== 9!`);
|
|
17
|
-
return null;
|
|
18
|
-
}
|
|
19
|
-
const [byte1, byte2, byte3, , , , , , byte8] = serviceData;
|
|
20
|
-
const hallState = (byte3 >> 1) & 0b00000011;
|
|
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';
|
|
27
|
-
const button_count = byte8 & 0b00001111;
|
|
28
|
-
const doorState = hallState === 0 ? 'close' : hallState === 1 ? 'open' : 'timeout no closed';
|
|
29
|
-
const data = {
|
|
30
|
-
model: SwitchBotBLEModel.ContactSensor,
|
|
31
|
-
modelName: SwitchBotBLEModelName.ContactSensor,
|
|
32
|
-
modelFriendlyName: SwitchBotBLEModelFriendlyName.ContactSensor,
|
|
33
|
-
movement,
|
|
34
|
-
tested,
|
|
35
|
-
battery,
|
|
36
|
-
contact_open,
|
|
37
|
-
contact_timeout,
|
|
38
|
-
lightLevel,
|
|
39
|
-
button_count,
|
|
40
|
-
doorState,
|
|
41
|
-
};
|
|
42
|
-
return data;
|
|
43
|
-
}
|
|
44
|
-
constructor(peripheral, noble) {
|
|
45
|
-
super(peripheral, noble);
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
//# sourceMappingURL=wocontact.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"wocontact.js","sourceRoot":"","sources":["../../src/device/wocontact.ts"],"names":[],"mappings":"AASA,OAAO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,CAAC,CAAC,mBAAmB,CAAA;QAE5F,MAAM,IAAI,GAA6B;YACrC,KAAK,EAAE,iBAAiB,CAAC,aAAa;YACtC,SAAS,EAAE,qBAAqB,CAAC,aAAa;YAC9C,iBAAiB,EAAE,6BAA6B,CAAC,aAAa;YAC9D,QAAQ;YACR,MAAM;YACN,OAAO;YACP,YAAY;YACZ,eAAe;YACf,UAAU;YACV,YAAY;YACZ,SAAS;SACV,CAAA;QAED,OAAO,IAAI,CAAA;IACb,CAAC;IAED,YAAY,UAAoC,EAAE,KAA0B;QAC1E,KAAK,CAAC,UAAU,EAAE,KAAK,CAAC,CAAA;IAC1B,CAAC;CACF"}
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import type { curtain3ServiceData, curtainServiceData } 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 WoCurtain device.
|
|
7
|
-
* @see https://github.com/OpenWonderLabs/SwitchBotAPI-BLE/blob/latest/devicetypes/curtain.md
|
|
8
|
-
* @see https://github.com/OpenWonderLabs/SwitchBotAPI-BLE/blob/latest/devicetypes/curtain3.md
|
|
9
|
-
*/
|
|
10
|
-
export declare class WoCurtain extends SwitchbotDevice {
|
|
11
|
-
/**
|
|
12
|
-
* Parses the service data for WoCurtain.
|
|
13
|
-
* @param {Buffer} serviceData - The service data buffer.
|
|
14
|
-
* @param {Buffer} manufacturerData - The manufacturer data buffer.
|
|
15
|
-
* @param {Function} emitLog - The function to emit log messages.
|
|
16
|
-
* @param {boolean} [reverse] - Whether to reverse the position.
|
|
17
|
-
* @returns {Promise<curtainServiceData | curtain3ServiceData | null>} - Parsed service data or null if invalid.
|
|
18
|
-
*/
|
|
19
|
-
static parseServiceData(serviceData: Buffer, manufacturerData: Buffer, emitLog: (level: string, message: string) => void, reverse?: boolean): Promise<curtainServiceData | curtain3ServiceData | null>;
|
|
20
|
-
constructor(peripheral: NobleTypes['peripheral'], noble: NobleTypes['noble']);
|
|
21
|
-
/**
|
|
22
|
-
* Opens the curtain.
|
|
23
|
-
* @param {number} [mode] - Running mode (0x01 = QuietDrift, 0xFF = Default).
|
|
24
|
-
* @returns {Promise<void>}
|
|
25
|
-
*/
|
|
26
|
-
open(mode?: number): Promise<void>;
|
|
27
|
-
/**
|
|
28
|
-
* Closes the curtain.
|
|
29
|
-
* @param {number} [mode] - Running mode (0x01 = QuietDrift, 0xFF = Default).
|
|
30
|
-
* @returns {Promise<void>}
|
|
31
|
-
*/
|
|
32
|
-
close(mode?: number): Promise<void>;
|
|
33
|
-
/**
|
|
34
|
-
* Pauses the curtain.
|
|
35
|
-
* @returns {Promise<void>}
|
|
36
|
-
*/
|
|
37
|
-
pause(): Promise<void>;
|
|
38
|
-
/**
|
|
39
|
-
* Runs the curtain to the target position.
|
|
40
|
-
* @param {number} percent - The percentage of the target position.
|
|
41
|
-
* @param {number} [mode] - Running mode (0x01 = QuietDrift, 0xFF = Default).
|
|
42
|
-
* @returns {Promise<void>}
|
|
43
|
-
*/
|
|
44
|
-
runToPos(percent: number, mode?: number): Promise<void>;
|
|
45
|
-
/**
|
|
46
|
-
* Sends a command to the curtain.
|
|
47
|
-
* @param {number[]} bytes - The command bytes.
|
|
48
|
-
* @returns {Promise<void>}
|
|
49
|
-
*/
|
|
50
|
-
operateCurtain(bytes: number[]): Promise<void>;
|
|
51
|
-
}
|
|
52
|
-
//# sourceMappingURL=wocurtain.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"wocurtain.d.ts","sourceRoot":"","sources":["../../src/device/wocurtain.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAA;AAC1F,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;;;;GAIG;AACH,qBAAa,SAAU,SAAQ,eAAe;IAC5C;;;;;;;OAOG;WACU,gBAAgB,CAC3B,WAAW,EAAE,MAAM,EACnB,gBAAgB,EAAE,MAAM,EACxB,OAAO,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,KAAK,IAAI,EACjD,OAAO,GAAE,OAAe,GACvB,OAAO,CAAC,kBAAkB,GAAG,mBAAmB,GAAG,IAAI,CAAC;gBAsE/C,UAAU,EAAE,UAAU,CAAC,YAAY,CAAC,EAAE,KAAK,EAAE,UAAU,CAAC,OAAO,CAAC;IAI5E;;;;OAIG;IACG,IAAI,CAAC,IAAI,GAAE,MAAa,GAAG,OAAO,CAAC,IAAI,CAAC;IAI9C;;;;OAIG;IACG,KAAK,CAAC,IAAI,GAAE,MAAa,GAAG,OAAO,CAAC,IAAI,CAAC;IAI/C;;;OAGG;IACG,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAI5B;;;;;OAKG;IACG,QAAQ,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,GAAE,MAAa,GAAG,OAAO,CAAC,IAAI,CAAC;IAQnE;;;;OAIG;IACU,cAAc,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;CAS5D"}
|