node-switchbot 3.6.6 → 4.0.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/CHANGELOG.md +322 -0
- package/PRODUCTION_READY.md +135 -0
- package/README.md +92 -0
- package/dist/api.d.ts +130 -0
- package/dist/api.d.ts.map +1 -0
- package/dist/api.js +286 -0
- package/dist/api.js.map +1 -0
- package/dist/ble.d.ts +116 -0
- package/dist/ble.d.ts.map +1 -0
- package/dist/ble.js +430 -0
- package/dist/ble.js.map +1 -0
- package/dist/devices/base.d.ts +146 -0
- package/dist/devices/base.d.ts.map +1 -0
- package/dist/devices/base.js +324 -0
- package/dist/devices/base.js.map +1 -0
- package/dist/devices/index.d.ts +30 -0
- package/dist/devices/index.d.ts.map +1 -0
- package/dist/devices/index.js +34 -0
- package/dist/devices/index.js.map +1 -0
- package/dist/devices/wo-air-purifier-table.d.ts +8 -0
- package/dist/devices/wo-air-purifier-table.d.ts.map +1 -0
- package/dist/devices/wo-air-purifier-table.js +12 -0
- package/dist/devices/wo-air-purifier-table.js.map +1 -0
- package/dist/devices/wo-air-purifier.d.ts +28 -0
- package/dist/devices/wo-air-purifier.d.ts.map +1 -0
- package/dist/devices/wo-air-purifier.js +105 -0
- package/dist/devices/wo-air-purifier.js.map +1 -0
- package/dist/devices/wo-blind-tilt.d.ts +36 -0
- package/dist/devices/wo-blind-tilt.d.ts.map +1 -0
- package/dist/devices/wo-blind-tilt.js +95 -0
- package/dist/devices/wo-blind-tilt.js.map +1 -0
- package/dist/devices/wo-bulb.d.ts +32 -0
- package/dist/devices/wo-bulb.d.ts.map +1 -0
- package/dist/devices/wo-bulb.js +109 -0
- package/dist/devices/wo-bulb.js.map +1 -0
- package/dist/devices/wo-ceiling-light.d.ts +8 -0
- package/dist/devices/wo-ceiling-light.d.ts.map +1 -0
- package/dist/devices/wo-ceiling-light.js +12 -0
- package/dist/devices/wo-ceiling-light.js.map +1 -0
- package/dist/devices/wo-contact.d.ts +12 -0
- package/dist/devices/wo-contact.d.ts.map +1 -0
- package/dist/devices/wo-contact.js +50 -0
- package/dist/devices/wo-contact.js.map +1 -0
- package/dist/devices/wo-curtain.d.ts +28 -0
- package/dist/devices/wo-curtain.d.ts.map +1 -0
- package/dist/devices/wo-curtain.js +82 -0
- package/dist/devices/wo-curtain.js.map +1 -0
- package/dist/devices/wo-hand.d.ts +24 -0
- package/dist/devices/wo-hand.d.ts.map +1 -0
- package/dist/devices/wo-hand.js +70 -0
- package/dist/devices/wo-hand.js.map +1 -0
- package/dist/devices/wo-hub2.d.ts +12 -0
- package/dist/devices/wo-hub2.d.ts.map +1 -0
- package/dist/devices/wo-hub2.js +48 -0
- package/dist/devices/wo-hub2.js.map +1 -0
- package/dist/devices/wo-hub3.d.ts +8 -0
- package/dist/devices/wo-hub3.d.ts.map +1 -0
- package/dist/devices/wo-hub3.js +12 -0
- package/dist/devices/wo-hub3.js.map +1 -0
- package/dist/devices/wo-humi.d.ts +28 -0
- package/dist/devices/wo-humi.d.ts.map +1 -0
- package/dist/devices/wo-humi.js +91 -0
- package/dist/devices/wo-humi.js.map +1 -0
- package/dist/devices/wo-humi2.d.ts +8 -0
- package/dist/devices/wo-humi2.d.ts.map +1 -0
- package/dist/devices/wo-humi2.js +12 -0
- package/dist/devices/wo-humi2.js.map +1 -0
- package/dist/devices/wo-io-sensor-th.d.ts +8 -0
- package/dist/devices/wo-io-sensor-th.d.ts.map +1 -0
- package/dist/devices/wo-io-sensor-th.js +12 -0
- package/dist/devices/wo-io-sensor-th.js.map +1 -0
- package/dist/devices/wo-keypad.d.ts +13 -0
- package/dist/devices/wo-keypad.d.ts.map +1 -0
- package/dist/devices/wo-keypad.js +46 -0
- package/dist/devices/wo-keypad.js.map +1 -0
- package/dist/devices/wo-leak.d.ts +12 -0
- package/dist/devices/wo-leak.d.ts.map +1 -0
- package/dist/devices/wo-leak.js +46 -0
- package/dist/devices/wo-leak.js.map +1 -0
- package/dist/devices/wo-lock-pro.d.ts +24 -0
- package/dist/devices/wo-lock-pro.d.ts.map +1 -0
- package/dist/devices/wo-lock-pro.js +72 -0
- package/dist/devices/wo-lock-pro.js.map +1 -0
- package/dist/devices/wo-lock.d.ts +20 -0
- package/dist/devices/wo-lock.d.ts.map +1 -0
- package/dist/devices/wo-lock.js +64 -0
- package/dist/devices/wo-lock.js.map +1 -0
- package/dist/devices/wo-plug-mini-jp.d.ts +8 -0
- package/dist/devices/wo-plug-mini-jp.d.ts.map +1 -0
- package/dist/devices/wo-plug-mini-jp.js +12 -0
- package/dist/devices/wo-plug-mini-jp.js.map +1 -0
- package/dist/devices/wo-plug-mini-us.d.ts +24 -0
- package/dist/devices/wo-plug-mini-us.d.ts.map +1 -0
- package/dist/devices/wo-plug-mini-us.js +70 -0
- package/dist/devices/wo-plug-mini-us.js.map +1 -0
- package/dist/devices/wo-presence.d.ts +12 -0
- package/dist/devices/wo-presence.d.ts.map +1 -0
- package/dist/devices/wo-presence.js +48 -0
- package/dist/devices/wo-presence.js.map +1 -0
- package/dist/devices/wo-relay-switch-1.d.ts +24 -0
- package/dist/devices/wo-relay-switch-1.d.ts.map +1 -0
- package/dist/devices/wo-relay-switch-1.js +70 -0
- package/dist/devices/wo-relay-switch-1.js.map +1 -0
- package/dist/devices/wo-relay-switch-1pm.d.ts +8 -0
- package/dist/devices/wo-relay-switch-1pm.d.ts.map +1 -0
- package/dist/devices/wo-relay-switch-1pm.js +12 -0
- package/dist/devices/wo-relay-switch-1pm.js.map +1 -0
- package/dist/devices/wo-remote.d.ts +13 -0
- package/dist/devices/wo-remote.d.ts.map +1 -0
- package/dist/devices/wo-remote.js +45 -0
- package/dist/devices/wo-remote.js.map +1 -0
- package/dist/devices/wo-sensor-th-plus.d.ts +8 -0
- package/dist/devices/wo-sensor-th-plus.d.ts.map +1 -0
- package/dist/devices/wo-sensor-th-plus.js +12 -0
- package/dist/devices/wo-sensor-th-plus.js.map +1 -0
- package/dist/devices/wo-sensor-th-pro-co2.d.ts +8 -0
- package/dist/devices/wo-sensor-th-pro-co2.d.ts.map +1 -0
- package/dist/devices/wo-sensor-th-pro-co2.js +12 -0
- package/dist/devices/wo-sensor-th-pro-co2.js.map +1 -0
- package/dist/devices/wo-sensor-th-pro.d.ts +8 -0
- package/dist/devices/wo-sensor-th-pro.d.ts.map +1 -0
- package/dist/devices/wo-sensor-th-pro.js +12 -0
- package/dist/devices/wo-sensor-th-pro.js.map +1 -0
- package/dist/devices/wo-sensor-th.d.ts +12 -0
- package/dist/devices/wo-sensor-th.d.ts.map +1 -0
- package/dist/devices/wo-sensor-th.js +49 -0
- package/dist/devices/wo-sensor-th.js.map +1 -0
- package/dist/devices/wo-strip.d.ts +8 -0
- package/dist/devices/wo-strip.d.ts.map +1 -0
- package/dist/devices/wo-strip.js +12 -0
- package/dist/devices/wo-strip.js.map +1 -0
- package/dist/errors.d.ts +63 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +103 -0
- package/dist/errors.js.map +1 -0
- package/dist/index.d.ts +10 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +9 -10
- package/dist/index.js.map +1 -1
- package/dist/settings.d.ts +126 -47
- package/dist/settings.d.ts.map +1 -1
- package/dist/settings.js +214 -64
- package/dist/settings.js.map +1 -1
- package/dist/switchbot.d.ts +87 -0
- package/dist/switchbot.d.ts.map +1 -0
- package/dist/switchbot.js +422 -0
- package/dist/switchbot.js.map +1 -0
- package/dist/types/api.d.ts +187 -0
- package/dist/types/api.d.ts.map +1 -0
- package/dist/types/api.js +6 -0
- package/dist/types/api.js.map +1 -0
- package/dist/types/ble.d.ts +246 -348
- package/dist/types/ble.d.ts.map +1 -1
- package/dist/types/ble.js +94 -1
- package/dist/types/ble.js.map +1 -1
- package/dist/types/device.d.ts +209 -0
- package/dist/types/device.d.ts.map +1 -0
- package/dist/types/device.js +6 -0
- package/dist/types/device.js.map +1 -0
- package/dist/types/index.d.ts +115 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +19 -0
- package/dist/types/index.js.map +1 -0
- package/dist/utils/index.d.ts +97 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/index.js +206 -0
- package/dist/utils/index.js.map +1 -0
- package/docs/assets/hierarchy.js +1 -1
- package/docs/assets/highlight.css +20 -6
- package/docs/assets/icons.js +1 -1
- package/docs/assets/icons.svg +1 -1
- package/docs/assets/main.js +2 -2
- package/docs/assets/navigation.js +1 -1
- package/docs/assets/search.js +1 -1
- package/docs/assets/style.css +3 -3
- package/docs/classes/APIError.html +6 -0
- package/docs/classes/APINotAvailableError.html +4 -0
- package/docs/classes/BLEConnection.html +17 -0
- package/docs/classes/BLENotAvailableError.html +4 -0
- package/docs/classes/BLEScanner.html +15 -0
- package/docs/classes/CommandFailedError.html +6 -0
- package/docs/classes/ConnectionTimeoutError.html +5 -0
- package/docs/classes/DeviceManager.html +25 -0
- package/docs/classes/DeviceNotFoundError.html +4 -0
- package/docs/classes/DiscoveryError.html +5 -0
- package/docs/classes/OpenAPIClient.html +66 -0
- package/docs/classes/SwitchBot.html +22 -0
- package/docs/classes/SwitchBotDevice.html +28 -0
- package/docs/classes/SwitchBotError.html +4 -0
- package/docs/classes/ValidationError.html +5 -0
- package/docs/classes/WoAirPurifier.html +32 -80
- package/docs/classes/WoAirPurifierTable.html +36 -83
- package/docs/classes/WoBlindTilt.html +34 -73
- package/docs/classes/WoBulb.html +33 -85
- package/docs/classes/WoCeilingLight.html +38 -107
- package/docs/classes/WoContact.html +27 -52
- package/docs/classes/WoCurtain.html +32 -69
- package/docs/classes/WoHand.html +30 -59
- package/docs/classes/WoHub2.html +27 -52
- package/docs/classes/WoHub3.html +28 -52
- package/docs/classes/WoHumi.html +33 -65
- package/docs/classes/WoHumi2.html +36 -67
- package/docs/classes/WoIOSensorTH.html +28 -53
- package/docs/classes/WoKeypad.html +28 -52
- package/docs/classes/WoLeak.html +27 -53
- package/docs/classes/WoPlugMiniJP.html +34 -78
- package/docs/classes/WoPlugMiniUS.html +30 -75
- package/docs/classes/WoPresence.html +27 -60
- package/docs/classes/WoRelaySwitch1.html +31 -55
- package/docs/classes/WoRelaySwitch1PM.html +34 -57
- package/docs/classes/WoRemote.html +28 -52
- package/docs/classes/WoSensorTH.html +27 -46
- package/docs/classes/WoSensorTHPlus.html +28 -46
- package/docs/classes/WoSensorTHPro.html +28 -46
- package/docs/classes/WoSensorTHProCO2.html +28 -46
- package/docs/classes/WoSmartLock.html +29 -111
- package/docs/classes/WoSmartLockPro.html +31 -111
- package/docs/classes/WoStrip.html +38 -94
- package/docs/enums/LogLevel.html +4 -7
- package/docs/enums/SwitchBotBLEModel.html +11 -6
- package/docs/enums/SwitchBotBLEModelName.html +13 -6
- package/docs/functions/updateBaseURL.html +3 -3
- package/docs/hierarchy.html +1 -1
- package/docs/index.html +40 -6
- package/docs/interfaces/APICommandRequest.html +5 -0
- package/docs/interfaces/APICommandResponse.html +5 -0
- package/docs/interfaces/APIDevice.html +18 -0
- package/docs/interfaces/APIDeviceStatus.html +36 -0
- package/docs/interfaces/APIErrorResponse.html +5 -0
- package/docs/interfaces/APIResponse.html +5 -0
- package/docs/interfaces/AirPurifierCommands.html +5 -0
- package/docs/interfaces/AirPurifierServiceData.html +14 -0
- package/docs/interfaces/AirPurifierStatus.html +17 -0
- package/docs/interfaces/BLEAdvertisement.html +6 -0
- package/docs/interfaces/BLEScanOptions.html +10 -0
- package/docs/interfaces/BLEServiceData.html +10 -0
- package/docs/interfaces/BlindTiltCommands.html +7 -0
- package/docs/interfaces/BlindTiltServiceData.html +14 -0
- package/docs/interfaces/BlindTiltStatus.html +15 -0
- package/docs/interfaces/BotCommands.html +4 -0
- package/docs/interfaces/BotServiceData.html +12 -0
- package/docs/interfaces/BotStatus.html +14 -0
- package/docs/interfaces/BulbCommands.html +6 -0
- package/docs/interfaces/BulbServiceData.html +19 -0
- package/docs/interfaces/BulbStatus.html +16 -0
- package/docs/interfaces/CeilingLightCommands.html +6 -0
- package/docs/interfaces/CeilingLightServiceData.html +19 -0
- package/docs/interfaces/CeilingLightStatus.html +16 -0
- package/docs/interfaces/CommandResult.html +12 -0
- package/docs/interfaces/ContactServiceData.html +13 -0
- package/docs/interfaces/ContactStatus.html +15 -0
- package/docs/interfaces/CurtainCommands.html +5 -0
- package/docs/interfaces/CurtainServiceData.html +14 -0
- package/docs/interfaces/CurtainStatus.html +17 -0
- package/docs/interfaces/DeviceInfo.html +26 -0
- package/docs/interfaces/DeviceListResponse.html +4 -0
- package/docs/interfaces/DeviceStatus.html +12 -0
- package/docs/interfaces/DiscoveryOptions.html +14 -0
- package/docs/interfaces/HubServiceData.html +14 -0
- package/docs/interfaces/HubStatus.html +15 -0
- package/docs/interfaces/HumidifierCommands.html +5 -0
- package/docs/interfaces/HumidifierServiceData.html +14 -0
- package/docs/interfaces/HumidifierStatus.html +18 -0
- package/docs/interfaces/KeypadStatus.html +13 -0
- package/docs/interfaces/LeakServiceData.html +11 -0
- package/docs/interfaces/LeakStatus.html +13 -0
- package/docs/interfaces/LockCommands.html +3 -0
- package/docs/interfaces/LockServiceData.html +15 -0
- package/docs/interfaces/LockStatus.html +15 -0
- package/docs/interfaces/MeterServiceData.html +13 -0
- package/docs/interfaces/MeterStatus.html +15 -0
- package/docs/interfaces/MotionServiceData.html +13 -0
- package/docs/interfaces/MotionStatus.html +14 -0
- package/docs/interfaces/PlugCommands.html +4 -0
- package/docs/interfaces/PlugServiceData.html +17 -0
- package/docs/interfaces/PlugStatus.html +16 -0
- package/docs/interfaces/PresenceServiceData.html +12 -0
- package/docs/interfaces/PresenceStatus.html +14 -0
- package/docs/interfaces/RelaySwitchCommands.html +4 -0
- package/docs/interfaces/RelaySwitchServiceData.html +14 -0
- package/docs/interfaces/RelaySwitchStatus.html +16 -0
- package/docs/interfaces/RemoteStatus.html +12 -0
- package/docs/interfaces/SceneListResponse.html +3 -0
- package/docs/interfaces/StripCommands.html +6 -0
- package/docs/interfaces/StripServiceData.html +19 -0
- package/docs/interfaces/StripStatus.html +16 -0
- package/docs/interfaces/SwitchBotConfig.html +18 -0
- package/docs/interfaces/WebhookConfig.html +4 -0
- package/docs/interfaces/WebhookDetails.html +7 -0
- package/docs/interfaces/WebhookQueryResponse.html +5 -0
- package/docs/interfaces/WebhookSetupResponse.html +5 -0
- package/docs/modules.html +1 -1
- package/docs/types/ConnectionType.html +2 -0
- package/docs/types/PhysicalDeviceType.html +2 -0
- package/docs/types/VirtualDeviceType.html +2 -0
- package/docs/variables/urls.html +1 -1
- package/package.json +12 -21
- package/.github/scripts/npm-version-script-esm-auto.js +0 -207
- package/dist/device.d.ts +0 -1626
- package/dist/device.d.ts.map +0 -1
- package/dist/device.js +0 -3602
- package/dist/device.js.map +0 -1
- package/dist/device.test.d.ts +0 -2
- package/dist/device.test.d.ts.map +0 -1
- package/dist/device.test.js +0 -336
- package/dist/device.test.js.map +0 -1
- package/dist/index.test.d.ts +0 -2
- package/dist/index.test.d.ts.map +0 -1
- package/dist/index.test.js +0 -14
- package/dist/index.test.js.map +0 -1
- package/dist/parameter-checker.d.ts +0 -91
- package/dist/parameter-checker.d.ts.map +0 -1
- package/dist/parameter-checker.js +0 -262
- package/dist/parameter-checker.js.map +0 -1
- package/dist/parameter-checker.test.d.ts +0 -2
- package/dist/parameter-checker.test.d.ts.map +0 -1
- package/dist/parameter-checker.test.js +0 -56
- package/dist/parameter-checker.test.js.map +0 -1
- package/dist/settings.test.d.ts +0 -2
- package/dist/settings.test.d.ts.map +0 -1
- package/dist/settings.test.js +0 -61
- package/dist/settings.test.js.map +0 -1
- package/dist/switchbot-ble.d.ts +0 -89
- package/dist/switchbot-ble.d.ts.map +0 -1
- package/dist/switchbot-ble.js +0 -320
- package/dist/switchbot-ble.js.map +0 -1
- package/dist/switchbot-ble.test.d.ts +0 -2
- package/dist/switchbot-ble.test.d.ts.map +0 -1
- package/dist/switchbot-ble.test.js +0 -32
- package/dist/switchbot-ble.test.js.map +0 -1
- package/dist/switchbot-openapi.d.ts +0 -139
- package/dist/switchbot-openapi.d.ts.map +0 -1
- package/dist/switchbot-openapi.js +0 -375
- package/dist/switchbot-openapi.js.map +0 -1
- package/dist/switchbot-openapi.test.d.ts +0 -2
- package/dist/switchbot-openapi.test.d.ts.map +0 -1
- package/dist/switchbot-openapi.test.js +0 -36
- package/dist/switchbot-openapi.test.js.map +0 -1
- package/dist/types/ble-guards.d.ts +0 -12
- package/dist/types/ble-guards.d.ts.map +0 -1
- package/dist/types/ble-guards.js +0 -10
- package/dist/types/ble-guards.js.map +0 -1
- package/dist/types/ble-guards.test.d.ts +0 -2
- package/dist/types/ble-guards.test.d.ts.map +0 -1
- package/dist/types/ble-guards.test.js +0 -62
- package/dist/types/ble-guards.test.js.map +0 -1
- package/dist/types/openapi.d.ts +0 -638
- package/dist/types/openapi.d.ts.map +0 -1
- package/dist/types/openapi.js +0 -3
- package/dist/types/openapi.js.map +0 -1
- package/docs/classes/Advertising.html +0 -21
- package/docs/classes/ErrorUtils.html +0 -25
- package/docs/classes/ParameterChecker.html +0 -69
- package/docs/classes/SwitchBotBLE.html +0 -39
- package/docs/classes/SwitchBotOpenAPI.html +0 -57
- package/docs/classes/SwitchbotDevice.html +0 -47
- package/docs/classes/ValidationUtils.html +0 -51
- package/docs/classes/WoPlugMiniEU.html +0 -84
- package/docs/classes/WoSmartLockUltra.html +0 -113
- package/docs/enums/SwitchBotBLEModelFriendlyName.html +0 -39
- package/docs/enums/SwitchBotModel.html +0 -53
- package/docs/interfaces/AdvertisementData.html +0 -3
- package/docs/interfaces/Chars.html +0 -4
- package/docs/interfaces/ColorLightServiceDataBase.html +0 -17
- package/docs/interfaces/ErrorObject.html +0 -3
- package/docs/interfaces/LockBaseServiceData.html +0 -15
- package/docs/interfaces/NobleTypes.html +0 -3
- package/docs/interfaces/Params.html +0 -6
- package/docs/interfaces/PlugMiniServiceDataBase.html +0 -12
- package/docs/interfaces/Rule.html +0 -9
- package/docs/interfaces/ServiceData.html +0 -2
- package/docs/interfaces/SwitchBotBLEDevice.html +0 -28
- package/docs/interfaces/SwitchBotScanner.html +0 -6
- package/docs/interfaces/TemperatureServiceDataBase.html +0 -10
- package/docs/interfaces/WebhookDetail.html +0 -6
- package/docs/interfaces/ad.html +0 -5
- package/docs/interfaces/body.html +0 -3
- package/docs/interfaces/bodyChange.html +0 -4
- package/docs/interfaces/deleteWebhookResponse.html +0 -4
- package/docs/interfaces/device.html +0 -7
- package/docs/interfaces/deviceList.html +0 -2
- package/docs/interfaces/deviceStatus.html +0 -7
- package/docs/interfaces/deviceStatusRequest.html +0 -4
- package/docs/interfaces/deviceWebhook.html +0 -4
- package/docs/interfaces/deviceWebhookContext.html +0 -4
- package/docs/interfaces/devices.html +0 -4
- package/docs/interfaces/infraredRemoteList.html +0 -2
- package/docs/interfaces/irdevice.html +0 -5
- package/docs/interfaces/pushRequest.html +0 -5
- package/docs/interfaces/pushResponse.html +0 -5
- package/docs/interfaces/pushResponseBody.html +0 -3
- package/docs/interfaces/queryWebhookResponse.html +0 -4
- package/docs/interfaces/setupWebhookResponse.html +0 -4
- package/docs/interfaces/updateWebhookResponse.html +0 -4
- package/docs/interfaces/webhookRequest.html +0 -4
- package/docs/types/BLEDeviceServiceData.html +0 -1
- package/docs/types/IndoorCam.html +0 -1
- package/docs/types/MacAddress.html +0 -1
- package/docs/types/airPurifier.html +0 -1
- package/docs/types/airPurifierPM25WebhookContext.html +0 -1
- package/docs/types/airPurifierServiceData.html +0 -1
- package/docs/types/airPurifierStatus.html +0 -1
- package/docs/types/airPurifierTable.html +0 -1
- package/docs/types/airPurifierTablePM25WebhookContext.html +0 -1
- package/docs/types/airPurifierTableServiceData.html +0 -1
- package/docs/types/airPurifierTableStatus.html +0 -1
- package/docs/types/airPurifierTableVOC.html +0 -1
- package/docs/types/airPurifierTableVOCStatus.html +0 -1
- package/docs/types/airPurifierTableVOCWebhookContext.html +0 -1
- package/docs/types/airPurifierTableWebhookContext.html +0 -1
- package/docs/types/airPurifierVOC.html +0 -1
- package/docs/types/airPurifierVOCStatus.html +0 -1
- package/docs/types/airPurifierVOCWebhookContext.html +0 -1
- package/docs/types/airPurifierWebhookContext.html +0 -1
- package/docs/types/batteryCirculatorFan.html +0 -1
- package/docs/types/batteryCirculatorFanServiceData.html +0 -1
- package/docs/types/batteryCirculatorFanStatus.html +0 -1
- package/docs/types/batteryCirculatorFanWebhookContext.html +0 -1
- package/docs/types/blindTilt.html +0 -1
- package/docs/types/blindTiltServiceData.html +0 -1
- package/docs/types/blindTiltStatus.html +0 -1
- package/docs/types/blindTiltWebhookContext.html +0 -1
- package/docs/types/bot.html +0 -1
- package/docs/types/botServiceData.html +0 -1
- package/docs/types/botStatus.html +0 -1
- package/docs/types/botWebhookContext.html +0 -1
- package/docs/types/ceilingLight.html +0 -1
- package/docs/types/ceilingLightPro.html +0 -1
- package/docs/types/ceilingLightProServiceData.html +0 -1
- package/docs/types/ceilingLightProStatus.html +0 -1
- package/docs/types/ceilingLightProWebhookContext.html +0 -1
- package/docs/types/ceilingLightServiceData.html +0 -1
- package/docs/types/ceilingLightStatus.html +0 -1
- package/docs/types/ceilingLightWebhookContext.html +0 -1
- package/docs/types/circulatorFanStatus.html +0 -1
- package/docs/types/circulatorFanWebhookContext.html +0 -1
- package/docs/types/colorBulb.html +0 -1
- package/docs/types/colorBulbServiceData.html +0 -1
- package/docs/types/colorBulbStatus.html +0 -1
- package/docs/types/colorBulbWebhookContext.html +0 -1
- package/docs/types/commandType.html +0 -2
- package/docs/types/contactSensor.html +0 -1
- package/docs/types/contactSensorServiceData.html +0 -1
- package/docs/types/contactSensorStatus.html +0 -1
- package/docs/types/contactSensorWebhookContext.html +0 -1
- package/docs/types/curtain.html +0 -1
- package/docs/types/curtain3.html +0 -1
- package/docs/types/curtain3ServiceData.html +0 -1
- package/docs/types/curtain3WebhookContext.html +0 -1
- package/docs/types/curtainServiceData.html +0 -1
- package/docs/types/curtainStatus.html +0 -1
- package/docs/types/curtainWebhookContext.html +0 -1
- package/docs/types/floorCleaningRobotS10.html +0 -1
- package/docs/types/floorCleaningRobotS10Status.html +0 -1
- package/docs/types/floorCleaningRobotS10WebhookContext.html +0 -1
- package/docs/types/hub2.html +0 -1
- package/docs/types/hub2ServiceData.html +0 -1
- package/docs/types/hub2Status.html +0 -1
- package/docs/types/hub2WebhookContext.html +0 -1
- package/docs/types/hub3ServiceData.html +0 -1
- package/docs/types/humidifier.html +0 -1
- package/docs/types/humidifier2ServiceData.html +0 -1
- package/docs/types/humidifier2Status.html +0 -1
- package/docs/types/humidifier2WebhookContext.html +0 -1
- package/docs/types/humidifierServiceData.html +0 -1
- package/docs/types/humidifierStatus.html +0 -1
- package/docs/types/humidifierWebhookContext.html +0 -1
- package/docs/types/indoorCameraWebhookContext.html +0 -1
- package/docs/types/keypad.html +0 -1
- package/docs/types/keypadDetectorServiceData.html +0 -1
- package/docs/types/keypadTouch.html +0 -1
- package/docs/types/keypadTouchWebhookContext.html +0 -1
- package/docs/types/keypadWebhookContext.html +0 -1
- package/docs/types/lock.html +0 -1
- package/docs/types/lockPro.html +0 -1
- package/docs/types/lockProServiceData.html +0 -1
- package/docs/types/lockProStatus.html +0 -1
- package/docs/types/lockProWebhookContext.html +0 -1
- package/docs/types/lockServiceData.html +0 -1
- package/docs/types/lockStatus.html +0 -1
- package/docs/types/lockWebhookContext.html +0 -1
- package/docs/types/meter.html +0 -1
- package/docs/types/meterPlus.html +0 -1
- package/docs/types/meterPlusServiceData.html +0 -1
- package/docs/types/meterPlusStatus.html +0 -1
- package/docs/types/meterPlusWebhookContext.html +0 -1
- package/docs/types/meterPro.html +0 -1
- package/docs/types/meterProCO2ServiceData.html +0 -1
- package/docs/types/meterProCO2Status.html +0 -1
- package/docs/types/meterProCO2WebhookContext.html +0 -1
- package/docs/types/meterProServiceData.html +0 -1
- package/docs/types/meterProStatus.html +0 -1
- package/docs/types/meterProWebhookContext.html +0 -1
- package/docs/types/meterServiceData.html +0 -1
- package/docs/types/meterStatus.html +0 -1
- package/docs/types/meterWebhookContext.html +0 -1
- package/docs/types/motionSensor.html +0 -1
- package/docs/types/motionSensorServiceData.html +0 -1
- package/docs/types/motionSensorStatus.html +0 -1
- package/docs/types/motionSensorWebhookContext.html +0 -1
- package/docs/types/onadvertisement.html +0 -1
- package/docs/types/ondiscover.html +0 -1
- package/docs/types/outdoorMeter.html +0 -1
- package/docs/types/outdoorMeterServiceData.html +0 -1
- package/docs/types/outdoorMeterStatus.html +0 -1
- package/docs/types/outdoorMeterWebhookContext.html +0 -1
- package/docs/types/panTiltCamWebhookContext.html +0 -1
- package/docs/types/pantiltCam.html +0 -1
- package/docs/types/pantiltCam2k.html +0 -1
- package/docs/types/plug.html +0 -1
- package/docs/types/plugMini.html +0 -1
- package/docs/types/plugMiniEUServiceData.html +0 -1
- package/docs/types/plugMiniEUWebhookContext.html +0 -1
- package/docs/types/plugMiniJPServiceData.html +0 -1
- package/docs/types/plugMiniJPWebhookContext.html +0 -1
- package/docs/types/plugMiniStatus.html +0 -1
- package/docs/types/plugMiniUSServiceData.html +0 -1
- package/docs/types/plugMiniUSWebhookContext.html +0 -1
- package/docs/types/plugStatus.html +0 -1
- package/docs/types/plugWebhookContext.html +0 -1
- package/docs/types/presenceSensor.html +0 -1
- package/docs/types/presenceSensorServiceData.html +0 -1
- package/docs/types/presenceSensorStatus.html +0 -1
- package/docs/types/presenceSensorWebhookContext.html +0 -1
- package/docs/types/relaySwitch1Context.html +0 -1
- package/docs/types/relaySwitch1PMContext.html +0 -1
- package/docs/types/relaySwitch1PMServiceData.html +0 -1
- package/docs/types/relaySwitch1PMStatus.html +0 -1
- package/docs/types/relaySwitch1ServiceData.html +0 -1
- package/docs/types/relaySwitch1Status.html +0 -1
- package/docs/types/remote.html +0 -1
- package/docs/types/remoteServiceData.html +0 -1
- package/docs/types/robotVacuumCleanerS1.html +0 -1
- package/docs/types/robotVacuumCleanerS1Plus.html +0 -1
- package/docs/types/robotVacuumCleanerS1PlusStatus.html +0 -1
- package/docs/types/robotVacuumCleanerS1PlusWebhookContext.html +0 -1
- package/docs/types/robotVacuumCleanerS1Status.html +0 -1
- package/docs/types/robotVacuumCleanerS1WebhookContext.html +0 -1
- package/docs/types/robotVacuumCleanerServiceData.html +0 -1
- package/docs/types/stripLight.html +0 -1
- package/docs/types/stripLightServiceData.html +0 -1
- package/docs/types/stripLightStatus.html +0 -1
- package/docs/types/stripLightWebhookContext.html +0 -1
- package/docs/types/waterLeakDetector.html +0 -1
- package/docs/types/waterLeakDetectorServiceData.html +0 -1
- package/docs/types/waterLeakDetectorStatus.html +0 -1
- package/docs/types/waterLeakDetectorWebhookContext.html +0 -1
- package/docs/variables/parameterChecker.html +0 -1
- package/eslint.config.js +0 -48
- package/typedoc.json +0 -17
package/dist/device.d.ts
DELETED
|
@@ -1,1626 +0,0 @@
|
|
|
1
|
-
import type { Characteristic, Noble, Peripheral } from '@stoprocent/noble';
|
|
2
|
-
import type { airPurifierServiceData, airPurifierTableServiceData, batteryCirculatorFanServiceData, blindTiltServiceData, botServiceData, ceilingLightProServiceData, ceilingLightServiceData, colorBulbServiceData, contactSensorServiceData, curtain3ServiceData, curtainServiceData, hub2ServiceData, hub3ServiceData, humidifier2ServiceData, humidifierServiceData, keypadDetectorServiceData, lockProServiceData, lockServiceData, meterPlusServiceData, meterProCO2ServiceData, meterProServiceData, meterServiceData, motionSensorServiceData, outdoorMeterServiceData, plugMiniEUServiceData, plugMiniJPServiceData, plugMiniUSServiceData, presenceSensorServiceData, relaySwitch1PMServiceData, relaySwitch1ServiceData, remoteServiceData, robotVacuumCleanerServiceData, stripLightServiceData, waterLeakDetectorServiceData } from './types/ble.js';
|
|
3
|
-
import { Buffer } from 'node:buffer';
|
|
4
|
-
import { EventEmitter } from 'node:events';
|
|
5
|
-
export type MacAddress = string;
|
|
6
|
-
export interface ad {
|
|
7
|
-
id: string;
|
|
8
|
-
address: string;
|
|
9
|
-
rssi: number;
|
|
10
|
-
serviceData: airPurifierServiceData | airPurifierTableServiceData | botServiceData | colorBulbServiceData | contactSensorServiceData | curtainServiceData | curtain3ServiceData | stripLightServiceData | lockServiceData | lockProServiceData | meterServiceData | meterPlusServiceData | meterProServiceData | meterProCO2ServiceData | motionSensorServiceData | presenceSensorServiceData | outdoorMeterServiceData | plugMiniUSServiceData | plugMiniJPServiceData | plugMiniEUServiceData | blindTiltServiceData | ceilingLightServiceData | ceilingLightProServiceData | hub2ServiceData | hub3ServiceData | batteryCirculatorFanServiceData | waterLeakDetectorServiceData | humidifierServiceData | humidifier2ServiceData | robotVacuumCleanerServiceData | keypadDetectorServiceData | relaySwitch1PMServiceData | relaySwitch1ServiceData | remoteServiceData;
|
|
11
|
-
[key: string]: unknown;
|
|
12
|
-
}
|
|
13
|
-
export type ondiscover = (device: SwitchbotDevice) => Promise<void> | void;
|
|
14
|
-
export type onadvertisement = (ad: ad) => Promise<void> | void;
|
|
15
|
-
interface DeviceInfo {
|
|
16
|
-
Model: SwitchBotModel;
|
|
17
|
-
BLEModel: SwitchBotBLEModel;
|
|
18
|
-
BLEModelName: SwitchBotBLEModelName;
|
|
19
|
-
ModelFriendlyName: SwitchBotBLEModelFriendlyName;
|
|
20
|
-
}
|
|
21
|
-
export declare interface SwitchBotBLEDevice {
|
|
22
|
-
Bot: DeviceInfo;
|
|
23
|
-
Curtain: DeviceInfo;
|
|
24
|
-
Curtain3: DeviceInfo;
|
|
25
|
-
Humidifier: DeviceInfo;
|
|
26
|
-
Meter: DeviceInfo;
|
|
27
|
-
MeterPlus: DeviceInfo;
|
|
28
|
-
MeterPro: DeviceInfo;
|
|
29
|
-
MeterProCO2: DeviceInfo;
|
|
30
|
-
Hub2: DeviceInfo;
|
|
31
|
-
Hub3: DeviceInfo;
|
|
32
|
-
OutdoorMeter: DeviceInfo;
|
|
33
|
-
MotionSensor: DeviceInfo;
|
|
34
|
-
PresenceSensor: DeviceInfo;
|
|
35
|
-
ContactSensor: DeviceInfo;
|
|
36
|
-
ColorBulb: DeviceInfo;
|
|
37
|
-
StripLight: DeviceInfo;
|
|
38
|
-
PlugMiniUS: DeviceInfo;
|
|
39
|
-
PlugMiniJP: DeviceInfo;
|
|
40
|
-
PlugMiniEU: DeviceInfo;
|
|
41
|
-
Lock: DeviceInfo;
|
|
42
|
-
LockPro: DeviceInfo;
|
|
43
|
-
CeilingLight: DeviceInfo;
|
|
44
|
-
CeilingLightPro: DeviceInfo;
|
|
45
|
-
BlindTilt: DeviceInfo;
|
|
46
|
-
Unknown: DeviceInfo;
|
|
47
|
-
AirPurifier: DeviceInfo;
|
|
48
|
-
AirPurifierTable: DeviceInfo;
|
|
49
|
-
}
|
|
50
|
-
export declare enum SwitchBotModel {
|
|
51
|
-
HubMini = "W0202200",
|
|
52
|
-
HubPlus = "SwitchBot Hub S1",
|
|
53
|
-
Hub2 = "W3202100",
|
|
54
|
-
Hub3 = "W3302100",
|
|
55
|
-
Bot = "SwitchBot S1",
|
|
56
|
-
Curtain = "W0701600",
|
|
57
|
-
Curtain3 = "W2400000",
|
|
58
|
-
Humidifier = "W0801800",
|
|
59
|
-
Humidifier2 = "WXXXXXXX",
|
|
60
|
-
Plug = "SP11",// Currently only available in Japan
|
|
61
|
-
Meter = "SwitchBot MeterTH S1",
|
|
62
|
-
MeterPlusJP = "W2201500",
|
|
63
|
-
MeterPlusUS = "W2301500",
|
|
64
|
-
MeterPro = "W4900000",
|
|
65
|
-
MeterProCO2 = "W4900010",
|
|
66
|
-
OutdoorMeter = "W3400010",
|
|
67
|
-
MotionSensor = "W1101500",
|
|
68
|
-
PresenceSensor = "W8200000",
|
|
69
|
-
ContactSensor = "W1201500",
|
|
70
|
-
ColorBulb = "W1401400",
|
|
71
|
-
StripLight = "W1701100",
|
|
72
|
-
PlugMiniUS = "W1901400/W1901401",
|
|
73
|
-
PlugMiniJP = "W2001400/W2001401",
|
|
74
|
-
PlugMiniEU = "W7732300",
|
|
75
|
-
Lock = "W1601700",
|
|
76
|
-
LockPro = "W3500000",
|
|
77
|
-
LockUltra = "W3600000",
|
|
78
|
-
Keypad = "W2500010",
|
|
79
|
-
KeypadTouch = "W2500020",
|
|
80
|
-
K10 = "K10+",
|
|
81
|
-
K10Pro = "K10+ Pro",
|
|
82
|
-
WoSweeper = "WoSweeper",
|
|
83
|
-
WoSweeperMini = "WoSweeperMini",
|
|
84
|
-
RobotVacuumCleanerS1 = "W3011000",// Currently only available in Japan.
|
|
85
|
-
RobotVacuumCleanerS1Plus = "W3011010",// Currently only available in Japan.
|
|
86
|
-
RobotVacuumCleanerS10 = "W3211800",
|
|
87
|
-
Remote = "Remote",
|
|
88
|
-
UniversalRemote = "UniversalRemote",
|
|
89
|
-
CeilingLight = "W2612230/W2612240",// Currently only available in Japan.
|
|
90
|
-
CeilingLightPro = "W2612210/W2612220",// Currently only available in Japan.
|
|
91
|
-
IndoorCam = "W1301200",
|
|
92
|
-
PanTiltCam = "W1801200",
|
|
93
|
-
PanTiltCam2K = "W3101100",
|
|
94
|
-
BlindTilt = "W2701600",
|
|
95
|
-
BatteryCirculatorFan = "W3800510",
|
|
96
|
-
CirculatorFan = "W3800511",
|
|
97
|
-
WaterDetector = "W4402000",
|
|
98
|
-
RelaySwitch1 = "W5502300",
|
|
99
|
-
RelaySwitch1PM = "W5502310",
|
|
100
|
-
Unknown = "Unknown",
|
|
101
|
-
AirPurifier = "W5302300",
|
|
102
|
-
AirPurifierTable = "W5302310"
|
|
103
|
-
}
|
|
104
|
-
export declare enum SwitchBotBLEModel {
|
|
105
|
-
Bot = "H",
|
|
106
|
-
Curtain = "c",
|
|
107
|
-
Curtain3 = "{",
|
|
108
|
-
Humidifier = "e",
|
|
109
|
-
Humidifier2 = "#",
|
|
110
|
-
Meter = "T",
|
|
111
|
-
MeterPlus = "i",
|
|
112
|
-
MeterPro = "4",
|
|
113
|
-
MeterProCO2 = "5",
|
|
114
|
-
Hub2 = "v",
|
|
115
|
-
Hub3 = "V",
|
|
116
|
-
OutdoorMeter = "w",
|
|
117
|
-
MotionSensor = "s",
|
|
118
|
-
PresenceSensor = "p",
|
|
119
|
-
ContactSensor = "d",
|
|
120
|
-
ColorBulb = "u",
|
|
121
|
-
StripLight = "r",
|
|
122
|
-
PlugMiniUS = "g",
|
|
123
|
-
PlugMiniJP = "j",// Only available in Japan.
|
|
124
|
-
PlugMiniEU = "l",// Only available in Europe.
|
|
125
|
-
Lock = "o",
|
|
126
|
-
LockPro = "$",
|
|
127
|
-
LockUltra = "U",
|
|
128
|
-
CeilingLight = "q",// Currently only available in Japan.
|
|
129
|
-
CeilingLightPro = "n",// Currently only available in Japan.
|
|
130
|
-
BlindTilt = "x",
|
|
131
|
-
Leak = "&",
|
|
132
|
-
Keypad = "y",
|
|
133
|
-
RelaySwitch1 = ";",
|
|
134
|
-
RelaySwitch1PM = "<",
|
|
135
|
-
Remote = "b",
|
|
136
|
-
Unknown = "Unknown",
|
|
137
|
-
AirPurifier = "+",
|
|
138
|
-
AirPurifierTable = "7"
|
|
139
|
-
}
|
|
140
|
-
export declare enum SwitchBotBLEModelName {
|
|
141
|
-
Bot = "WoHand",
|
|
142
|
-
Hub2 = "WoHub2",
|
|
143
|
-
Hub3 = "WoHub3",
|
|
144
|
-
ColorBulb = "WoBulb",
|
|
145
|
-
Curtain = "WoCurtain",
|
|
146
|
-
Curtain3 = "WoCurtain3",
|
|
147
|
-
Humidifier = "WoHumi",
|
|
148
|
-
Humidifier2 = "WoHumi2",
|
|
149
|
-
Meter = "WoSensorTH",
|
|
150
|
-
MeterPlus = "WoSensorTHPlus",
|
|
151
|
-
MeterPro = "WoSensorTHP",
|
|
152
|
-
MeterProCO2 = "WoSensorTHPc",
|
|
153
|
-
Lock = "WoSmartLock",
|
|
154
|
-
LockPro = "WoSmartLockPro",
|
|
155
|
-
LockUltra = "WoSmartLockUltra",
|
|
156
|
-
PresenceSensor = "WoPresence",
|
|
157
|
-
PlugMini = "WoPlugMini",
|
|
158
|
-
StripLight = "WoStrip",
|
|
159
|
-
OutdoorMeter = "WoIOSensorTH",
|
|
160
|
-
ContactSensor = "WoContact",
|
|
161
|
-
MotionSensor = "WoMotion",
|
|
162
|
-
BlindTilt = "WoBlindTilt",
|
|
163
|
-
CeilingLight = "WoCeilingLight",
|
|
164
|
-
CeilingLightPro = "WoCeilingLightPro",
|
|
165
|
-
Leak = "WoLeakDetector",
|
|
166
|
-
Keypad = "WoKeypad",
|
|
167
|
-
RelaySwitch1 = "WoRelaySwitch1Plus",
|
|
168
|
-
RelaySwitch1PM = "WoRelaySwitch1PM",
|
|
169
|
-
Remote = "WoRemote",
|
|
170
|
-
AirPurifier = "WoAirPurifier",
|
|
171
|
-
AirPurifierTable = "WoAirPurifierTable",
|
|
172
|
-
Unknown = "Unknown"
|
|
173
|
-
}
|
|
174
|
-
export declare enum SwitchBotBLEModelFriendlyName {
|
|
175
|
-
Bot = "Bot",
|
|
176
|
-
Hub2 = "Hub 2",
|
|
177
|
-
Hub3 = "Hub 3",
|
|
178
|
-
ColorBulb = "Color Bulb",
|
|
179
|
-
Curtain = "Curtain",
|
|
180
|
-
Curtain3 = "Curtain 3",
|
|
181
|
-
Humidifier = "Humidifier",
|
|
182
|
-
Humidifier2 = "Humidifier2",
|
|
183
|
-
Meter = "Meter",
|
|
184
|
-
Lock = "Lock",
|
|
185
|
-
LockPro = "Lock Pro",
|
|
186
|
-
LockUltra = "Lock Ultra",
|
|
187
|
-
PlugMini = "Plug Mini",
|
|
188
|
-
StripLight = "Strip Light",
|
|
189
|
-
MeterPlus = "Meter Plus",
|
|
190
|
-
MeterPro = "Meter Pro",
|
|
191
|
-
MeterProCO2 = "Meter Pro CO2",
|
|
192
|
-
BatteryCirculatorFan = "Battery Circulator Fan",
|
|
193
|
-
CirculatorFan = "Circulator Fan",
|
|
194
|
-
OutdoorMeter = "Outdoor Meter",
|
|
195
|
-
ContactSensor = "Contact Sensor",
|
|
196
|
-
MotionSensor = "Motion Sensor",
|
|
197
|
-
PresenceSensor = "Presence Sensor",
|
|
198
|
-
BlindTilt = "Blind Tilt",
|
|
199
|
-
CeilingLight = "Ceiling Light",
|
|
200
|
-
CeilingLightPro = "Ceiling Light Pro",
|
|
201
|
-
Leak = "Water Detector",
|
|
202
|
-
Keypad = "Keypad",
|
|
203
|
-
RelaySwitch1 = "Relay Switch 1",
|
|
204
|
-
RelaySwitch1PM = "Relay Switch 1PM",
|
|
205
|
-
Remote = "Remote",
|
|
206
|
-
AirPurifier = "Air Purifier",
|
|
207
|
-
AirPurifierTable = "Air Purifier Table",
|
|
208
|
-
Unknown = "Unknown",
|
|
209
|
-
AirPurifierVOC = "Air Purifier VOC",
|
|
210
|
-
AirPurifierTableVOC = "Air Purifier Table VOC",
|
|
211
|
-
AirPurifierPM2_5 = "Air Purifier PM2.5",
|
|
212
|
-
AirPurifierTablePM2_5 = "Air Purifier Table PM2.5"
|
|
213
|
-
}
|
|
214
|
-
export interface Params {
|
|
215
|
-
duration?: number;
|
|
216
|
-
model?: string;
|
|
217
|
-
id?: string;
|
|
218
|
-
quick?: boolean;
|
|
219
|
-
noble?: Noble;
|
|
220
|
-
}
|
|
221
|
-
export interface ErrorObject {
|
|
222
|
-
code: string;
|
|
223
|
-
message: string;
|
|
224
|
-
}
|
|
225
|
-
export interface Chars {
|
|
226
|
-
write: Characteristic | null;
|
|
227
|
-
notify: Characteristic | null;
|
|
228
|
-
device: Characteristic | null;
|
|
229
|
-
}
|
|
230
|
-
export interface NobleTypes {
|
|
231
|
-
noble: Noble;
|
|
232
|
-
peripheral: Peripheral;
|
|
233
|
-
}
|
|
234
|
-
export interface ServiceData {
|
|
235
|
-
model: string;
|
|
236
|
-
[key: string]: unknown;
|
|
237
|
-
}
|
|
238
|
-
export interface AdvertisementData {
|
|
239
|
-
serviceData: Buffer | null;
|
|
240
|
-
manufacturerData: Buffer | null;
|
|
241
|
-
}
|
|
242
|
-
export interface Rule {
|
|
243
|
-
required?: boolean;
|
|
244
|
-
min?: number;
|
|
245
|
-
max?: number;
|
|
246
|
-
minBytes?: number;
|
|
247
|
-
maxBytes?: number;
|
|
248
|
-
pattern?: RegExp;
|
|
249
|
-
enum?: unknown[];
|
|
250
|
-
type?: 'float' | 'integer' | 'boolean' | 'array' | 'object' | 'string';
|
|
251
|
-
}
|
|
252
|
-
/**
|
|
253
|
-
* Enum for log levels.
|
|
254
|
-
*/
|
|
255
|
-
export declare enum LogLevel {
|
|
256
|
-
SUCCESS = "success",
|
|
257
|
-
DEBUGSUCCESS = "debugsuccess",
|
|
258
|
-
WARN = "warn",
|
|
259
|
-
DEBUGWARN = "debugwarn",
|
|
260
|
-
ERROR = "error",
|
|
261
|
-
DEBUGERROR = "debugerror",
|
|
262
|
-
DEBUG = "debug",
|
|
263
|
-
INFO = "info"
|
|
264
|
-
}
|
|
265
|
-
/**
|
|
266
|
-
* Utility class for comprehensive input validation with improved error messages.
|
|
267
|
-
*/
|
|
268
|
-
export declare class ValidationUtils {
|
|
269
|
-
/**
|
|
270
|
-
* Validates percentage value (0-100).
|
|
271
|
-
* @param value - The value to validate
|
|
272
|
-
* @param paramName - The parameter name for error reporting
|
|
273
|
-
* @throws {RangeError} When value is not within valid range
|
|
274
|
-
* @throws {TypeError} When value is not a number
|
|
275
|
-
*/
|
|
276
|
-
static validatePercentage(value: number, paramName?: string): void;
|
|
277
|
-
/**
|
|
278
|
-
* Validates RGB color value (0-255).
|
|
279
|
-
* @param value - The color value to validate
|
|
280
|
-
* @param colorName - The color name for error reporting
|
|
281
|
-
* @throws {RangeError} When value is not within valid range
|
|
282
|
-
* @throws {TypeError} When value is not a number
|
|
283
|
-
*/
|
|
284
|
-
static validateRGB(value: number, colorName?: string): void;
|
|
285
|
-
/**
|
|
286
|
-
* Validates buffer and throws descriptive error.
|
|
287
|
-
* @param buffer - The buffer to validate
|
|
288
|
-
* @param expectedLength - Optional expected length
|
|
289
|
-
* @param paramName - The parameter name for error reporting
|
|
290
|
-
* @throws {TypeError} When buffer is not a Buffer
|
|
291
|
-
* @throws {RangeError} When buffer length doesn't match expected
|
|
292
|
-
*/
|
|
293
|
-
static validateBuffer(buffer: any, expectedLength?: number, paramName?: string): asserts buffer is Buffer;
|
|
294
|
-
/**
|
|
295
|
-
* Validates string input with comprehensive checks.
|
|
296
|
-
* @param value - The value to validate
|
|
297
|
-
* @param paramName - The parameter name for error reporting
|
|
298
|
-
* @param minLength - Minimum required length
|
|
299
|
-
* @param maxLength - Optional maximum length
|
|
300
|
-
* @throws {TypeError} When value is not a string
|
|
301
|
-
* @throws {RangeError} When string length is invalid
|
|
302
|
-
*/
|
|
303
|
-
static validateString(value: any, paramName?: string, minLength?: number, maxLength?: number): asserts value is string;
|
|
304
|
-
/**
|
|
305
|
-
* Validates numeric range with enhanced checks.
|
|
306
|
-
* @param value - The value to validate
|
|
307
|
-
* @param min - Minimum allowed value
|
|
308
|
-
* @param max - Maximum allowed value
|
|
309
|
-
* @param paramName - The parameter name for error reporting
|
|
310
|
-
* @param mustBeInteger - Whether the value must be an integer
|
|
311
|
-
* @throws {TypeError} When value is not a number
|
|
312
|
-
* @throws {RangeError} When value is outside valid range
|
|
313
|
-
*/
|
|
314
|
-
static validateRange(value: number, min: number, max: number, paramName?: string, mustBeInteger?: boolean): void;
|
|
315
|
-
/**
|
|
316
|
-
* Validates MAC address format.
|
|
317
|
-
* @param address - The MAC address to validate
|
|
318
|
-
* @param paramName - The parameter name for error reporting
|
|
319
|
-
* @throws {TypeError} When address is not a string
|
|
320
|
-
* @throws {Error} When address format is invalid
|
|
321
|
-
*/
|
|
322
|
-
static validateMacAddress(address: any, paramName?: string): asserts address is string;
|
|
323
|
-
/**
|
|
324
|
-
* Validates that a value is one of the allowed enum values.
|
|
325
|
-
* @param value - The value to validate
|
|
326
|
-
* @param allowedValues - Array of allowed values
|
|
327
|
-
* @param paramName - The parameter name for error reporting
|
|
328
|
-
* @throws {Error} When value is not in allowed values
|
|
329
|
-
*/
|
|
330
|
-
static validateEnum<T>(value: any, allowedValues: readonly T[], paramName?: string): asserts value is T;
|
|
331
|
-
}
|
|
332
|
-
/**
|
|
333
|
-
* Enhanced error handling utilities.
|
|
334
|
-
*/
|
|
335
|
-
export declare class ErrorUtils {
|
|
336
|
-
/**
|
|
337
|
-
* Creates a timeout error with context.
|
|
338
|
-
* @param operation - The operation that timed out
|
|
339
|
-
* @param timeoutMs - The timeout duration in milliseconds
|
|
340
|
-
* @returns A descriptive timeout error
|
|
341
|
-
*/
|
|
342
|
-
static createTimeoutError(operation: string, timeoutMs: number): Error;
|
|
343
|
-
/**
|
|
344
|
-
* Creates a connection error with context.
|
|
345
|
-
* @param deviceId - The device ID that failed to connect
|
|
346
|
-
* @param cause - The underlying cause of the connection failure
|
|
347
|
-
* @returns A descriptive connection error
|
|
348
|
-
*/
|
|
349
|
-
static createConnectionError(deviceId: string, cause?: Error): Error;
|
|
350
|
-
/**
|
|
351
|
-
* Creates a command error with context.
|
|
352
|
-
* @param command - The command that failed
|
|
353
|
-
* @param deviceId - The device ID
|
|
354
|
-
* @param cause - The underlying cause
|
|
355
|
-
* @returns A descriptive command error
|
|
356
|
-
*/
|
|
357
|
-
static createCommandError(command: string, deviceId: string, cause?: Error): Error;
|
|
358
|
-
/**
|
|
359
|
-
* Wraps an async operation with timeout and enhanced error handling.
|
|
360
|
-
* @param operation - The async operation to wrap
|
|
361
|
-
* @param timeoutMs - Timeout in milliseconds
|
|
362
|
-
* @param operationName - Name of the operation for error messages
|
|
363
|
-
* @returns Promise that resolves with the operation result or rejects with timeout
|
|
364
|
-
*/
|
|
365
|
-
static withTimeout<T>(operation: Promise<T>, timeoutMs: number, operationName: string): Promise<T>;
|
|
366
|
-
}
|
|
367
|
-
/**
|
|
368
|
-
* Represents a Switchbot Device.
|
|
369
|
-
*/
|
|
370
|
-
export declare class SwitchbotDevice extends EventEmitter {
|
|
371
|
-
private noble;
|
|
372
|
-
private peripheral;
|
|
373
|
-
private characteristics;
|
|
374
|
-
private deviceId;
|
|
375
|
-
private deviceAddress;
|
|
376
|
-
private deviceModel;
|
|
377
|
-
private deviceModelName;
|
|
378
|
-
private deviceFriendlyName;
|
|
379
|
-
private explicitlyConnected;
|
|
380
|
-
private isConnected;
|
|
381
|
-
private onNotify;
|
|
382
|
-
private onDisconnect;
|
|
383
|
-
private onConnect;
|
|
384
|
-
/**
|
|
385
|
-
* Initializes a new instance of the SwitchbotDevice class.
|
|
386
|
-
* @param peripheral The peripheral object from noble.
|
|
387
|
-
* @param noble The Noble object.
|
|
388
|
-
*/
|
|
389
|
-
constructor(peripheral: NobleTypes['peripheral'], noble: Noble);
|
|
390
|
-
/**
|
|
391
|
-
* Logs a message with the specified log level.
|
|
392
|
-
* @param level The severity level of the log (e.g., 'info', 'warn', 'error').
|
|
393
|
-
* @param message The log message to be emitted.
|
|
394
|
-
*/
|
|
395
|
-
log(level: string, message: string): Promise<void>;
|
|
396
|
-
get id(): string;
|
|
397
|
-
get address(): string;
|
|
398
|
-
get model(): SwitchBotBLEModel;
|
|
399
|
-
get modelName(): SwitchBotBLEModelName;
|
|
400
|
-
get friendlyName(): SwitchBotBLEModelFriendlyName;
|
|
401
|
-
get connectionState(): string;
|
|
402
|
-
get onConnectHandler(): () => Promise<void>;
|
|
403
|
-
set onConnectHandler(func: () => Promise<void>);
|
|
404
|
-
get onDisconnectHandler(): () => Promise<void>;
|
|
405
|
-
set onDisconnectHandler(func: () => Promise<void>);
|
|
406
|
-
/**
|
|
407
|
-
* Connects to the device.
|
|
408
|
-
* @returns A Promise that resolves when the connection is complete.
|
|
409
|
-
*/
|
|
410
|
-
connect(): Promise<void>;
|
|
411
|
-
/**
|
|
412
|
-
* Internal method to handle the connection process.
|
|
413
|
-
* @returns A Promise that resolves when the connection is complete.
|
|
414
|
-
*/
|
|
415
|
-
internalConnect(): Promise<void>;
|
|
416
|
-
/**
|
|
417
|
-
* Retrieves the device characteristics.
|
|
418
|
-
* @returns A Promise that resolves with the device characteristics.
|
|
419
|
-
*/
|
|
420
|
-
getCharacteristics(): Promise<Chars>;
|
|
421
|
-
/**
|
|
422
|
-
* Discovers the device services.
|
|
423
|
-
* @returns A Promise that resolves with the list of services.
|
|
424
|
-
*/
|
|
425
|
-
discoverServices(): Promise<NobleTypes['peripheral']['services']>;
|
|
426
|
-
/**
|
|
427
|
-
* Discovers the characteristics of a service.
|
|
428
|
-
* @param service The service to discover characteristics for.
|
|
429
|
-
* @returns A Promise that resolves with the list of characteristics.
|
|
430
|
-
*/
|
|
431
|
-
private discoverCharacteristics;
|
|
432
|
-
/**
|
|
433
|
-
* Subscribes to the notify characteristic.
|
|
434
|
-
* @returns A Promise that resolves when the subscription is complete.
|
|
435
|
-
*/
|
|
436
|
-
private subscribeToNotify;
|
|
437
|
-
/**
|
|
438
|
-
* Unsubscribes from the notify characteristic.
|
|
439
|
-
* @returns A Promise that resolves when the unsubscription is complete.
|
|
440
|
-
*/
|
|
441
|
-
unsubscribeFromNotify(): Promise<void>;
|
|
442
|
-
/**
|
|
443
|
-
* Disconnects from the device.
|
|
444
|
-
* @returns A Promise that resolves when the disconnection is complete.
|
|
445
|
-
*/
|
|
446
|
-
disconnect(): Promise<void>;
|
|
447
|
-
/**
|
|
448
|
-
* Internal method to handle disconnection if not explicitly initiated.
|
|
449
|
-
* @returns A Promise that resolves when the disconnection is complete.
|
|
450
|
-
*/
|
|
451
|
-
private internalDisconnect;
|
|
452
|
-
/**
|
|
453
|
-
* Retrieves the device name.
|
|
454
|
-
* @returns A Promise that resolves with the device name.
|
|
455
|
-
*/
|
|
456
|
-
getDeviceName(): Promise<string>;
|
|
457
|
-
/**
|
|
458
|
-
* Sets the device name.
|
|
459
|
-
* @param name The new device name.
|
|
460
|
-
* @returns A Promise that resolves when the name is set.
|
|
461
|
-
*/
|
|
462
|
-
setDeviceName(name: string): Promise<void>;
|
|
463
|
-
/**
|
|
464
|
-
* Sends a command to the device and awaits a response.
|
|
465
|
-
* @param reqBuf The command buffer.
|
|
466
|
-
* @returns A Promise that resolves with the response buffer.
|
|
467
|
-
*/
|
|
468
|
-
command(reqBuf: Buffer): Promise<Buffer>;
|
|
469
|
-
/**
|
|
470
|
-
* Waits for a response from the device after sending a command.
|
|
471
|
-
* @returns A Promise that resolves with the response buffer.
|
|
472
|
-
*/
|
|
473
|
-
private waitForCommandResponse;
|
|
474
|
-
/**
|
|
475
|
-
* Reads data from a characteristic with enhanced timeout and error handling.
|
|
476
|
-
* @param char The characteristic to read from.
|
|
477
|
-
* @returns A Promise that resolves with the data buffer.
|
|
478
|
-
*/
|
|
479
|
-
private readCharacteristic;
|
|
480
|
-
/**
|
|
481
|
-
* Writes data to a characteristic with enhanced timeout and error handling.
|
|
482
|
-
* @param char The characteristic to write to.
|
|
483
|
-
* @param buf The data buffer.
|
|
484
|
-
* @returns A Promise that resolves when the write is complete.
|
|
485
|
-
*/
|
|
486
|
-
private writeCharacteristic;
|
|
487
|
-
}
|
|
488
|
-
/**
|
|
489
|
-
* Represents the advertising data parser for SwitchBot devices.
|
|
490
|
-
*/
|
|
491
|
-
export declare class Advertising {
|
|
492
|
-
constructor();
|
|
493
|
-
/**
|
|
494
|
-
* Parses the advertisement data coming from SwitchBot device.
|
|
495
|
-
*
|
|
496
|
-
* This function processes advertising packets received from SwitchBot devices
|
|
497
|
-
* and extracts relevant information based on the device type.
|
|
498
|
-
*
|
|
499
|
-
* @param {NobleTypes['peripheral']} peripheral - The peripheral device object from noble.
|
|
500
|
-
* @param {Function} emitLog - The function to emit log messages.
|
|
501
|
-
* @returns {Promise<Ad | null>} - An object containing parsed data specific to the SwitchBot device type, or `null` if the device is not recognized.
|
|
502
|
-
*/
|
|
503
|
-
static parse(peripheral: NobleTypes['peripheral'], emitLog: (level: string, message: string) => void): Promise<ad | null>;
|
|
504
|
-
/**
|
|
505
|
-
* Validates if the buffer is a valid Buffer object with a minimum length.
|
|
506
|
-
*
|
|
507
|
-
* @param {any} buffer - The buffer to validate.
|
|
508
|
-
* @param {number} minLength - The minimum required length.
|
|
509
|
-
* @returns {boolean} - True if the buffer is valid, false otherwise.
|
|
510
|
-
*/
|
|
511
|
-
private static validateBuffer;
|
|
512
|
-
/**
|
|
513
|
-
* Parses the service data based on the device model.
|
|
514
|
-
*
|
|
515
|
-
* @param {string} model - The device model.
|
|
516
|
-
* @param {Buffer} serviceData - The service data buffer.
|
|
517
|
-
* @param {Buffer} manufacturerData - The manufacturer data buffer.
|
|
518
|
-
* @param {Function} emitLog - The function to emit log messages.
|
|
519
|
-
* @returns {Promise<any>} - The parsed service data.
|
|
520
|
-
*/
|
|
521
|
-
static parseServiceData(model: string, serviceData: Buffer, manufacturerData: Buffer, emitLog: (level: string, message: string) => void): Promise<any>;
|
|
522
|
-
/**
|
|
523
|
-
* Formats the address of the peripheral.
|
|
524
|
-
*
|
|
525
|
-
* @param {NobleTypes['peripheral']} peripheral - The peripheral device object from noble.
|
|
526
|
-
* @returns {string} - The formatted address.
|
|
527
|
-
*/
|
|
528
|
-
private static formatAddress;
|
|
529
|
-
}
|
|
530
|
-
/**
|
|
531
|
-
* Class representing a WoBlindTilt device.
|
|
532
|
-
* @see https://github.com/OpenWonderLabs/SwitchBotAPI-BLE/blob/latest/devicetypes/curtain.md
|
|
533
|
-
*/
|
|
534
|
-
export declare class WoBlindTilt extends SwitchbotDevice {
|
|
535
|
-
private reverse;
|
|
536
|
-
/**
|
|
537
|
-
* Parses the service data and manufacturer data for the WoBlindTilt device.
|
|
538
|
-
* @param {Buffer} serviceData - The service data buffer.
|
|
539
|
-
* @param {Buffer} manufacturerData - The manufacturer data buffer.
|
|
540
|
-
* @param {Function} emitLog - The function to emit log messages.
|
|
541
|
-
* @param {boolean} [reverse] - Whether to reverse the tilt percentage.
|
|
542
|
-
* @returns {Promise<blindTiltServiceData | null>} - The parsed data object or null if the data is invalid.
|
|
543
|
-
*/
|
|
544
|
-
static parseServiceData(serviceData: Buffer, manufacturerData: Buffer, emitLog: (level: string, message: string) => void, reverse?: boolean): Promise<blindTiltServiceData | null>;
|
|
545
|
-
constructor(peripheral: NobleTypes['peripheral'], noble: NobleTypes['noble']);
|
|
546
|
-
/**
|
|
547
|
-
* Opens the blind tilt to the fully open position.
|
|
548
|
-
* @returns {Promise<void>}
|
|
549
|
-
*/
|
|
550
|
-
open(): Promise<void>;
|
|
551
|
-
/**
|
|
552
|
-
* Closes the blind tilt up to the nearest endpoint.
|
|
553
|
-
* @returns {Promise<void>}
|
|
554
|
-
*/
|
|
555
|
-
closeUp(): Promise<void>;
|
|
556
|
-
/**
|
|
557
|
-
* Closes the blind tilt down to the nearest endpoint.
|
|
558
|
-
* @returns {Promise<void>}
|
|
559
|
-
*/
|
|
560
|
-
closeDown(): Promise<void>;
|
|
561
|
-
/**
|
|
562
|
-
* Closes the blind tilt to the nearest endpoint.
|
|
563
|
-
* @returns {Promise<void>}
|
|
564
|
-
*/
|
|
565
|
-
close(): Promise<void>;
|
|
566
|
-
/**
|
|
567
|
-
* Retrieves the current position of the blind tilt.
|
|
568
|
-
* @returns {Promise<number>} - The current position of the blind tilt (0-100).
|
|
569
|
-
*/
|
|
570
|
-
getPosition(): Promise<number>;
|
|
571
|
-
/**
|
|
572
|
-
* Retrieves the advertised value for a given key.
|
|
573
|
-
* @param {string} key - The key for the advertised value.
|
|
574
|
-
* @returns {Promise<number>} - The advertised value.
|
|
575
|
-
* @private
|
|
576
|
-
*/
|
|
577
|
-
private _getAdvValue;
|
|
578
|
-
/**
|
|
579
|
-
* Retrieves the basic information of the blind tilt.
|
|
580
|
-
* @returns {Promise<object | null>} - A promise that resolves to an object containing the basic information of the blind tilt.
|
|
581
|
-
*/
|
|
582
|
-
getBasicInfo(): Promise<object | null>;
|
|
583
|
-
/**
|
|
584
|
-
* Pauses the blind tilt operation.
|
|
585
|
-
* @returns {Promise<void>}
|
|
586
|
-
*/
|
|
587
|
-
pause(): Promise<void>;
|
|
588
|
-
/**
|
|
589
|
-
* Runs the blind tilt to the specified position.
|
|
590
|
-
* @param {number} percent - The target position percentage (0-100).
|
|
591
|
-
* @param {number} mode - The running mode (0 or 1).
|
|
592
|
-
* @returns {Promise<void>}
|
|
593
|
-
*/
|
|
594
|
-
runToPos(percent: number, mode: number): Promise<void>;
|
|
595
|
-
/**
|
|
596
|
-
* Sends a command to operate the blind tilt and handles the response.
|
|
597
|
-
* @param {number[]} bytes - The byte array representing the command to be sent to the device.
|
|
598
|
-
* @returns {Promise<void>}
|
|
599
|
-
* @private
|
|
600
|
-
*/
|
|
601
|
-
operateBlindTilt(bytes: number[]): Promise<void>;
|
|
602
|
-
}
|
|
603
|
-
/**
|
|
604
|
-
* Class representing a WoBulb device.
|
|
605
|
-
* @see https://github.com/OpenWonderLabs/SwitchBotAPI-BLE/blob/latest/devicetypes/colorbulb.md
|
|
606
|
-
*/
|
|
607
|
-
export declare class WoBulb extends SwitchbotDevice {
|
|
608
|
-
/**
|
|
609
|
-
* Parses the service data for WoBulb.
|
|
610
|
-
* @param {Buffer} serviceData - The service data buffer.
|
|
611
|
-
* @param {Buffer} manufacturerData - The manufacturer data buffer.
|
|
612
|
-
* @param {Function} emitLog - The function to emit log messages.
|
|
613
|
-
* @returns {Promise<colorBulbServiceData | null>} - Parsed service data or null if invalid.
|
|
614
|
-
*/
|
|
615
|
-
static parseServiceData(serviceData: Buffer, manufacturerData: Buffer, emitLog: (level: string, message: string) => void): Promise<colorBulbServiceData | null>;
|
|
616
|
-
constructor(peripheral: NobleTypes['peripheral'], noble: NobleTypes['noble']);
|
|
617
|
-
/**
|
|
618
|
-
* Reads the state of the bulb.
|
|
619
|
-
* @returns {Promise<boolean>} - Resolves with a boolean indicating whether the bulb is ON (true) or OFF (false).
|
|
620
|
-
*/
|
|
621
|
-
readState(): Promise<boolean>;
|
|
622
|
-
/**
|
|
623
|
-
* Sets the state of the bulb.
|
|
624
|
-
* @param {number[]} reqByteArray - The request byte array.
|
|
625
|
-
* @returns {Promise<boolean>} - Resolves with a boolean indicating whether the operation was successful.
|
|
626
|
-
* @private
|
|
627
|
-
*/
|
|
628
|
-
setState(reqByteArray: number[]): Promise<boolean>;
|
|
629
|
-
/**
|
|
630
|
-
* Turns on the bulb.
|
|
631
|
-
* @returns {Promise<boolean>} - Resolves with a boolean indicating whether the bulb is ON (true).
|
|
632
|
-
*/
|
|
633
|
-
turnOn(): Promise<boolean>;
|
|
634
|
-
/**
|
|
635
|
-
* Turns off the bulb.
|
|
636
|
-
* @returns {Promise<boolean>} - Resolves with a boolean indicating whether the bulb is OFF (false).
|
|
637
|
-
*/
|
|
638
|
-
turnOff(): Promise<boolean>;
|
|
639
|
-
/**
|
|
640
|
-
* Sets the brightness of the bulb.
|
|
641
|
-
* @param {number} brightness - The brightness percentage (0-100).
|
|
642
|
-
* @returns {Promise<boolean>} - Resolves with a boolean indicating whether the operation was successful.
|
|
643
|
-
*/
|
|
644
|
-
setBrightness(brightness: number): Promise<boolean>;
|
|
645
|
-
/**
|
|
646
|
-
* Sets the color temperature of the bulb.
|
|
647
|
-
* @param {number} color_temperature - The color temperature percentage (0-100).
|
|
648
|
-
* @returns {Promise<boolean>} - Resolves with a boolean indicating whether the operation was successful.
|
|
649
|
-
*/
|
|
650
|
-
setColorTemperature(color_temperature: number): Promise<boolean>;
|
|
651
|
-
/**
|
|
652
|
-
* Sets the RGB color of the bulb.
|
|
653
|
-
* @param {number} brightness - The brightness percentage (0-100).
|
|
654
|
-
* @param {number} red - The red color value (0-255).
|
|
655
|
-
* @param {number} green - The green color value (0-255).
|
|
656
|
-
* @param {number} blue - The blue color value (0-255).
|
|
657
|
-
* @returns {Promise<boolean>} - Resolves with a boolean indicating whether the operation was successful.
|
|
658
|
-
*/
|
|
659
|
-
setRGB(brightness: number, red: number, green: number, blue: number): Promise<boolean>;
|
|
660
|
-
/**
|
|
661
|
-
* Sends a command to the bulb.
|
|
662
|
-
* @param {number[]} bytes - The command bytes.
|
|
663
|
-
* @returns {Promise<boolean>} - Resolves with a boolean indicating whether the operation was successful.
|
|
664
|
-
* @private
|
|
665
|
-
*/
|
|
666
|
-
private operateBulb;
|
|
667
|
-
}
|
|
668
|
-
/**
|
|
669
|
-
* Class representing a WoCeilingLight device.
|
|
670
|
-
* @see https://github.com/OpenWonderLabs/SwitchBotAPI-BLE/blob/latest/devicetypes/colorbulb.md
|
|
671
|
-
*/
|
|
672
|
-
export declare class WoCeilingLight extends SwitchbotDevice {
|
|
673
|
-
/**
|
|
674
|
-
* Parses the service data for WoCeilingLight.
|
|
675
|
-
* @param {Buffer} manufacturerData - The manufacturer data buffer.
|
|
676
|
-
* @param {Function} emitLog - The function to emit log messages.
|
|
677
|
-
* @returns {Promise<ceilingLightServiceData | null>} - Parsed service data or null if invalid.
|
|
678
|
-
*/
|
|
679
|
-
static parseServiceData(manufacturerData: Buffer, emitLog: (level: string, message: string) => void): Promise<ceilingLightServiceData | null>;
|
|
680
|
-
/**
|
|
681
|
-
* Parses the service data for WoCeilingLight Pro.
|
|
682
|
-
* @param {Buffer} manufacturerData - The manufacturer data buffer.
|
|
683
|
-
* @param {Function} emitLog - The function to emit log messages.
|
|
684
|
-
* @returns {Promise<ceilingLightProServiceData | null>} - Parsed service data or null if invalid.
|
|
685
|
-
*/
|
|
686
|
-
static parseServiceData_Pro(manufacturerData: Buffer, emitLog: (level: string, message: string) => void): Promise<ceilingLightProServiceData | null>;
|
|
687
|
-
constructor(peripheral: NobleTypes['peripheral'], noble: NobleTypes['noble']);
|
|
688
|
-
/**
|
|
689
|
-
* Reads the state of the ceiling light.
|
|
690
|
-
* @returns {Promise<boolean>} - Resolves with a boolean indicating whether the light is ON (true) or OFF (false).
|
|
691
|
-
*/
|
|
692
|
-
readState(): Promise<boolean>;
|
|
693
|
-
/**
|
|
694
|
-
* Sets the state of the ceiling light.
|
|
695
|
-
* @param {number[]} reqByteArray - The request byte array.
|
|
696
|
-
* @returns {Promise<boolean>} - Resolves with a boolean indicating whether the operation was successful.
|
|
697
|
-
*/
|
|
698
|
-
setState(reqByteArray: number[]): Promise<boolean>;
|
|
699
|
-
/**
|
|
700
|
-
* Turns on the ceiling light.
|
|
701
|
-
* @returns {Promise<boolean>} - Resolves with a boolean indicating whether the light is ON (true).
|
|
702
|
-
*/
|
|
703
|
-
turnOn(): Promise<boolean>;
|
|
704
|
-
/**
|
|
705
|
-
* Turns off the ceiling light.
|
|
706
|
-
* @returns {Promise<boolean>} - Resolves with a boolean indicating whether the light is OFF (false).
|
|
707
|
-
*/
|
|
708
|
-
turnOff(): Promise<boolean>;
|
|
709
|
-
/**
|
|
710
|
-
* Sets the brightness of the ceiling light.
|
|
711
|
-
* @param {number} brightness - The brightness percentage (0-100).
|
|
712
|
-
* @returns {Promise<boolean>} - Resolves with a boolean indicating whether the operation was successful.
|
|
713
|
-
*/
|
|
714
|
-
setBrightness(brightness: number): Promise<boolean>;
|
|
715
|
-
/**
|
|
716
|
-
* Sets the color temperature of the ceiling light.
|
|
717
|
-
* @param {number} color_temperature - The color temperature percentage (0-100).
|
|
718
|
-
* @returns {Promise<boolean>} - Resolves with a boolean indicating whether the operation was successful.
|
|
719
|
-
*/
|
|
720
|
-
setColorTemperature(color_temperature: number): Promise<boolean>;
|
|
721
|
-
/**
|
|
722
|
-
* Sets the RGB color of the ceiling light.
|
|
723
|
-
* @param {number} brightness - The brightness percentage (0-100).
|
|
724
|
-
* @param {number} red - The red color value (0-255).
|
|
725
|
-
* @param {number} green - The green color value (0-255).
|
|
726
|
-
* @param {number} blue - The blue color value (0-255).
|
|
727
|
-
* @returns {Promise<boolean>} - Resolves with a boolean indicating whether the operation was successful.
|
|
728
|
-
*/
|
|
729
|
-
setRGB(brightness: number, red: number, green: number, blue: number): Promise<boolean>;
|
|
730
|
-
/**
|
|
731
|
-
* Sends a command to the ceiling light.
|
|
732
|
-
* @param {number[]} bytes - The command bytes.
|
|
733
|
-
* @returns {Promise<boolean>} - Resolves with a boolean indicating whether the operation was successful.
|
|
734
|
-
*/
|
|
735
|
-
operateCeilingLight(bytes: number[]): Promise<boolean>;
|
|
736
|
-
}
|
|
737
|
-
/**
|
|
738
|
-
* Class representing a WoContact device.
|
|
739
|
-
* @see https://github.com/OpenWonderLabs/SwitchBotAPI-BLE/blob/latest/devicetypes/contactsensor.md
|
|
740
|
-
*/
|
|
741
|
-
export declare class WoContact extends SwitchbotDevice {
|
|
742
|
-
/**
|
|
743
|
-
* Parses the service data for WoContact.
|
|
744
|
-
* @param {Buffer} serviceData - The service data buffer.
|
|
745
|
-
* @param {Function} emitLog - The function to emit log messages.
|
|
746
|
-
* @returns {Promise<contactSensorServiceData | null>} - Parsed service data or null if invalid.
|
|
747
|
-
*/
|
|
748
|
-
static parseServiceData(serviceData: Buffer, emitLog: (level: string, message: string) => void): Promise<contactSensorServiceData | null>;
|
|
749
|
-
constructor(peripheral: NobleTypes['peripheral'], noble: NobleTypes['noble']);
|
|
750
|
-
}
|
|
751
|
-
/**
|
|
752
|
-
* Class representing a WoCurtain device.
|
|
753
|
-
* @see https://github.com/OpenWonderLabs/SwitchBotAPI-BLE/blob/latest/devicetypes/curtain.md
|
|
754
|
-
* @see https://github.com/OpenWonderLabs/SwitchBotAPI-BLE/blob/latest/devicetypes/curtain3.md
|
|
755
|
-
*/
|
|
756
|
-
export declare class WoCurtain extends SwitchbotDevice {
|
|
757
|
-
/**
|
|
758
|
-
* Parses the service data for WoCurtain.
|
|
759
|
-
* @param {Buffer} serviceData - The service data buffer.
|
|
760
|
-
* @param {Buffer} manufacturerData - The manufacturer data buffer.
|
|
761
|
-
* @param {Function} emitLog - The function to emit log messages.
|
|
762
|
-
* @param {boolean} [reverse] - Whether to reverse the position.
|
|
763
|
-
* @returns {Promise<curtainServiceData | curtain3ServiceData | null>} - Parsed service data or null if invalid.
|
|
764
|
-
*/
|
|
765
|
-
static parseServiceData(serviceData: Buffer, manufacturerData: Buffer, emitLog: (level: string, message: string) => void, reverse?: boolean): Promise<curtainServiceData | curtain3ServiceData | null>;
|
|
766
|
-
constructor(peripheral: NobleTypes['peripheral'], noble: NobleTypes['noble']);
|
|
767
|
-
/**
|
|
768
|
-
* Opens the curtain.
|
|
769
|
-
* @param {number} [mode] - Running mode (0x01 = QuietDrift, 0xFF = Default).
|
|
770
|
-
* @returns {Promise<void>}
|
|
771
|
-
*/
|
|
772
|
-
open(mode?: number): Promise<void>;
|
|
773
|
-
/**
|
|
774
|
-
* Closes the curtain.
|
|
775
|
-
* @param {number} [mode] - Running mode (0x01 = QuietDrift, 0xFF = Default).
|
|
776
|
-
* @returns {Promise<void>}
|
|
777
|
-
*/
|
|
778
|
-
close(mode?: number): Promise<void>;
|
|
779
|
-
/**
|
|
780
|
-
* Pauses the curtain.
|
|
781
|
-
* @returns {Promise<void>}
|
|
782
|
-
*/
|
|
783
|
-
pause(): Promise<void>;
|
|
784
|
-
/**
|
|
785
|
-
* Runs the curtain to the target position.
|
|
786
|
-
* @param {number} percent - The percentage of the target position.
|
|
787
|
-
* @param {number} [mode] - Running mode (0x01 = QuietDrift, 0xFF = Default).
|
|
788
|
-
* @returns {Promise<void>}
|
|
789
|
-
*/
|
|
790
|
-
runToPos(percent: number, mode?: number): Promise<void>;
|
|
791
|
-
/**
|
|
792
|
-
* Sends a command to the curtain.
|
|
793
|
-
* @param {number[]} bytes - The command bytes.
|
|
794
|
-
* @returns {Promise<void>}
|
|
795
|
-
*/
|
|
796
|
-
operateCurtain(bytes: number[]): Promise<void>;
|
|
797
|
-
}
|
|
798
|
-
/**
|
|
799
|
-
* Class representing a WoHand device.
|
|
800
|
-
* @see https://github.com/OpenWonderLabs/SwitchBotAPI-BLE/blob/latest/devicetypes/bot.md
|
|
801
|
-
*/
|
|
802
|
-
export declare class WoHand extends SwitchbotDevice {
|
|
803
|
-
/**
|
|
804
|
-
* Parses the service data for WoHand.
|
|
805
|
-
* @param {Buffer} serviceData - The service data buffer.
|
|
806
|
-
* @param {Function} emitLog - The function to emit log messages.
|
|
807
|
-
* @returns {Promise<botServiceData | null>} - Parsed service data or null if invalid.
|
|
808
|
-
*/
|
|
809
|
-
static parseServiceData(serviceData: Buffer, emitLog: (level: string, message: string) => void): Promise<botServiceData | null>;
|
|
810
|
-
constructor(peripheral: NobleTypes['peripheral'], noble: NobleTypes['noble']);
|
|
811
|
-
/**
|
|
812
|
-
* Sends a command to the bot.
|
|
813
|
-
* @param {Buffer} reqBuf - The command buffer.
|
|
814
|
-
* @returns {Promise<void>}
|
|
815
|
-
*/
|
|
816
|
-
protected sendCommand(reqBuf: Buffer): Promise<void>;
|
|
817
|
-
/**
|
|
818
|
-
* Presses the bot.
|
|
819
|
-
* @returns {Promise<void>}
|
|
820
|
-
*/
|
|
821
|
-
press(): Promise<void>;
|
|
822
|
-
/**
|
|
823
|
-
* Turns on the bot.
|
|
824
|
-
* @returns {Promise<void>}
|
|
825
|
-
*/
|
|
826
|
-
turnOn(): Promise<void>;
|
|
827
|
-
/**
|
|
828
|
-
* Turns off the bot.
|
|
829
|
-
* @returns {Promise<void>}
|
|
830
|
-
*/
|
|
831
|
-
turnOff(): Promise<void>;
|
|
832
|
-
/**
|
|
833
|
-
* Moves the bot down.
|
|
834
|
-
* @returns {Promise<void>}
|
|
835
|
-
*/
|
|
836
|
-
down(): Promise<void>;
|
|
837
|
-
/**
|
|
838
|
-
* Moves the bot up.
|
|
839
|
-
* @returns {Promise<void>}
|
|
840
|
-
*/
|
|
841
|
-
up(): Promise<void>;
|
|
842
|
-
}
|
|
843
|
-
/**
|
|
844
|
-
* Class representing a WoHub2 device.
|
|
845
|
-
* @see https://github.com/OpenWonderLabs/SwitchBotAPI-BLE/blob/latest/devicetypes/meter.md
|
|
846
|
-
*/
|
|
847
|
-
export declare class WoHub2 extends SwitchbotDevice {
|
|
848
|
-
/**
|
|
849
|
-
* Parses the service data for WoHub2.
|
|
850
|
-
* @param {Buffer} manufacturerData - The manufacturer data buffer.
|
|
851
|
-
* @param {Function} emitLog - The function to emit log messages.
|
|
852
|
-
* @returns {Promise<hub2ServiceData | null>} - Parsed service data or null if invalid.
|
|
853
|
-
*/
|
|
854
|
-
static parseServiceData(manufacturerData: Buffer, emitLog: (level: string, message: string) => void): Promise<hub2ServiceData | null>;
|
|
855
|
-
constructor(peripheral: NobleTypes['peripheral'], noble: NobleTypes['noble']);
|
|
856
|
-
}
|
|
857
|
-
/**
|
|
858
|
-
* Class representing a WoHub3 device.
|
|
859
|
-
* @see https://github.com/OpenWonderLabs/SwitchBotAPI-BLE/blob/latest/devicetypes/meter.md
|
|
860
|
-
*/
|
|
861
|
-
export declare class WoHub3 extends SwitchbotDevice {
|
|
862
|
-
/**
|
|
863
|
-
* Parses the service data for WoHub3.
|
|
864
|
-
* @param {Buffer} manufacturerData - The manufacturer data buffer.
|
|
865
|
-
* @param {Function} emitLog - The function to emit log messages.
|
|
866
|
-
* @returns {Promise<hub3ServiceData | null>} - Parsed service data or null if invalid.
|
|
867
|
-
*/
|
|
868
|
-
static parseServiceData(manufacturerData: Buffer, emitLog: (level: string, message: string) => void): Promise<hub3ServiceData | null>;
|
|
869
|
-
constructor(peripheral: NobleTypes['peripheral'], noble: NobleTypes['noble']);
|
|
870
|
-
}
|
|
871
|
-
/**
|
|
872
|
-
* Class representing a WoHumi device.
|
|
873
|
-
* @see https://github.com/OpenWonderLabs/SwitchBotAPI-BLE/tree/latest/devicetypes
|
|
874
|
-
*/
|
|
875
|
-
export declare class WoHumi extends SwitchbotDevice {
|
|
876
|
-
constructor(peripheral: NobleTypes['peripheral'], noble: NobleTypes['noble']);
|
|
877
|
-
/**
|
|
878
|
-
* Parses the service data for WoHumi.
|
|
879
|
-
* @param {Buffer} serviceData - The service data buffer.
|
|
880
|
-
* @param {Function} emitLog - The function to emit log messages.
|
|
881
|
-
* @returns {Promise<humidifierServiceData | null>} - Parsed service data or null if invalid.
|
|
882
|
-
*/
|
|
883
|
-
static parseServiceData(serviceData: Buffer, emitLog: (level: string, message: string) => void): Promise<humidifierServiceData | null>;
|
|
884
|
-
/**
|
|
885
|
-
* Sends a command to the humidifier.
|
|
886
|
-
* @param {Buffer} reqBuf - The command buffer.
|
|
887
|
-
* @returns {Promise<void>}
|
|
888
|
-
*/
|
|
889
|
-
protected operateHumi(reqBuf: Buffer): Promise<void>;
|
|
890
|
-
/**
|
|
891
|
-
* Turns on the humidifier.
|
|
892
|
-
* @returns {Promise<void>}
|
|
893
|
-
*/
|
|
894
|
-
turnOn(): Promise<void>;
|
|
895
|
-
/**
|
|
896
|
-
* Turns off the humidifier.
|
|
897
|
-
* @returns {Promise<void>}
|
|
898
|
-
*/
|
|
899
|
-
turnOff(): Promise<void>;
|
|
900
|
-
/**
|
|
901
|
-
* Increases the humidifier setting.
|
|
902
|
-
* @returns {Promise<void>}
|
|
903
|
-
*/
|
|
904
|
-
increase(): Promise<void>;
|
|
905
|
-
/**
|
|
906
|
-
* Decreases the humidifier setting.
|
|
907
|
-
* @returns {Promise<void>}
|
|
908
|
-
*/
|
|
909
|
-
decrease(): Promise<void>;
|
|
910
|
-
/**
|
|
911
|
-
* Sets the humidifier to auto mode.
|
|
912
|
-
* @returns {Promise<void>}
|
|
913
|
-
*/
|
|
914
|
-
setAutoMode(): Promise<void>;
|
|
915
|
-
/**
|
|
916
|
-
* Sets the humidifier to manual mode.
|
|
917
|
-
* @returns {Promise<void>}
|
|
918
|
-
*/
|
|
919
|
-
setManualMode(): Promise<void>;
|
|
920
|
-
/**
|
|
921
|
-
* Sets the humidifier level.
|
|
922
|
-
* @param {number} level - The level to set (0-100).
|
|
923
|
-
* @returns {Promise<void>}
|
|
924
|
-
*/
|
|
925
|
-
percentage(level: number): Promise<void>;
|
|
926
|
-
}
|
|
927
|
-
/**
|
|
928
|
-
* Class representing a WoHumi device.
|
|
929
|
-
* @see https://github.com/OpenWonderLabs/SwitchBotAPI-BLE/tree/latest/devicetypes
|
|
930
|
-
*/
|
|
931
|
-
export declare class WoHumi2 extends SwitchbotDevice {
|
|
932
|
-
constructor(peripheral: NobleTypes['peripheral'], noble: NobleTypes['noble']);
|
|
933
|
-
/**
|
|
934
|
-
* Parses the service data for WoHumi.
|
|
935
|
-
* @param {Buffer} serviceData - The service data buffer.
|
|
936
|
-
* @param {Function} emitLog - The function to emit log messages.
|
|
937
|
-
* @returns {Promise<humidifier2ServiceData | null>} - Parsed service data or null if invalid.
|
|
938
|
-
*/
|
|
939
|
-
static parseServiceData(serviceData: Buffer, emitLog: (level: string, message: string) => void): Promise<humidifier2ServiceData | null>;
|
|
940
|
-
/**
|
|
941
|
-
* Sends a command to the humidifier.
|
|
942
|
-
* @param {Buffer} reqBuf - The command buffer.
|
|
943
|
-
* @returns {Promise<void>}
|
|
944
|
-
*/
|
|
945
|
-
protected operateHumi(reqBuf: Buffer): Promise<void>;
|
|
946
|
-
/**
|
|
947
|
-
* Turns on the humidifier.
|
|
948
|
-
* @returns {Promise<void>}
|
|
949
|
-
*/
|
|
950
|
-
turnOn(): Promise<void>;
|
|
951
|
-
/**
|
|
952
|
-
* Turns off the humidifier.
|
|
953
|
-
* @returns {Promise<void>}
|
|
954
|
-
*/
|
|
955
|
-
turnOff(): Promise<void>;
|
|
956
|
-
/**
|
|
957
|
-
* Increases the humidifier setting.
|
|
958
|
-
* @returns {Promise<void>}
|
|
959
|
-
*/
|
|
960
|
-
increase(): Promise<void>;
|
|
961
|
-
/**
|
|
962
|
-
* Decreases the humidifier setting.
|
|
963
|
-
* @returns {Promise<void>}
|
|
964
|
-
*/
|
|
965
|
-
decrease(): Promise<void>;
|
|
966
|
-
/**
|
|
967
|
-
* Sets the humidifier to auto mode.
|
|
968
|
-
* @returns {Promise<void>}
|
|
969
|
-
*/
|
|
970
|
-
setAutoMode(): Promise<void>;
|
|
971
|
-
/**
|
|
972
|
-
* Sets the humidifier to manual mode.
|
|
973
|
-
* @returns {Promise<void>}
|
|
974
|
-
*/
|
|
975
|
-
setManualMode(): Promise<void>;
|
|
976
|
-
/**
|
|
977
|
-
* Sets the humidifier level.
|
|
978
|
-
* @param {number} level - The level to set (0-100).
|
|
979
|
-
* @returns {Promise<void>}
|
|
980
|
-
*/
|
|
981
|
-
percentage(level: number): Promise<void>;
|
|
982
|
-
}
|
|
983
|
-
/**
|
|
984
|
-
* Class representing a WoIOSensorTH device.
|
|
985
|
-
* @see https://github.com/OpenWonderLabs/SwitchBotAPI-BLE/blob/latest/devicetypes/meter.md#outdoor-temperaturehumidity-sensor
|
|
986
|
-
*/
|
|
987
|
-
export declare class WoIOSensorTH extends SwitchbotDevice {
|
|
988
|
-
/**
|
|
989
|
-
* Parses the service data for WoIOSensorTH.
|
|
990
|
-
* @param {Buffer} serviceData - The service data buffer.
|
|
991
|
-
* @param {Buffer} manufacturerData - The manufacturer data buffer.
|
|
992
|
-
* @param {Function} emitLog - The function to emit log messages.
|
|
993
|
-
* @returns {Promise<outdoorMeterServiceData | null>} - Parsed service data or null if invalid.
|
|
994
|
-
*/
|
|
995
|
-
static parseServiceData(serviceData: Buffer, manufacturerData: Buffer, emitLog: (level: string, message: string) => void): Promise<outdoorMeterServiceData | null>;
|
|
996
|
-
constructor(peripheral: NobleTypes['peripheral'], noble: NobleTypes['noble']);
|
|
997
|
-
}
|
|
998
|
-
/**
|
|
999
|
-
* Class representing a WoKeypad device.
|
|
1000
|
-
*/
|
|
1001
|
-
export declare class WoKeypad extends SwitchbotDevice {
|
|
1002
|
-
/**
|
|
1003
|
-
* Parses the service data for WoKeypad.
|
|
1004
|
-
* @param {Buffer} serviceData - The service data buffer.
|
|
1005
|
-
* @param {Buffer} manufacturerData - The manufacturer data buffer.
|
|
1006
|
-
* @param {Function} emitLog - The function to emit log messages.
|
|
1007
|
-
* @returns {Promise<keypadDetectorServiceData | null>} - Parsed service data or null if invalid.
|
|
1008
|
-
*/
|
|
1009
|
-
static parseServiceData(serviceData: Buffer, manufacturerData: Buffer, emitLog: (level: string, message: string) => void): Promise<keypadDetectorServiceData | null>;
|
|
1010
|
-
constructor(peripheral: NobleTypes['peripheral'], noble: NobleTypes['noble']);
|
|
1011
|
-
}
|
|
1012
|
-
/**
|
|
1013
|
-
* Class representing a WoLeak device.
|
|
1014
|
-
* @see https://github.com/OpenWonderLabs/SwitchBotAPI-BLE/blob/latest/devicetypes/meter.md#outdoor-temperaturehumidity-sensor
|
|
1015
|
-
*/
|
|
1016
|
-
export declare class WoLeak extends SwitchbotDevice {
|
|
1017
|
-
/**
|
|
1018
|
-
* Parses the service data for WoLeak.
|
|
1019
|
-
* @param {Buffer} serviceData - The service data buffer.
|
|
1020
|
-
* @param {Buffer} manufacturerData - The manufacturer data buffer.
|
|
1021
|
-
* @param {Function} emitLog - The function to emit log messages.
|
|
1022
|
-
* @returns {Promise<waterLeakDetectorServiceData | null>} - Parsed service data or null if invalid.
|
|
1023
|
-
*/
|
|
1024
|
-
static parseServiceData(serviceData: Buffer, manufacturerData: Buffer, emitLog: (level: string, message: string) => void): Promise<waterLeakDetectorServiceData | null>;
|
|
1025
|
-
constructor(peripheral: NobleTypes['peripheral'], noble: NobleTypes['noble']);
|
|
1026
|
-
}
|
|
1027
|
-
/**
|
|
1028
|
-
* Class representing a WoPlugMini device.
|
|
1029
|
-
* @see https://github.com/OpenWonderLabs/SwitchBotAPI-BLE/blob/latest/devicetypes/plugmini.md
|
|
1030
|
-
*/
|
|
1031
|
-
export declare class WoPlugMiniJP extends SwitchbotDevice {
|
|
1032
|
-
constructor(peripheral: NobleTypes['peripheral'], noble: NobleTypes['noble']);
|
|
1033
|
-
/**
|
|
1034
|
-
* Parses the service data for WoPlugMini JP.
|
|
1035
|
-
* @param {Buffer} manufacturerData - The manufacturer data buffer.
|
|
1036
|
-
* @param {Function} emitLog - The function to emit log messages.
|
|
1037
|
-
* @returns {Promise<plugMiniJPServiceData | null>} - Parsed service data or null if invalid.
|
|
1038
|
-
*/
|
|
1039
|
-
static parseServiceData(manufacturerData: Buffer, emitLog: (level: string, message: string) => void): Promise<plugMiniJPServiceData | null>;
|
|
1040
|
-
/**
|
|
1041
|
-
* Reads the state of the plug.
|
|
1042
|
-
* @returns {Promise<boolean>} - Resolves with a boolean that tells whether the plug is ON (true) or OFF (false).
|
|
1043
|
-
*/
|
|
1044
|
-
readState(): Promise<boolean>;
|
|
1045
|
-
/**
|
|
1046
|
-
* Sets the state of the plug.
|
|
1047
|
-
* @private
|
|
1048
|
-
* @param {number[]} reqByteArray - The request byte array.
|
|
1049
|
-
* @returns {Promise<boolean>} - Resolves with a boolean that tells whether the plug is ON (true) or OFF (false).
|
|
1050
|
-
*/
|
|
1051
|
-
setState(reqByteArray: number[]): Promise<boolean>;
|
|
1052
|
-
/**
|
|
1053
|
-
* Turns on the plug.
|
|
1054
|
-
* @returns {Promise<boolean>} - Resolves with a boolean that tells whether the plug is ON (true) or OFF (false).
|
|
1055
|
-
*/
|
|
1056
|
-
turnOn(): Promise<boolean>;
|
|
1057
|
-
/**
|
|
1058
|
-
* Turns off the plug.
|
|
1059
|
-
* @returns {Promise<boolean>} - Resolves with a boolean that tells whether the plug is ON (true) or OFF (false).
|
|
1060
|
-
*/
|
|
1061
|
-
turnOff(): Promise<boolean>;
|
|
1062
|
-
/**
|
|
1063
|
-
* Toggles the state of the plug.
|
|
1064
|
-
* @returns {Promise<boolean>} - Resolves with a boolean that tells whether the plug is ON (true) or OFF (false).
|
|
1065
|
-
*/
|
|
1066
|
-
toggle(): Promise<boolean>;
|
|
1067
|
-
/**
|
|
1068
|
-
* Operates the plug with the given bytes.
|
|
1069
|
-
* @param {number[]} bytes - The byte array to send to the plug.
|
|
1070
|
-
* @returns {Promise<boolean>} - Resolves with a boolean that tells whether the plug is ON (true) or OFF (false).
|
|
1071
|
-
*/
|
|
1072
|
-
operatePlug(bytes: number[]): Promise<boolean>;
|
|
1073
|
-
}
|
|
1074
|
-
/**
|
|
1075
|
-
* Class representing a WoPlugMini EU device.
|
|
1076
|
-
* @see https://github.com/OpenWonderLabs/SwitchBotAPI-BLE/blob/latest/devicetypes/plugmini.md
|
|
1077
|
-
*/
|
|
1078
|
-
export declare class WoPlugMiniEU extends SwitchbotDevice {
|
|
1079
|
-
constructor(peripheral: NobleTypes['peripheral'], noble: NobleTypes['noble']);
|
|
1080
|
-
/**
|
|
1081
|
-
* Parses the service data for WoPlugMini EU.
|
|
1082
|
-
* @param {Buffer} manufacturerData - The manufacturer data buffer.
|
|
1083
|
-
* @param {Function} emitLog - The function to emit log messages.
|
|
1084
|
-
* @returns {Promise<plugMiniEUServiceData | null>} - Parsed service data or null if invalid.
|
|
1085
|
-
*/
|
|
1086
|
-
static parseServiceData(manufacturerData: Buffer, emitLog: (level: string, message: string) => void): Promise<plugMiniEUServiceData | null>;
|
|
1087
|
-
/**
|
|
1088
|
-
* Reads the state of the plug.
|
|
1089
|
-
* @returns {Promise<boolean>} - Resolves with a boolean that tells whether the plug is ON (true) or OFF (false).
|
|
1090
|
-
*/
|
|
1091
|
-
readState(): Promise<boolean>;
|
|
1092
|
-
/**
|
|
1093
|
-
* Sets the state of the plug.
|
|
1094
|
-
* @param {number[]} reqByteArray - The request byte array.
|
|
1095
|
-
* @returns {Promise<boolean>} - Resolves with a boolean that tells whether the plug is ON (true) or OFF (false).
|
|
1096
|
-
*/
|
|
1097
|
-
setState(reqByteArray: number[]): Promise<boolean>;
|
|
1098
|
-
/**
|
|
1099
|
-
* Turns on the plug.
|
|
1100
|
-
* @returns {Promise<boolean>} - Resolves with a boolean that tells whether the plug is ON (true) or OFF (false).
|
|
1101
|
-
*/
|
|
1102
|
-
turnOn(): Promise<boolean>;
|
|
1103
|
-
/**
|
|
1104
|
-
* Turns off the plug.
|
|
1105
|
-
* @returns {Promise<boolean>} - Resolves with a boolean that tells whether the plug is ON (true) or OFF (false).
|
|
1106
|
-
*/
|
|
1107
|
-
turnOff(): Promise<boolean>;
|
|
1108
|
-
/**
|
|
1109
|
-
* Toggles the state of the plug.
|
|
1110
|
-
* @returns {Promise<boolean>} - Resolves with a boolean that tells whether the plug is ON (true) or OFF (false).
|
|
1111
|
-
*/
|
|
1112
|
-
toggle(): Promise<boolean>;
|
|
1113
|
-
/**
|
|
1114
|
-
* Operates the plug with the given bytes.
|
|
1115
|
-
* @param {number[]} bytes - The byte array to send to the plug.
|
|
1116
|
-
* @returns {Promise<boolean>} - Resolves with a boolean that tells whether the plug is ON (true) or OFF (false).
|
|
1117
|
-
*/
|
|
1118
|
-
operatePlug(bytes: number[]): Promise<boolean>;
|
|
1119
|
-
}
|
|
1120
|
-
/**
|
|
1121
|
-
* Class representing a WoPlugMini device.
|
|
1122
|
-
* @see https://github.com/OpenWonderLabs/SwitchBotAPI-BLE/blob/latest/devicetypes/plugmini.md
|
|
1123
|
-
*/
|
|
1124
|
-
export declare class WoPlugMiniUS extends SwitchbotDevice {
|
|
1125
|
-
constructor(peripheral: NobleTypes['peripheral'], noble: NobleTypes['noble']);
|
|
1126
|
-
/**
|
|
1127
|
-
* Parses the service data for WoPlugMini US.
|
|
1128
|
-
* @param {Buffer} manufacturerData - The manufacturer data buffer.
|
|
1129
|
-
* @param {Function} emitLog - The function to emit log messages.
|
|
1130
|
-
* @returns {Promise<plugMiniUSServiceData | null>} - Parsed service data or null if invalid.
|
|
1131
|
-
*/
|
|
1132
|
-
static parseServiceData(manufacturerData: Buffer, emitLog: (level: string, message: string) => void): Promise<plugMiniUSServiceData | null>;
|
|
1133
|
-
/**
|
|
1134
|
-
* Reads the state of the plug.
|
|
1135
|
-
* @returns {Promise<boolean>} - Resolves with a boolean that tells whether the plug is ON (true) or OFF (false).
|
|
1136
|
-
*/
|
|
1137
|
-
readState(): Promise<boolean>;
|
|
1138
|
-
/**
|
|
1139
|
-
* Sets the state of the plug.
|
|
1140
|
-
* @private
|
|
1141
|
-
* @param {number[]} reqByteArray - The request byte array.
|
|
1142
|
-
* @returns {Promise<boolean>} - Resolves with a boolean that tells whether the plug is ON (true) or OFF (false).
|
|
1143
|
-
*/
|
|
1144
|
-
private setState;
|
|
1145
|
-
/**
|
|
1146
|
-
* Turns on the plug.
|
|
1147
|
-
* @returns {Promise<boolean>} - Resolves with a boolean that tells whether the plug is ON (true) or OFF (false).
|
|
1148
|
-
*/
|
|
1149
|
-
turnOn(): Promise<boolean>;
|
|
1150
|
-
/**
|
|
1151
|
-
* Turns off the plug.
|
|
1152
|
-
* @returns {Promise<boolean>} - Resolves with a boolean that tells whether the plug is ON (true) or OFF (false).
|
|
1153
|
-
*/
|
|
1154
|
-
turnOff(): Promise<boolean>;
|
|
1155
|
-
/**
|
|
1156
|
-
* Toggles the state of the plug.
|
|
1157
|
-
* @returns {Promise<boolean>} - Resolves with a boolean that tells whether the plug is ON (true) or OFF (false).
|
|
1158
|
-
*/
|
|
1159
|
-
toggle(): Promise<boolean>;
|
|
1160
|
-
/**
|
|
1161
|
-
* Operates the plug with the given bytes.
|
|
1162
|
-
* @param {number[]} bytes - The byte array to send to the plug.
|
|
1163
|
-
* @returns {Promise<boolean>} - Resolves with a boolean that tells whether the plug is ON (true) or OFF (false).
|
|
1164
|
-
*/
|
|
1165
|
-
operatePlug(bytes: number[]): Promise<boolean>;
|
|
1166
|
-
}
|
|
1167
|
-
/**
|
|
1168
|
-
* Class representing a WoPresence device.
|
|
1169
|
-
* @see https://github.com/OpenWonderLabs/SwitchBotAPI-BLE/blob/latest/devicetypes/meter.md
|
|
1170
|
-
*/
|
|
1171
|
-
export declare class WoPresence extends SwitchbotDevice {
|
|
1172
|
-
/**
|
|
1173
|
-
* Parses the service data for WoPresence.
|
|
1174
|
-
* @param {Buffer} serviceData - The service data buffer.
|
|
1175
|
-
* @param {Function} emitLog - The function to emit log messages.
|
|
1176
|
-
* @returns {Promise<motionSensorServiceData | null>} - Parsed service data or null if invalid.
|
|
1177
|
-
*/
|
|
1178
|
-
static parseServiceData(serviceData: Buffer, emitLog: (level: string, message: string) => void): Promise<motionSensorServiceData | null>;
|
|
1179
|
-
/**
|
|
1180
|
-
* Parses the manufacturer data for presence sensors.
|
|
1181
|
-
* @param {Buffer | null} serviceData - The optional service data buffer.
|
|
1182
|
-
* @param {Buffer} manufacturerData - The manufacturer data buffer.
|
|
1183
|
-
* @param {Function} emitLog - The function to emit log messages.
|
|
1184
|
-
* @returns {Promise<presenceSensorServiceData | null>} - Parsed service data or null if invalid.
|
|
1185
|
-
*/
|
|
1186
|
-
static parsePresenceSensorServiceData(serviceData: Buffer | null, manufacturerData: Buffer, emitLog: (level: string, message: string) => void): Promise<presenceSensorServiceData | null>;
|
|
1187
|
-
constructor(peripheral: NobleTypes['peripheral'], noble: NobleTypes['noble']);
|
|
1188
|
-
}
|
|
1189
|
-
/**
|
|
1190
|
-
* Class representing a WoRelaySwitch1 device.
|
|
1191
|
-
* @see https://github.com/OpenWonderLabs/SwitchBotAPI-BLE/
|
|
1192
|
-
*/
|
|
1193
|
-
export declare class WoRelaySwitch1 extends SwitchbotDevice {
|
|
1194
|
-
constructor(peripheral: NobleTypes['peripheral'], noble: NobleTypes['noble']);
|
|
1195
|
-
/**
|
|
1196
|
-
* Parses the service data for WoRelaySwitch1.
|
|
1197
|
-
* @param {Buffer} serviceData - The service data buffer.
|
|
1198
|
-
* @param {Buffer} manufacturerData - The manufacturer data buffer.
|
|
1199
|
-
* @param {Function} emitLog - The function to emit log messages.
|
|
1200
|
-
* @returns {Promise<relaySwitch1ServiceData | null>} - Parsed service data or null if invalid.
|
|
1201
|
-
*/
|
|
1202
|
-
static parseServiceData(serviceData: Buffer, manufacturerData: Buffer, emitLog: (level: string, message: string) => void): Promise<relaySwitch1ServiceData | null>;
|
|
1203
|
-
/**
|
|
1204
|
-
* Sends a command to the bot.
|
|
1205
|
-
* @param {Buffer} reqBuf - The command buffer.
|
|
1206
|
-
* @returns {Promise<void>}
|
|
1207
|
-
*/
|
|
1208
|
-
protected sendCommand(reqBuf: Buffer): Promise<void>;
|
|
1209
|
-
/**
|
|
1210
|
-
* Turns on the bot.
|
|
1211
|
-
* @returns {Promise<void>}
|
|
1212
|
-
*/
|
|
1213
|
-
turnOn(): Promise<void>;
|
|
1214
|
-
/**
|
|
1215
|
-
* Turns off the bot.
|
|
1216
|
-
* @returns {Promise<void>}
|
|
1217
|
-
*/
|
|
1218
|
-
turnOff(): Promise<void>;
|
|
1219
|
-
}
|
|
1220
|
-
/**
|
|
1221
|
-
* Class representing a WoRelaySwitch1PM device.
|
|
1222
|
-
* @see https://github.com/OpenWonderLabs/SwitchBotAPI-BLE/
|
|
1223
|
-
*/
|
|
1224
|
-
export declare class WoRelaySwitch1PM extends SwitchbotDevice {
|
|
1225
|
-
constructor(peripheral: NobleTypes['peripheral'], noble: NobleTypes['noble']);
|
|
1226
|
-
/**
|
|
1227
|
-
* Parses the service data for WoRelaySwitch1PM.
|
|
1228
|
-
* @param {Buffer} serviceData - The service data buffer.
|
|
1229
|
-
* @param {Buffer} manufacturerData - The manufacturer data buffer.
|
|
1230
|
-
* @param {Function} emitLog - The function to emit log messages.
|
|
1231
|
-
* @returns {Promise<relaySwitch1PMServiceData | null>} - Parsed service data or null if invalid.
|
|
1232
|
-
*/
|
|
1233
|
-
static parseServiceData(serviceData: Buffer, manufacturerData: Buffer, emitLog: (level: string, message: string) => void): Promise<relaySwitch1PMServiceData | null>;
|
|
1234
|
-
/**
|
|
1235
|
-
* Sends a command to the bot.
|
|
1236
|
-
* @param {Buffer} reqBuf - The command buffer.
|
|
1237
|
-
* @returns {Promise<void>}
|
|
1238
|
-
*/
|
|
1239
|
-
protected sendCommand(reqBuf: Buffer): Promise<void>;
|
|
1240
|
-
/**
|
|
1241
|
-
* Turns on the bot.
|
|
1242
|
-
* @returns {Promise<void>}
|
|
1243
|
-
*/
|
|
1244
|
-
turnOn(): Promise<void>;
|
|
1245
|
-
/**
|
|
1246
|
-
* Turns off the bot.
|
|
1247
|
-
* @returns {Promise<void>}
|
|
1248
|
-
*/
|
|
1249
|
-
turnOff(): Promise<void>;
|
|
1250
|
-
}
|
|
1251
|
-
/**
|
|
1252
|
-
* Class representing a WoRemote device.
|
|
1253
|
-
* @see https://github.com/OpenWonderLabs/SwitchBotAPI-BLE/blob/latest/devicetypes/
|
|
1254
|
-
*/
|
|
1255
|
-
export declare class WoRemote extends SwitchbotDevice {
|
|
1256
|
-
/**
|
|
1257
|
-
* Parses the service data for WoRemote.
|
|
1258
|
-
* @param {Buffer} serviceData - The service data buffer.
|
|
1259
|
-
* @param {Function} emitLog - The function to emit log messages.
|
|
1260
|
-
* @returns {Promise<remoteServiceData | null>} - Parsed service data or null if invalid.
|
|
1261
|
-
*/
|
|
1262
|
-
static parseServiceData(serviceData: Buffer, emitLog: (level: string, message: string) => void): Promise<remoteServiceData | null>;
|
|
1263
|
-
constructor(peripheral: NobleTypes['peripheral'], noble: NobleTypes['noble']);
|
|
1264
|
-
}
|
|
1265
|
-
/**
|
|
1266
|
-
* Class representing a WoSensorTH device.
|
|
1267
|
-
* @see https://github.com/OpenWonderLabs/SwitchBotAPI-BLE/blob/latest/devicetypes/meter.md
|
|
1268
|
-
*/
|
|
1269
|
-
export declare class WoSensorTH extends SwitchbotDevice {
|
|
1270
|
-
constructor(peripheral: NobleTypes['peripheral'], noble: NobleTypes['noble']);
|
|
1271
|
-
static parseServiceData(serviceData: Buffer, emitLog: (level: string, message: string) => void): Promise<meterServiceData | null>;
|
|
1272
|
-
}
|
|
1273
|
-
/**
|
|
1274
|
-
* Class representing a WoSensorTH device.
|
|
1275
|
-
* @see https://github.com/OpenWonderLabs/SwitchBotAPI-BLE/blob/latest/devicetypes/meter.md
|
|
1276
|
-
*/
|
|
1277
|
-
export declare class WoSensorTHPlus extends SwitchbotDevice {
|
|
1278
|
-
constructor(peripheral: NobleTypes['peripheral'], noble: NobleTypes['noble']);
|
|
1279
|
-
static parseServiceData(serviceData: Buffer, emitLog: (level: string, message: string) => void): Promise<meterPlusServiceData | null>;
|
|
1280
|
-
}
|
|
1281
|
-
/**
|
|
1282
|
-
* Class representing a WoSensorTH device.
|
|
1283
|
-
* @see https://github.com/OpenWonderLabs/SwitchBotAPI-BLE/blob/latest/devicetypes/meter.md
|
|
1284
|
-
*/
|
|
1285
|
-
export declare class WoSensorTHPro extends SwitchbotDevice {
|
|
1286
|
-
constructor(peripheral: NobleTypes['peripheral'], noble: NobleTypes['noble']);
|
|
1287
|
-
static parseServiceData(serviceData: Buffer, emitLog: (level: string, message: string) => void): Promise<meterProServiceData | null>;
|
|
1288
|
-
}
|
|
1289
|
-
/**
|
|
1290
|
-
* Class representing a WoSensorTH device.
|
|
1291
|
-
* @see https://github.com/OpenWonderLabs/SwitchBotAPI-BLE/blob/latest/devicetypes/meter.md
|
|
1292
|
-
*/
|
|
1293
|
-
export declare class WoSensorTHProCO2 extends SwitchbotDevice {
|
|
1294
|
-
constructor(peripheral: NobleTypes['peripheral'], noble: NobleTypes['noble']);
|
|
1295
|
-
static parseServiceData(serviceData: Buffer, manufacturerData: Buffer, emitLog: (level: string, message: string) => void): Promise<meterProCO2ServiceData | null>;
|
|
1296
|
-
}
|
|
1297
|
-
/**
|
|
1298
|
-
* Class representing a WoSmartLock device.
|
|
1299
|
-
* @see https://github.com/OpenWonderLabs/SwitchBotAPI-BLE/blob/latest/devicetypes/lock.md
|
|
1300
|
-
*/
|
|
1301
|
-
export declare class WoSmartLock extends SwitchbotDevice {
|
|
1302
|
-
iv: Buffer | null;
|
|
1303
|
-
key_id: string;
|
|
1304
|
-
encryption_key: Buffer | null;
|
|
1305
|
-
static Result: {
|
|
1306
|
-
ERROR: number;
|
|
1307
|
-
SUCCESS: number;
|
|
1308
|
-
SUCCESS_LOW_BATTERY: number;
|
|
1309
|
-
};
|
|
1310
|
-
static validateResponse(res: Buffer): Promise<number>;
|
|
1311
|
-
static getLockStatus(code: number): string;
|
|
1312
|
-
/**
|
|
1313
|
-
* Parses the service data from the SwitchBot Strip Light.
|
|
1314
|
-
* @param {Buffer} serviceData - The service data buffer.
|
|
1315
|
-
* @param {Buffer} manufacturerData - The manufacturer data buffer.
|
|
1316
|
-
* @param {Function} emitLog - The function to emit log messages.
|
|
1317
|
-
* @returns {Promise<lockServiceData | null>} - Parsed service data or null if invalid.
|
|
1318
|
-
*/
|
|
1319
|
-
static parseServiceData(serviceData: Buffer, manufacturerData: Buffer, emitLog: (level: string, message: string) => void): Promise<lockServiceData | null>;
|
|
1320
|
-
constructor(peripheral: NobleTypes['peripheral'], noble: NobleTypes['noble']);
|
|
1321
|
-
/**
|
|
1322
|
-
* Initializes the encryption key info for valid lock communication.
|
|
1323
|
-
* @param {string} keyId - The key ID.
|
|
1324
|
-
* @param {string} encryptionKey - The encryption key.
|
|
1325
|
-
*/
|
|
1326
|
-
setKey(keyId: string, encryptionKey: string): Promise<void>;
|
|
1327
|
-
/**
|
|
1328
|
-
* Unlocks the Smart Lock.
|
|
1329
|
-
* @returns {Promise<number>} - The result of the unlock operation.
|
|
1330
|
-
*/
|
|
1331
|
-
unlock(): Promise<number>;
|
|
1332
|
-
/**
|
|
1333
|
-
* Unlocks the Smart Lock without unlatching the door.
|
|
1334
|
-
* @returns {Promise<number>} - The result of the unlock operation.
|
|
1335
|
-
*/
|
|
1336
|
-
unlockNoUnlatch(): Promise<number>;
|
|
1337
|
-
/**
|
|
1338
|
-
* Locks the Smart Lock.
|
|
1339
|
-
* @returns {Promise<number>} - The result of the lock operation.
|
|
1340
|
-
*/
|
|
1341
|
-
lock(): Promise<number>;
|
|
1342
|
-
/**
|
|
1343
|
-
* Gets general state info from the Smart Lock.
|
|
1344
|
-
* @returns {Promise<object | null>} - The state object or null if an error occurred.
|
|
1345
|
-
*/
|
|
1346
|
-
info(): Promise<object | null>;
|
|
1347
|
-
/**
|
|
1348
|
-
* Encrypts a string using AES-128-CTR.
|
|
1349
|
-
* @param {string} str - The string to encrypt.
|
|
1350
|
-
* @returns {Promise<string>} - The encrypted string in hex format.
|
|
1351
|
-
*/
|
|
1352
|
-
encrypt(str: string): Promise<string>;
|
|
1353
|
-
/**
|
|
1354
|
-
* Decrypts a buffer using AES-128-CTR.
|
|
1355
|
-
* @param {Buffer} data - The data to decrypt.
|
|
1356
|
-
* @returns {Promise<Buffer>} - The decrypted data.
|
|
1357
|
-
*/
|
|
1358
|
-
decrypt(data: Buffer): Promise<Buffer>;
|
|
1359
|
-
/**
|
|
1360
|
-
* Retrieves the IV from the device.
|
|
1361
|
-
* @returns {Promise<Buffer>} - The IV buffer.
|
|
1362
|
-
*/
|
|
1363
|
-
getIv(): Promise<Buffer>;
|
|
1364
|
-
/**
|
|
1365
|
-
* Sends an encrypted command to the device.
|
|
1366
|
-
* @param {string} key - The command key.
|
|
1367
|
-
* @returns {Promise<Buffer>} - The response buffer.
|
|
1368
|
-
*/
|
|
1369
|
-
encryptedCommand(key: string): Promise<Buffer>;
|
|
1370
|
-
/**
|
|
1371
|
-
* Operates the lock with the given command.
|
|
1372
|
-
* @param {string} key - The command key.
|
|
1373
|
-
* @param {boolean} [encrypt] - Whether to encrypt the command.
|
|
1374
|
-
* @returns {Promise<Buffer>} - The response buffer.
|
|
1375
|
-
*/
|
|
1376
|
-
operateLock(key: string, encrypt?: boolean): Promise<Buffer>;
|
|
1377
|
-
}
|
|
1378
|
-
/**
|
|
1379
|
-
* Class representing a WoSmartLockPro device.
|
|
1380
|
-
* @see https://github.com/OpenWonderLabs/SwitchBotAPI-BLE/blob/latest/devicetypes/lock.md
|
|
1381
|
-
*/
|
|
1382
|
-
export declare class WoSmartLockPro extends SwitchbotDevice {
|
|
1383
|
-
iv: Buffer | null;
|
|
1384
|
-
key_id: string;
|
|
1385
|
-
encryption_key: Buffer | null;
|
|
1386
|
-
static Result: {
|
|
1387
|
-
ERROR: number;
|
|
1388
|
-
SUCCESS: number;
|
|
1389
|
-
SUCCESS_LOW_BATTERY: number;
|
|
1390
|
-
};
|
|
1391
|
-
static validateResponse(res: Buffer): Promise<number>;
|
|
1392
|
-
static getLockStatus(code: number): string;
|
|
1393
|
-
/**
|
|
1394
|
-
* Parses the service data from the SwitchBot Strip Light.
|
|
1395
|
-
* @param {Buffer} serviceData - The service data buffer.
|
|
1396
|
-
* @param {Buffer} manufacturerData - The manufacturer data buffer.
|
|
1397
|
-
* @param {Function} emitLog - The function to emit log messages.
|
|
1398
|
-
* @returns {Promise<lockProServiceData | null>} - Parsed service data or null if invalid.
|
|
1399
|
-
*/
|
|
1400
|
-
static parseServiceData(serviceData: Buffer, manufacturerData: Buffer, emitLog: (level: string, message: string) => void): Promise<lockProServiceData | null>;
|
|
1401
|
-
constructor(peripheral: NobleTypes['peripheral'], noble: NobleTypes['noble']);
|
|
1402
|
-
/**
|
|
1403
|
-
* Initializes the encryption key info for valid lock communication.
|
|
1404
|
-
* @param {string} keyId - The key ID.
|
|
1405
|
-
* @param {string} encryptionKey - The encryption key.
|
|
1406
|
-
*/
|
|
1407
|
-
setKey(keyId: string, encryptionKey: string): Promise<void>;
|
|
1408
|
-
/**
|
|
1409
|
-
* Unlocks the Smart Lock.
|
|
1410
|
-
* @returns {Promise<number>} - The result of the unlock operation.
|
|
1411
|
-
*/
|
|
1412
|
-
unlock(): Promise<number>;
|
|
1413
|
-
/**
|
|
1414
|
-
* Unlocks the Smart Lock without unlatching the door.
|
|
1415
|
-
* @returns {Promise<number>} - The result of the unlock operation.
|
|
1416
|
-
*/
|
|
1417
|
-
unlockNoUnlatch(): Promise<number>;
|
|
1418
|
-
/**
|
|
1419
|
-
* Locks the Smart Lock.
|
|
1420
|
-
* @returns {Promise<number>} - The result of the lock operation.
|
|
1421
|
-
*/
|
|
1422
|
-
lock(): Promise<number>;
|
|
1423
|
-
/**
|
|
1424
|
-
* Gets general state info from the Smart Lock.
|
|
1425
|
-
* @returns {Promise<object | null>} - The state object or null if an error occurred.
|
|
1426
|
-
*/
|
|
1427
|
-
info(): Promise<object | null>;
|
|
1428
|
-
/**
|
|
1429
|
-
* Encrypts a string using AES-128-CTR.
|
|
1430
|
-
* @param {string} str - The string to encrypt.
|
|
1431
|
-
* @returns {Promise<string>} - The encrypted string in hex format.
|
|
1432
|
-
*/
|
|
1433
|
-
encrypt(str: string): Promise<string>;
|
|
1434
|
-
/**
|
|
1435
|
-
* Decrypts a buffer using AES-128-CTR.
|
|
1436
|
-
* @param {Buffer} data - The data to decrypt.
|
|
1437
|
-
* @returns {Promise<Buffer>} - The decrypted data.
|
|
1438
|
-
*/
|
|
1439
|
-
decrypt(data: Buffer): Promise<Buffer>;
|
|
1440
|
-
/**
|
|
1441
|
-
* Retrieves the IV from the device.
|
|
1442
|
-
* @returns {Promise<Buffer>} - The IV buffer.
|
|
1443
|
-
*/
|
|
1444
|
-
getIv(): Promise<Buffer>;
|
|
1445
|
-
/**
|
|
1446
|
-
* Sends an encrypted command to the device.
|
|
1447
|
-
* @param {string} key - The command key.
|
|
1448
|
-
* @returns {Promise<Buffer>} - The response buffer.
|
|
1449
|
-
*/
|
|
1450
|
-
encryptedCommand(key: string): Promise<Buffer>;
|
|
1451
|
-
/**
|
|
1452
|
-
* Operates the lock with the given command.
|
|
1453
|
-
* @param {string} key - The command key.
|
|
1454
|
-
* @param {boolean} [encrypt] - Whether to encrypt the command.
|
|
1455
|
-
* @returns {Promise<Buffer>} - The response buffer.
|
|
1456
|
-
*/
|
|
1457
|
-
operateLockPro(key: string, encrypt?: boolean): Promise<Buffer>;
|
|
1458
|
-
}
|
|
1459
|
-
/**
|
|
1460
|
-
* Class representing a WoSmartLockUltra device.
|
|
1461
|
-
* Reuses the LockPro parsing and encrypted command behavior but reports a distinct model.
|
|
1462
|
-
*/
|
|
1463
|
-
export declare class WoSmartLockUltra extends WoSmartLockPro {
|
|
1464
|
-
constructor(peripheral: NobleTypes['peripheral'], noble: NobleTypes['noble']);
|
|
1465
|
-
static parseServiceData(serviceData: Buffer, manufacturerData: Buffer, emitLog: (level: string, message: string) => void): Promise<any>;
|
|
1466
|
-
}
|
|
1467
|
-
/**
|
|
1468
|
-
* Class representing a WoStrip device.
|
|
1469
|
-
* @see https://github.com/OpenWonderLabs/SwitchBotAPI-BLE/blob/latest/devicetypes/ledstriplight.md
|
|
1470
|
-
*/
|
|
1471
|
-
export declare class WoStrip extends SwitchbotDevice {
|
|
1472
|
-
/**
|
|
1473
|
-
* Parses the service data from the SwitchBot Strip Light.
|
|
1474
|
-
* @param {Buffer} serviceData - The service data buffer.
|
|
1475
|
-
* @param {Function} emitLog - The function to emit log messages.
|
|
1476
|
-
* @returns {Promise<stripLightServiceData | null>} - Parsed service data or null if invalid.
|
|
1477
|
-
*/
|
|
1478
|
-
static parseServiceData(serviceData: Buffer, emitLog: (level: string, message: string) => void): Promise<stripLightServiceData | null>;
|
|
1479
|
-
constructor(peripheral: NobleTypes['peripheral'], noble: NobleTypes['noble']);
|
|
1480
|
-
/**
|
|
1481
|
-
* Reads the state of the strip light.
|
|
1482
|
-
* @returns {Promise<boolean>} - Resolves with true if the strip light is ON, false otherwise.
|
|
1483
|
-
*/
|
|
1484
|
-
readState(): Promise<boolean>;
|
|
1485
|
-
/**
|
|
1486
|
-
* Sets the state of the strip light.
|
|
1487
|
-
* @public
|
|
1488
|
-
* @param {number[]} reqByteArray - The request byte array.
|
|
1489
|
-
* @returns {Promise<boolean>} - Resolves with true if the operation was successful.
|
|
1490
|
-
*/
|
|
1491
|
-
setState(reqByteArray: number[]): Promise<boolean>;
|
|
1492
|
-
/**
|
|
1493
|
-
* Turns the strip light on.
|
|
1494
|
-
* @returns {Promise<boolean>} - Resolves with true if the strip light is ON.
|
|
1495
|
-
*/
|
|
1496
|
-
turnOn(): Promise<boolean>;
|
|
1497
|
-
/**
|
|
1498
|
-
* Turns the strip light off.
|
|
1499
|
-
* @returns {Promise<boolean>} - Resolves with true if the strip light is OFF.
|
|
1500
|
-
*/
|
|
1501
|
-
turnOff(): Promise<boolean>;
|
|
1502
|
-
/**
|
|
1503
|
-
* Sets the brightness of the strip light.
|
|
1504
|
-
* @param {number} brightness - The brightness percentage (0-100).
|
|
1505
|
-
* @returns {Promise<boolean>} - Resolves with true if the operation was successful.
|
|
1506
|
-
*/
|
|
1507
|
-
setBrightness(brightness: number): Promise<boolean>;
|
|
1508
|
-
/**
|
|
1509
|
-
* Sets the RGB values of the strip light.
|
|
1510
|
-
* @param {number} brightness - The brightness percentage (0-100).
|
|
1511
|
-
* @param {number} red - The red value (0-255).
|
|
1512
|
-
* @param {number} green - The green value (0-255).
|
|
1513
|
-
* @param {number} blue - The blue value (0-255).
|
|
1514
|
-
* @returns {Promise<boolean>} - Resolves with true if the operation was successful.
|
|
1515
|
-
*/
|
|
1516
|
-
setRGB(brightness: number, red: number, green: number, blue: number): Promise<boolean>;
|
|
1517
|
-
/**
|
|
1518
|
-
* Operates the strip light with the given byte array.
|
|
1519
|
-
* @public
|
|
1520
|
-
* @param {number[]} bytes - The byte array to send.
|
|
1521
|
-
* @returns {Promise<boolean>} - Resolves with true if the operation was successful.
|
|
1522
|
-
*/
|
|
1523
|
-
operateStripLight(bytes: number[]): Promise<boolean>;
|
|
1524
|
-
}
|
|
1525
|
-
/**
|
|
1526
|
-
* Class representing a SwitchBot Air Purifier device.
|
|
1527
|
-
* @extends SwitchbotDevice
|
|
1528
|
-
*/
|
|
1529
|
-
export declare class WoAirPurifier extends SwitchbotDevice {
|
|
1530
|
-
/**
|
|
1531
|
-
* Parses service data for air purifier devices.
|
|
1532
|
-
* @param {Buffer | null} serviceData - The service data buffer.
|
|
1533
|
-
* @param {Buffer | null} manufacturerData - The manufacturer data buffer.
|
|
1534
|
-
* @param {Function} emitLog - The function to emit log messages.
|
|
1535
|
-
* @returns {airPurifierServiceData | null} - The parsed service data or null.
|
|
1536
|
-
*/
|
|
1537
|
-
static parseServiceData(serviceData: Buffer | null, manufacturerData: Buffer | null, emitLog?: (level: string, message: string) => void): airPurifierServiceData | null;
|
|
1538
|
-
/**
|
|
1539
|
-
* Sets the state of the air purifier.
|
|
1540
|
-
* @param {number[]} reqByteArray - The request byte array.
|
|
1541
|
-
* @returns {Promise<boolean>} - Resolves with a boolean indicating whether the operation was successful.
|
|
1542
|
-
* @private
|
|
1543
|
-
*/
|
|
1544
|
-
setState(reqByteArray: number[]): Promise<boolean>;
|
|
1545
|
-
/**
|
|
1546
|
-
* Turns the air purifier on.
|
|
1547
|
-
* @returns {Promise<boolean>} - Resolves with true if the air purifier is turned on.
|
|
1548
|
-
*/
|
|
1549
|
-
turnOn(): Promise<boolean>;
|
|
1550
|
-
/**
|
|
1551
|
-
* Turns the air purifier off.
|
|
1552
|
-
* @returns {Promise<boolean>} - Resolves with true if the air purifier is turned off.
|
|
1553
|
-
*/
|
|
1554
|
-
turnOff(): Promise<boolean>;
|
|
1555
|
-
/**
|
|
1556
|
-
* Sets the speed of the air purifier.
|
|
1557
|
-
* @param {number} speed - The speed value (0-100).
|
|
1558
|
-
* @returns {Promise<boolean>} - Resolves with true if the operation was successful.
|
|
1559
|
-
*/
|
|
1560
|
-
setSpeed(speed: number): Promise<boolean>;
|
|
1561
|
-
/**
|
|
1562
|
-
* Sets the mode of the air purifier.
|
|
1563
|
-
* @param {number} mode - The mode value (1-4).
|
|
1564
|
-
* @returns {Promise<boolean>} - Resolves with true if the operation was successful.
|
|
1565
|
-
*/
|
|
1566
|
-
setMode(mode: number): Promise<boolean>;
|
|
1567
|
-
/**
|
|
1568
|
-
* Operates the air purifier with the given byte array.
|
|
1569
|
-
* @public
|
|
1570
|
-
* @param {number[]} bytes - The byte array to send.
|
|
1571
|
-
* @returns {Promise<boolean>} - Resolves with true if the operation was successful.
|
|
1572
|
-
*/
|
|
1573
|
-
operateAirPurifier(bytes: number[]): Promise<boolean>;
|
|
1574
|
-
}
|
|
1575
|
-
/**
|
|
1576
|
-
* Class representing a SwitchBot Air Purifier Table device.
|
|
1577
|
-
* @extends SwitchbotDevice
|
|
1578
|
-
*/
|
|
1579
|
-
export declare class WoAirPurifierTable extends SwitchbotDevice {
|
|
1580
|
-
/**
|
|
1581
|
-
* Parses service data for air purifier table devices.
|
|
1582
|
-
* @param {Buffer | null} serviceData - The service data buffer.
|
|
1583
|
-
* @param {Buffer | null} manufacturerData - The manufacturer data buffer.
|
|
1584
|
-
* @param {Function} emitLog - The function to emit log messages.
|
|
1585
|
-
* @returns {airPurifierTableServiceData | null} - The parsed service data or null.
|
|
1586
|
-
*/
|
|
1587
|
-
static parseServiceData(serviceData: Buffer | null, manufacturerData: Buffer | null, emitLog?: (level: string, message: string) => void): airPurifierTableServiceData | null;
|
|
1588
|
-
/**
|
|
1589
|
-
* Sets the state of the air purifier table.
|
|
1590
|
-
* @param {number[]} reqByteArray - The request byte array.
|
|
1591
|
-
* @returns {Promise<boolean>} - Resolves with a boolean indicating whether the operation was successful.
|
|
1592
|
-
* @private
|
|
1593
|
-
*/
|
|
1594
|
-
setState(reqByteArray: number[]): Promise<boolean>;
|
|
1595
|
-
/**
|
|
1596
|
-
* Turns the air purifier table on.
|
|
1597
|
-
* @returns {Promise<boolean>} - Resolves with true if the air purifier table is turned on.
|
|
1598
|
-
*/
|
|
1599
|
-
turnOn(): Promise<boolean>;
|
|
1600
|
-
/**
|
|
1601
|
-
* Turns the air purifier table off.
|
|
1602
|
-
* @returns {Promise<boolean>} - Resolves with true if the air purifier table is turned off.
|
|
1603
|
-
*/
|
|
1604
|
-
turnOff(): Promise<boolean>;
|
|
1605
|
-
/**
|
|
1606
|
-
* Sets the speed of the air purifier table.
|
|
1607
|
-
* @param {number} speed - The speed value (0-100).
|
|
1608
|
-
* @returns {Promise<boolean>} - Resolves with true if the operation was successful.
|
|
1609
|
-
*/
|
|
1610
|
-
setSpeed(speed: number): Promise<boolean>;
|
|
1611
|
-
/**
|
|
1612
|
-
* Sets the mode of the air purifier table.
|
|
1613
|
-
* @param {number} mode - The mode value (1-4).
|
|
1614
|
-
* @returns {Promise<boolean>} - Resolves with true if the operation was successful.
|
|
1615
|
-
*/
|
|
1616
|
-
setMode(mode: number): Promise<boolean>;
|
|
1617
|
-
/**
|
|
1618
|
-
* Operates the air purifier table with the given byte array.
|
|
1619
|
-
* @public
|
|
1620
|
-
* @param {number[]} bytes - The byte array to send.
|
|
1621
|
-
* @returns {Promise<boolean>} - Resolves with true if the operation was successful.
|
|
1622
|
-
*/
|
|
1623
|
-
operateAirPurifierTable(bytes: number[]): Promise<boolean>;
|
|
1624
|
-
}
|
|
1625
|
-
export {};
|
|
1626
|
-
//# sourceMappingURL=device.d.ts.map
|