node-switchbot 3.6.0-beta.2 → 3.6.0-beta.3
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/dist/device.d.ts +50 -50
- package/dist/device.js +22 -22
- package/dist/switchbot-openapi.d.ts +3 -3
- package/dist/types/ble-guards.test.js +3 -3
- package/dist/types/ble.d.ts +30 -30
- package/dist/types/openapi.d.ts +50 -50
- package/docs/assets/hierarchy.js +1 -1
- package/docs/assets/navigation.js +1 -1
- package/docs/assets/search.js +1 -1
- package/docs/classes/Advertising.html +4 -4
- package/docs/classes/ErrorUtils.html +5 -5
- package/docs/classes/ParameterChecker.html +10 -10
- package/docs/classes/SwitchBotBLE.html +8 -8
- package/docs/classes/SwitchBotOpenAPI.html +9 -9
- package/docs/classes/SwitchbotDevice.html +12 -12
- package/docs/classes/ValidationUtils.html +8 -8
- package/docs/classes/WoBlindTilt.html +22 -22
- package/docs/classes/WoBulb.html +20 -20
- package/docs/classes/WoCeilingLight.html +24 -24
- package/docs/classes/WoContact.html +14 -14
- package/docs/classes/WoCurtain.html +19 -19
- package/docs/classes/WoHand.html +19 -19
- package/docs/classes/WoHub2.html +14 -14
- package/docs/classes/WoHumi.html +21 -21
- package/docs/classes/WoHumi2.html +21 -21
- package/docs/classes/WoIOSensorTH.html +14 -14
- package/docs/classes/WoKeypad.html +14 -14
- package/docs/classes/WoLeak.html +14 -14
- package/docs/classes/WoPlugMiniJP.html +19 -19
- package/docs/classes/WoPlugMiniUS.html +19 -19
- package/docs/classes/WoPresence.html +14 -14
- package/docs/classes/WoRelaySwitch1.html +16 -16
- package/docs/classes/WoRelaySwitch1PM.html +16 -16
- package/docs/classes/WoRemote.html +14 -14
- package/docs/classes/WoSensorTH.html +12 -12
- package/docs/classes/WoSensorTHPlus.html +12 -12
- package/docs/classes/WoSensorTHPro.html +12 -12
- package/docs/classes/WoSensorTHProCO2.html +12 -12
- package/docs/classes/WoSmartLock.html +24 -24
- package/docs/classes/WoSmartLockPro.html +24 -24
- package/docs/classes/WoStrip.html +21 -21
- package/docs/enums/LogLevel.html +2 -2
- package/docs/enums/SwitchBotBLEModel.html +2 -2
- package/docs/enums/SwitchBotBLEModelFriendlyName.html +2 -2
- package/docs/enums/SwitchBotBLEModelName.html +2 -2
- package/docs/enums/SwitchBotModel.html +2 -2
- package/docs/functions/updateBaseURL.html +1 -1
- package/docs/hierarchy.html +1 -1
- package/docs/interfaces/AdvertisementData.html +2 -2
- package/docs/interfaces/Chars.html +2 -2
- package/docs/interfaces/ColorLightServiceDataBase.html +2 -2
- package/docs/interfaces/ErrorObject.html +2 -2
- package/docs/interfaces/LockBaseServiceData.html +2 -2
- package/docs/interfaces/NobleTypes.html +2 -2
- package/docs/interfaces/Params.html +2 -2
- package/docs/interfaces/PlugMiniServiceDataBase.html +2 -2
- package/docs/interfaces/PushResponse.html +2 -2
- package/docs/interfaces/Rule.html +2 -2
- package/docs/interfaces/ServiceData.html +2 -2
- package/docs/interfaces/SwitchBotBLEDevice.html +2 -2
- package/docs/interfaces/SwitchBotScanner.html +3 -3
- package/docs/interfaces/TemperatureServiceDataBase.html +2 -2
- package/docs/interfaces/WebhookDetail.html +2 -2
- package/docs/interfaces/ad.html +2 -2
- package/docs/interfaces/body.html +2 -2
- package/docs/interfaces/deleteWebhookResponse.html +2 -2
- package/docs/interfaces/{Device.html → device.html} +2 -2
- package/docs/interfaces/{DeviceList.html → deviceList.html} +2 -2
- package/docs/interfaces/deviceStatus.html +2 -2
- package/docs/interfaces/deviceStatusRequest.html +2 -2
- package/docs/interfaces/deviceWebhook.html +2 -2
- package/docs/interfaces/deviceWebhookContext.html +2 -2
- package/docs/interfaces/devices.html +2 -2
- package/docs/interfaces/infraredRemoteList.html +2 -2
- package/docs/interfaces/irdevice.html +2 -2
- package/docs/interfaces/{PushRequest.html → pushRequest.html} +3 -3
- package/docs/interfaces/{PushResponseBody.html → pushResponseBody.html} +3 -3
- package/docs/interfaces/queryWebhookResponse.html +2 -2
- package/docs/interfaces/setupWebhookResponse.html +2 -2
- package/docs/interfaces/updateWebhookResponse.html +2 -2
- package/docs/interfaces/webhookRequest.html +2 -2
- package/docs/modules.html +1 -1
- package/docs/types/BLEDeviceServiceData.html +1 -1
- package/docs/types/IndoorCam.html +1 -1
- package/docs/types/MacAddress.html +1 -1
- package/docs/types/{BatteryCirculatorFan.html → batteryCirculatorFan.html} +1 -1
- package/docs/types/{BatteryCirculatorFanServiceData.html → batteryCirculatorFanServiceData.html} +1 -1
- package/docs/types/{BatteryCirculatorFanStatus.html → batteryCirculatorFanStatus.html} +1 -1
- package/docs/types/batteryCirculatorFanWebhookContext.html +1 -1
- package/docs/types/{BlindTilt.html → blindTilt.html} +1 -1
- package/docs/types/{BlindTiltServiceData.html → blindTiltServiceData.html} +1 -1
- package/docs/types/{BlindTiltStatus.html → blindTiltStatus.html} +1 -1
- package/docs/types/blindTiltWebhookContext.html +1 -1
- package/docs/types/{Bot.html → bot.html} +1 -1
- package/docs/types/{BotServiceData.html → botServiceData.html} +1 -1
- package/docs/types/botStatus.html +1 -1
- package/docs/types/botWebhookContext.html +1 -1
- package/docs/types/{CeilingLight.html → ceilingLight.html} +1 -1
- package/docs/types/{CeilingLightPro.html → ceilingLightPro.html} +1 -1
- package/docs/types/{CeilingLightProServiceData.html → ceilingLightProServiceData.html} +1 -1
- package/docs/types/ceilingLightProStatus.html +1 -1
- package/docs/types/ceilingLightProWebhookContext.html +1 -1
- package/docs/types/{CeilingLightServiceData.html → ceilingLightServiceData.html} +1 -1
- package/docs/types/ceilingLightStatus.html +1 -1
- package/docs/types/ceilingLightWebhookContext.html +1 -1
- package/docs/types/{CirculatorFanStatus.html → circulatorFanStatus.html} +1 -1
- package/docs/types/circulatorFanWebhookContext.html +1 -1
- package/docs/types/{ColorBulb.html → colorBulb.html} +1 -1
- package/docs/types/{ColorBulbServiceData.html → colorBulbServiceData.html} +1 -1
- package/docs/types/colorBulbStatus.html +1 -1
- package/docs/types/colorBulbWebhookContext.html +1 -1
- package/docs/types/{CommandType.html → commandType.html} +2 -2
- package/docs/types/{ContactSensor.html → contactSensor.html} +1 -1
- package/docs/types/{ContactSensorServiceData.html → contactSensorServiceData.html} +1 -1
- package/docs/types/contactSensorStatus.html +1 -1
- package/docs/types/contactSensorWebhookContext.html +1 -1
- package/docs/types/{Curtain.html → curtain.html} +1 -1
- package/docs/types/{Curtain3.html → curtain3.html} +1 -1
- package/docs/types/{Curtain3ServiceData.html → curtain3ServiceData.html} +1 -1
- package/docs/types/curtain3WebhookContext.html +1 -1
- package/docs/types/{CurtainServiceData.html → curtainServiceData.html} +1 -1
- package/docs/types/curtainStatus.html +1 -1
- package/docs/types/curtainWebhookContext.html +1 -1
- package/docs/types/{FloorCleaningRobotS10.html → floorCleaningRobotS10.html} +1 -1
- package/docs/types/floorCleaningRobotS10Status.html +1 -1
- package/docs/types/floorCleaningRobotS10WebhookContext.html +1 -1
- package/docs/types/{Hub2.html → hub2.html} +1 -1
- package/docs/types/{Hub2ServiceData.html → hub2ServiceData.html} +1 -1
- package/docs/types/{Hub2Status.html → hub2Status.html} +1 -1
- package/docs/types/hub2WebhookContext.html +1 -1
- package/docs/types/{Humidifier.html → humidifier.html} +1 -1
- package/docs/types/{Humidifier2ServiceData.html → humidifier2ServiceData.html} +1 -1
- package/docs/types/{Humidifier2Status.html → humidifier2Status.html} +1 -1
- package/docs/types/humidifier2WebhookContext.html +1 -1
- package/docs/types/{HumidifierServiceData.html → humidifierServiceData.html} +1 -1
- package/docs/types/{HumidifierStatus.html → humidifierStatus.html} +1 -1
- package/docs/types/humidifierWebhookContext.html +1 -1
- package/docs/types/indoorCameraWebhookContext.html +1 -1
- package/docs/types/{Keypad.html → keypad.html} +1 -1
- package/docs/types/{KeypadDetectorServiceData.html → keypadDetectorServiceData.html} +1 -1
- package/docs/types/{KeypadTouch.html → keypadTouch.html} +1 -1
- package/docs/types/keypadTouchWebhookContext.html +1 -1
- package/docs/types/keypadWebhookContext.html +1 -1
- package/docs/types/{Lock.html → lock.html} +1 -1
- package/docs/types/{LockPro.html → lockPro.html} +1 -1
- package/docs/types/{LockProServiceData.html → lockProServiceData.html} +1 -1
- package/docs/types/lockProStatus.html +1 -1
- package/docs/types/lockProWebhookContext.html +1 -1
- package/docs/types/{LockServiceData.html → lockServiceData.html} +1 -1
- package/docs/types/lockStatus.html +1 -1
- package/docs/types/lockWebhookContext.html +1 -1
- package/docs/types/{Meter.html → meter.html} +1 -1
- package/docs/types/{MeterPlus.html → meterPlus.html} +1 -1
- package/docs/types/{MeterPlusServiceData.html → meterPlusServiceData.html} +1 -1
- package/docs/types/meterPlusStatus.html +1 -1
- package/docs/types/meterPlusWebhookContext.html +1 -1
- package/docs/types/{MeterPro.html → meterPro.html} +1 -1
- package/docs/types/{MeterProCO2ServiceData.html → meterProCO2ServiceData.html} +1 -1
- package/docs/types/meterProCO2Status.html +1 -1
- package/docs/types/meterProCO2WebhookContext.html +1 -1
- package/docs/types/{MeterProServiceData.html → meterProServiceData.html} +1 -1
- package/docs/types/meterProStatus.html +1 -1
- package/docs/types/meterProWebhookContext.html +1 -1
- package/docs/types/{MeterServiceData.html → meterServiceData.html} +1 -1
- package/docs/types/meterStatus.html +1 -1
- package/docs/types/meterWebhookContext.html +1 -1
- package/docs/types/{MotionSensor.html → motionSensor.html} +1 -1
- package/docs/types/{MotionSensorServiceData.html → motionSensorServiceData.html} +1 -1
- package/docs/types/motionSensorStatus.html +1 -1
- package/docs/types/motionSensorWebhookContext.html +1 -1
- package/docs/types/onadvertisement.html +1 -1
- package/docs/types/ondiscover.html +1 -1
- package/docs/types/{OutdoorMeter.html → outdoorMeter.html} +1 -1
- package/docs/types/{OutdoorMeterServiceData.html → outdoorMeterServiceData.html} +1 -1
- package/docs/types/outdoorMeterStatus.html +1 -1
- package/docs/types/outdoorMeterWebhookContext.html +1 -1
- package/docs/types/panTiltCamWebhookContext.html +1 -1
- package/docs/types/{PantiltCam.html → pantiltCam.html} +1 -1
- package/docs/types/{PantiltCam2k.html → pantiltCam2k.html} +1 -1
- package/docs/types/{Plug.html → plug.html} +1 -1
- package/docs/types/{PlugMini.html → plugMini.html} +1 -1
- package/docs/types/{PlugMiniJPServiceData.html → plugMiniJPServiceData.html} +1 -1
- package/docs/types/plugMiniJPWebhookContext.html +1 -1
- package/docs/types/plugMiniStatus.html +1 -1
- package/docs/types/{PlugMiniUSServiceData.html → plugMiniUSServiceData.html} +1 -1
- package/docs/types/plugMiniUSWebhookContext.html +1 -1
- package/docs/types/plugStatus.html +1 -1
- package/docs/types/plugWebhookContext.html +1 -1
- package/docs/types/relaySwitch1Context.html +1 -1
- package/docs/types/relaySwitch1PMContext.html +1 -1
- package/docs/types/{RelaySwitch1PMServiceData.html → relaySwitch1PMServiceData.html} +1 -1
- package/docs/types/relaySwitch1PMStatus.html +1 -1
- package/docs/types/{RelaySwitch1ServiceData.html → relaySwitch1ServiceData.html} +1 -1
- package/docs/types/relaySwitch1Status.html +1 -1
- package/docs/types/{Remote.html → remote.html} +1 -1
- package/docs/types/{RemoteServiceData.html → remoteServiceData.html} +1 -1
- package/docs/types/{RobotVacuumCleanerS1.html → robotVacuumCleanerS1.html} +1 -1
- package/docs/types/{RobotVacuumCleanerS1Plus.html → robotVacuumCleanerS1Plus.html} +1 -1
- package/docs/types/robotVacuumCleanerS1PlusStatus.html +1 -1
- package/docs/types/robotVacuumCleanerS1PlusWebhookContext.html +1 -1
- package/docs/types/robotVacuumCleanerS1Status.html +1 -1
- package/docs/types/robotVacuumCleanerS1WebhookContext.html +1 -1
- package/docs/types/{RobotVacuumCleanerServiceData.html → robotVacuumCleanerServiceData.html} +1 -1
- package/docs/types/{StripLight.html → stripLight.html} +1 -1
- package/docs/types/{StripLightServiceData.html → stripLightServiceData.html} +1 -1
- package/docs/types/stripLightStatus.html +1 -1
- package/docs/types/stripLightWebhookContext.html +1 -1
- package/docs/types/{WaterLeakDetector.html → waterLeakDetector.html} +1 -1
- package/docs/types/{WaterLeakDetectorServiceData.html → waterLeakDetectorServiceData.html} +1 -1
- package/docs/types/waterLeakDetectorStatus.html +1 -1
- package/docs/types/waterLeakDetectorWebhookContext.html +1 -1
- package/docs/variables/parameterChecker.html +1 -1
- package/docs/variables/urls.html +1 -1
- package/package.json +1 -1
package/dist/device.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type Noble from '@stoprocent/noble';
|
|
2
2
|
import type { Characteristic, Peripheral } from '@stoprocent/noble';
|
|
3
|
-
import type {
|
|
3
|
+
import type { batteryCirculatorFanServiceData, blindTiltServiceData, botServiceData, ceilingLightProServiceData, ceilingLightServiceData, colorBulbServiceData, contactSensorServiceData, curtain3ServiceData, curtainServiceData, hub2ServiceData, humidifier2ServiceData, humidifierServiceData, keypadDetectorServiceData, lockProServiceData, lockServiceData, meterPlusServiceData, meterProCO2ServiceData, meterProServiceData, meterServiceData, motionSensorServiceData, outdoorMeterServiceData, plugMiniJPServiceData, plugMiniUSServiceData, relaySwitch1PMServiceData, relaySwitch1ServiceData, remoteServiceData, robotVacuumCleanerServiceData, stripLightServiceData, waterLeakDetectorServiceData } from './types/ble.js';
|
|
4
4
|
import { Buffer } from 'node:buffer';
|
|
5
5
|
import { EventEmitter } from 'node:events';
|
|
6
6
|
export type MacAddress = string;
|
|
@@ -8,7 +8,7 @@ export interface ad {
|
|
|
8
8
|
id: string;
|
|
9
9
|
address: string;
|
|
10
10
|
rssi: number;
|
|
11
|
-
serviceData:
|
|
11
|
+
serviceData: botServiceData | colorBulbServiceData | contactSensorServiceData | curtainServiceData | curtain3ServiceData | stripLightServiceData | ServiceData | lockProServiceData | ServiceData | meterPlusServiceData | meterProServiceData | meterProCO2ServiceData | motionSensorServiceData | outdoorMeterServiceData | plugMiniUSServiceData | plugMiniJPServiceData | blindTiltServiceData | ceilingLightServiceData | ceilingLightProServiceData | hub2ServiceData | batteryCirculatorFanServiceData | waterLeakDetectorServiceData | humidifierServiceData | humidifier2ServiceData | robotVacuumCleanerServiceData | keypadDetectorServiceData | relaySwitch1PMServiceData | relaySwitch1ServiceData | remoteServiceData;
|
|
12
12
|
[key: string]: unknown;
|
|
13
13
|
}
|
|
14
14
|
export type ondiscover = (device: SwitchbotDevice) => Promise<void> | void;
|
|
@@ -512,9 +512,9 @@ export declare class WoBlindTilt extends SwitchbotDevice {
|
|
|
512
512
|
* @param {Buffer} manufacturerData - The manufacturer data buffer.
|
|
513
513
|
* @param {Function} emitLog - The function to emit log messages.
|
|
514
514
|
* @param {boolean} [reverse] - Whether to reverse the tilt percentage.
|
|
515
|
-
* @returns {Promise<
|
|
515
|
+
* @returns {Promise<blindTiltServiceData | null>} - The parsed data object or null if the data is invalid.
|
|
516
516
|
*/
|
|
517
|
-
static parseServiceData(serviceData: Buffer, manufacturerData: Buffer, emitLog: (level: string, message: string) => void, reverse?: boolean): Promise<
|
|
517
|
+
static parseServiceData(serviceData: Buffer, manufacturerData: Buffer, emitLog: (level: string, message: string) => void, reverse?: boolean): Promise<blindTiltServiceData | null>;
|
|
518
518
|
constructor(peripheral: NobleTypes['peripheral'], noble: NobleTypes['noble']);
|
|
519
519
|
/**
|
|
520
520
|
* Opens the blind tilt to the fully open position.
|
|
@@ -583,9 +583,9 @@ export declare class WoBulb extends SwitchbotDevice {
|
|
|
583
583
|
* @param {Buffer} serviceData - The service data buffer.
|
|
584
584
|
* @param {Buffer} manufacturerData - The manufacturer data buffer.
|
|
585
585
|
* @param {Function} emitLog - The function to emit log messages.
|
|
586
|
-
* @returns {Promise<
|
|
586
|
+
* @returns {Promise<colorBulbServiceData | null>} - Parsed service data or null if invalid.
|
|
587
587
|
*/
|
|
588
|
-
static parseServiceData(serviceData: Buffer, manufacturerData: Buffer, emitLog: (level: string, message: string) => void): Promise<
|
|
588
|
+
static parseServiceData(serviceData: Buffer, manufacturerData: Buffer, emitLog: (level: string, message: string) => void): Promise<colorBulbServiceData | null>;
|
|
589
589
|
constructor(peripheral: NobleTypes['peripheral'], noble: NobleTypes['noble']);
|
|
590
590
|
/**
|
|
591
591
|
* Reads the state of the bulb.
|
|
@@ -647,16 +647,16 @@ export declare class WoCeilingLight extends SwitchbotDevice {
|
|
|
647
647
|
* Parses the service data for WoCeilingLight.
|
|
648
648
|
* @param {Buffer} manufacturerData - The manufacturer data buffer.
|
|
649
649
|
* @param {Function} emitLog - The function to emit log messages.
|
|
650
|
-
* @returns {Promise<
|
|
650
|
+
* @returns {Promise<ceilingLightServiceData | null>} - Parsed service data or null if invalid.
|
|
651
651
|
*/
|
|
652
|
-
static parseServiceData(manufacturerData: Buffer, emitLog: (level: string, message: string) => void): Promise<
|
|
652
|
+
static parseServiceData(manufacturerData: Buffer, emitLog: (level: string, message: string) => void): Promise<ceilingLightServiceData | null>;
|
|
653
653
|
/**
|
|
654
654
|
* Parses the service data for WoCeilingLight Pro.
|
|
655
655
|
* @param {Buffer} manufacturerData - The manufacturer data buffer.
|
|
656
656
|
* @param {Function} emitLog - The function to emit log messages.
|
|
657
|
-
* @returns {Promise<
|
|
657
|
+
* @returns {Promise<ceilingLightProServiceData | null>} - Parsed service data or null if invalid.
|
|
658
658
|
*/
|
|
659
|
-
static parseServiceData_Pro(manufacturerData: Buffer, emitLog: (level: string, message: string) => void): Promise<
|
|
659
|
+
static parseServiceData_Pro(manufacturerData: Buffer, emitLog: (level: string, message: string) => void): Promise<ceilingLightProServiceData | null>;
|
|
660
660
|
constructor(peripheral: NobleTypes['peripheral'], noble: NobleTypes['noble']);
|
|
661
661
|
/**
|
|
662
662
|
* Reads the state of the ceiling light.
|
|
@@ -716,9 +716,9 @@ export declare class WoContact extends SwitchbotDevice {
|
|
|
716
716
|
* Parses the service data for WoContact.
|
|
717
717
|
* @param {Buffer} serviceData - The service data buffer.
|
|
718
718
|
* @param {Function} emitLog - The function to emit log messages.
|
|
719
|
-
* @returns {Promise<
|
|
719
|
+
* @returns {Promise<contactSensorServiceData | null>} - Parsed service data or null if invalid.
|
|
720
720
|
*/
|
|
721
|
-
static parseServiceData(serviceData: Buffer, emitLog: (level: string, message: string) => void): Promise<
|
|
721
|
+
static parseServiceData(serviceData: Buffer, emitLog: (level: string, message: string) => void): Promise<contactSensorServiceData | null>;
|
|
722
722
|
constructor(peripheral: NobleTypes['peripheral'], noble: NobleTypes['noble']);
|
|
723
723
|
}
|
|
724
724
|
/**
|
|
@@ -733,9 +733,9 @@ export declare class WoCurtain extends SwitchbotDevice {
|
|
|
733
733
|
* @param {Buffer} manufacturerData - The manufacturer data buffer.
|
|
734
734
|
* @param {Function} emitLog - The function to emit log messages.
|
|
735
735
|
* @param {boolean} [reverse] - Whether to reverse the position.
|
|
736
|
-
* @returns {Promise<
|
|
736
|
+
* @returns {Promise<curtainServiceData | curtain3ServiceData | null>} - Parsed service data or null if invalid.
|
|
737
737
|
*/
|
|
738
|
-
static parseServiceData(serviceData: Buffer, manufacturerData: Buffer, emitLog: (level: string, message: string) => void, reverse?: boolean): Promise<
|
|
738
|
+
static parseServiceData(serviceData: Buffer, manufacturerData: Buffer, emitLog: (level: string, message: string) => void, reverse?: boolean): Promise<curtainServiceData | curtain3ServiceData | null>;
|
|
739
739
|
constructor(peripheral: NobleTypes['peripheral'], noble: NobleTypes['noble']);
|
|
740
740
|
/**
|
|
741
741
|
* Opens the curtain.
|
|
@@ -777,9 +777,9 @@ export declare class WoHand extends SwitchbotDevice {
|
|
|
777
777
|
* Parses the service data for WoHand.
|
|
778
778
|
* @param {Buffer} serviceData - The service data buffer.
|
|
779
779
|
* @param {Function} emitLog - The function to emit log messages.
|
|
780
|
-
* @returns {Promise<
|
|
780
|
+
* @returns {Promise<botServiceData | null>} - Parsed service data or null if invalid.
|
|
781
781
|
*/
|
|
782
|
-
static parseServiceData(serviceData: Buffer, emitLog: (level: string, message: string) => void): Promise<
|
|
782
|
+
static parseServiceData(serviceData: Buffer, emitLog: (level: string, message: string) => void): Promise<botServiceData | null>;
|
|
783
783
|
constructor(peripheral: NobleTypes['peripheral'], noble: NobleTypes['noble']);
|
|
784
784
|
/**
|
|
785
785
|
* Sends a command to the bot.
|
|
@@ -822,9 +822,9 @@ export declare class WoHub2 extends SwitchbotDevice {
|
|
|
822
822
|
* Parses the service data for WoHub2.
|
|
823
823
|
* @param {Buffer} manufacturerData - The manufacturer data buffer.
|
|
824
824
|
* @param {Function} emitLog - The function to emit log messages.
|
|
825
|
-
* @returns {Promise<
|
|
825
|
+
* @returns {Promise<hub2ServiceData | null>} - Parsed service data or null if invalid.
|
|
826
826
|
*/
|
|
827
|
-
static parseServiceData(manufacturerData: Buffer, emitLog: (level: string, message: string) => void): Promise<
|
|
827
|
+
static parseServiceData(manufacturerData: Buffer, emitLog: (level: string, message: string) => void): Promise<hub2ServiceData | null>;
|
|
828
828
|
constructor(peripheral: NobleTypes['peripheral'], noble: NobleTypes['noble']);
|
|
829
829
|
}
|
|
830
830
|
/**
|
|
@@ -837,9 +837,9 @@ export declare class WoHumi extends SwitchbotDevice {
|
|
|
837
837
|
* Parses the service data for WoHumi.
|
|
838
838
|
* @param {Buffer} serviceData - The service data buffer.
|
|
839
839
|
* @param {Function} emitLog - The function to emit log messages.
|
|
840
|
-
* @returns {Promise<
|
|
840
|
+
* @returns {Promise<humidifierServiceData | null>} - Parsed service data or null if invalid.
|
|
841
841
|
*/
|
|
842
|
-
static parseServiceData(serviceData: Buffer, emitLog: (level: string, message: string) => void): Promise<
|
|
842
|
+
static parseServiceData(serviceData: Buffer, emitLog: (level: string, message: string) => void): Promise<humidifierServiceData | null>;
|
|
843
843
|
/**
|
|
844
844
|
* Sends a command to the humidifier.
|
|
845
845
|
* @param {Buffer} reqBuf - The command buffer.
|
|
@@ -893,9 +893,9 @@ export declare class WoHumi2 extends SwitchbotDevice {
|
|
|
893
893
|
* Parses the service data for WoHumi.
|
|
894
894
|
* @param {Buffer} serviceData - The service data buffer.
|
|
895
895
|
* @param {Function} emitLog - The function to emit log messages.
|
|
896
|
-
* @returns {Promise<
|
|
896
|
+
* @returns {Promise<humidifier2ServiceData | null>} - Parsed service data or null if invalid.
|
|
897
897
|
*/
|
|
898
|
-
static parseServiceData(serviceData: Buffer, emitLog: (level: string, message: string) => void): Promise<
|
|
898
|
+
static parseServiceData(serviceData: Buffer, emitLog: (level: string, message: string) => void): Promise<humidifier2ServiceData | null>;
|
|
899
899
|
/**
|
|
900
900
|
* Sends a command to the humidifier.
|
|
901
901
|
* @param {Buffer} reqBuf - The command buffer.
|
|
@@ -949,9 +949,9 @@ export declare class WoIOSensorTH extends SwitchbotDevice {
|
|
|
949
949
|
* @param {Buffer} serviceData - The service data buffer.
|
|
950
950
|
* @param {Buffer} manufacturerData - The manufacturer data buffer.
|
|
951
951
|
* @param {Function} emitLog - The function to emit log messages.
|
|
952
|
-
* @returns {Promise<
|
|
952
|
+
* @returns {Promise<outdoorMeterServiceData | null>} - Parsed service data or null if invalid.
|
|
953
953
|
*/
|
|
954
|
-
static parseServiceData(serviceData: Buffer, manufacturerData: Buffer, emitLog: (level: string, message: string) => void): Promise<
|
|
954
|
+
static parseServiceData(serviceData: Buffer, manufacturerData: Buffer, emitLog: (level: string, message: string) => void): Promise<outdoorMeterServiceData | null>;
|
|
955
955
|
constructor(peripheral: NobleTypes['peripheral'], noble: NobleTypes['noble']);
|
|
956
956
|
}
|
|
957
957
|
/**
|
|
@@ -963,9 +963,9 @@ export declare class WoKeypad extends SwitchbotDevice {
|
|
|
963
963
|
* @param {Buffer} serviceData - The service data buffer.
|
|
964
964
|
* @param {Buffer} manufacturerData - The manufacturer data buffer.
|
|
965
965
|
* @param {Function} emitLog - The function to emit log messages.
|
|
966
|
-
* @returns {Promise<
|
|
966
|
+
* @returns {Promise<keypadDetectorServiceData | null>} - Parsed service data or null if invalid.
|
|
967
967
|
*/
|
|
968
|
-
static parseServiceData(serviceData: Buffer, manufacturerData: Buffer, emitLog: (level: string, message: string) => void): Promise<
|
|
968
|
+
static parseServiceData(serviceData: Buffer, manufacturerData: Buffer, emitLog: (level: string, message: string) => void): Promise<keypadDetectorServiceData | null>;
|
|
969
969
|
constructor(peripheral: NobleTypes['peripheral'], noble: NobleTypes['noble']);
|
|
970
970
|
}
|
|
971
971
|
/**
|
|
@@ -978,9 +978,9 @@ export declare class WoLeak extends SwitchbotDevice {
|
|
|
978
978
|
* @param {Buffer} serviceData - The service data buffer.
|
|
979
979
|
* @param {Buffer} manufacturerData - The manufacturer data buffer.
|
|
980
980
|
* @param {Function} emitLog - The function to emit log messages.
|
|
981
|
-
* @returns {Promise<
|
|
981
|
+
* @returns {Promise<waterLeakDetectorServiceData | null>} - Parsed service data or null if invalid.
|
|
982
982
|
*/
|
|
983
|
-
static parseServiceData(serviceData: Buffer, manufacturerData: Buffer, emitLog: (level: string, message: string) => void): Promise<
|
|
983
|
+
static parseServiceData(serviceData: Buffer, manufacturerData: Buffer, emitLog: (level: string, message: string) => void): Promise<waterLeakDetectorServiceData | null>;
|
|
984
984
|
constructor(peripheral: NobleTypes['peripheral'], noble: NobleTypes['noble']);
|
|
985
985
|
}
|
|
986
986
|
/**
|
|
@@ -993,9 +993,9 @@ export declare class WoPlugMiniJP extends SwitchbotDevice {
|
|
|
993
993
|
* Parses the service data for WoPlugMini JP.
|
|
994
994
|
* @param {Buffer} manufacturerData - The manufacturer data buffer.
|
|
995
995
|
* @param {Function} emitLog - The function to emit log messages.
|
|
996
|
-
* @returns {Promise<
|
|
996
|
+
* @returns {Promise<plugMiniJPServiceData | null>} - Parsed service data or null if invalid.
|
|
997
997
|
*/
|
|
998
|
-
static parseServiceData(manufacturerData: Buffer, emitLog: (level: string, message: string) => void): Promise<
|
|
998
|
+
static parseServiceData(manufacturerData: Buffer, emitLog: (level: string, message: string) => void): Promise<plugMiniJPServiceData | null>;
|
|
999
999
|
/**
|
|
1000
1000
|
* Reads the state of the plug.
|
|
1001
1001
|
* @returns {Promise<boolean>} - Resolves with a boolean that tells whether the plug is ON (true) or OFF (false).
|
|
@@ -1040,9 +1040,9 @@ export declare class WoPlugMiniUS extends SwitchbotDevice {
|
|
|
1040
1040
|
* Parses the service data for WoPlugMini US.
|
|
1041
1041
|
* @param {Buffer} manufacturerData - The manufacturer data buffer.
|
|
1042
1042
|
* @param {Function} emitLog - The function to emit log messages.
|
|
1043
|
-
* @returns {Promise<
|
|
1043
|
+
* @returns {Promise<plugMiniUSServiceData | null>} - Parsed service data or null if invalid.
|
|
1044
1044
|
*/
|
|
1045
|
-
static parseServiceData(manufacturerData: Buffer, emitLog: (level: string, message: string) => void): Promise<
|
|
1045
|
+
static parseServiceData(manufacturerData: Buffer, emitLog: (level: string, message: string) => void): Promise<plugMiniUSServiceData | null>;
|
|
1046
1046
|
/**
|
|
1047
1047
|
* Reads the state of the plug.
|
|
1048
1048
|
* @returns {Promise<boolean>} - Resolves with a boolean that tells whether the plug is ON (true) or OFF (false).
|
|
@@ -1086,9 +1086,9 @@ export declare class WoPresence extends SwitchbotDevice {
|
|
|
1086
1086
|
* Parses the service data for WoPresence.
|
|
1087
1087
|
* @param {Buffer} serviceData - The service data buffer.
|
|
1088
1088
|
* @param {Function} emitLog - The function to emit log messages.
|
|
1089
|
-
* @returns {Promise<
|
|
1089
|
+
* @returns {Promise<motionSensorServiceData | null>} - Parsed service data or null if invalid.
|
|
1090
1090
|
*/
|
|
1091
|
-
static parseServiceData(serviceData: Buffer, emitLog: (level: string, message: string) => void): Promise<
|
|
1091
|
+
static parseServiceData(serviceData: Buffer, emitLog: (level: string, message: string) => void): Promise<motionSensorServiceData | null>;
|
|
1092
1092
|
constructor(peripheral: NobleTypes['peripheral'], noble: NobleTypes['noble']);
|
|
1093
1093
|
}
|
|
1094
1094
|
/**
|
|
@@ -1102,9 +1102,9 @@ export declare class WoRelaySwitch1 extends SwitchbotDevice {
|
|
|
1102
1102
|
* @param {Buffer} serviceData - The service data buffer.
|
|
1103
1103
|
* @param {Buffer} manufacturerData - The manufacturer data buffer.
|
|
1104
1104
|
* @param {Function} emitLog - The function to emit log messages.
|
|
1105
|
-
* @returns {Promise<
|
|
1105
|
+
* @returns {Promise<relaySwitch1ServiceData | null>} - Parsed service data or null if invalid.
|
|
1106
1106
|
*/
|
|
1107
|
-
static parseServiceData(serviceData: Buffer, manufacturerData: Buffer, emitLog: (level: string, message: string) => void): Promise<
|
|
1107
|
+
static parseServiceData(serviceData: Buffer, manufacturerData: Buffer, emitLog: (level: string, message: string) => void): Promise<relaySwitch1ServiceData | null>;
|
|
1108
1108
|
/**
|
|
1109
1109
|
* Sends a command to the bot.
|
|
1110
1110
|
* @param {Buffer} reqBuf - The command buffer.
|
|
@@ -1133,9 +1133,9 @@ export declare class WoRelaySwitch1PM extends SwitchbotDevice {
|
|
|
1133
1133
|
* @param {Buffer} serviceData - The service data buffer.
|
|
1134
1134
|
* @param {Buffer} manufacturerData - The manufacturer data buffer.
|
|
1135
1135
|
* @param {Function} emitLog - The function to emit log messages.
|
|
1136
|
-
* @returns {Promise<
|
|
1136
|
+
* @returns {Promise<relaySwitch1PMServiceData | null>} - Parsed service data or null if invalid.
|
|
1137
1137
|
*/
|
|
1138
|
-
static parseServiceData(serviceData: Buffer, manufacturerData: Buffer, emitLog: (level: string, message: string) => void): Promise<
|
|
1138
|
+
static parseServiceData(serviceData: Buffer, manufacturerData: Buffer, emitLog: (level: string, message: string) => void): Promise<relaySwitch1PMServiceData | null>;
|
|
1139
1139
|
/**
|
|
1140
1140
|
* Sends a command to the bot.
|
|
1141
1141
|
* @param {Buffer} reqBuf - The command buffer.
|
|
@@ -1162,9 +1162,9 @@ export declare class WoRemote extends SwitchbotDevice {
|
|
|
1162
1162
|
* Parses the service data for WoRemote.
|
|
1163
1163
|
* @param {Buffer} serviceData - The service data buffer.
|
|
1164
1164
|
* @param {Function} emitLog - The function to emit log messages.
|
|
1165
|
-
* @returns {Promise<
|
|
1165
|
+
* @returns {Promise<remoteServiceData | null>} - Parsed service data or null if invalid.
|
|
1166
1166
|
*/
|
|
1167
|
-
static parseServiceData(serviceData: Buffer, emitLog: (level: string, message: string) => void): Promise<
|
|
1167
|
+
static parseServiceData(serviceData: Buffer, emitLog: (level: string, message: string) => void): Promise<remoteServiceData | null>;
|
|
1168
1168
|
constructor(peripheral: NobleTypes['peripheral'], noble: NobleTypes['noble']);
|
|
1169
1169
|
}
|
|
1170
1170
|
/**
|
|
@@ -1173,7 +1173,7 @@ export declare class WoRemote extends SwitchbotDevice {
|
|
|
1173
1173
|
*/
|
|
1174
1174
|
export declare class WoSensorTH extends SwitchbotDevice {
|
|
1175
1175
|
constructor(peripheral: NobleTypes['peripheral'], noble: NobleTypes['noble']);
|
|
1176
|
-
static parseServiceData(serviceData: Buffer, emitLog: (level: string, message: string) => void): Promise<
|
|
1176
|
+
static parseServiceData(serviceData: Buffer, emitLog: (level: string, message: string) => void): Promise<meterServiceData | null>;
|
|
1177
1177
|
}
|
|
1178
1178
|
/**
|
|
1179
1179
|
* Class representing a WoSensorTH device.
|
|
@@ -1181,7 +1181,7 @@ export declare class WoSensorTH extends SwitchbotDevice {
|
|
|
1181
1181
|
*/
|
|
1182
1182
|
export declare class WoSensorTHPlus extends SwitchbotDevice {
|
|
1183
1183
|
constructor(peripheral: NobleTypes['peripheral'], noble: NobleTypes['noble']);
|
|
1184
|
-
static parseServiceData(serviceData: Buffer, emitLog: (level: string, message: string) => void): Promise<
|
|
1184
|
+
static parseServiceData(serviceData: Buffer, emitLog: (level: string, message: string) => void): Promise<meterPlusServiceData | null>;
|
|
1185
1185
|
}
|
|
1186
1186
|
/**
|
|
1187
1187
|
* Class representing a WoSensorTH device.
|
|
@@ -1189,7 +1189,7 @@ export declare class WoSensorTHPlus extends SwitchbotDevice {
|
|
|
1189
1189
|
*/
|
|
1190
1190
|
export declare class WoSensorTHPro extends SwitchbotDevice {
|
|
1191
1191
|
constructor(peripheral: NobleTypes['peripheral'], noble: NobleTypes['noble']);
|
|
1192
|
-
static parseServiceData(serviceData: Buffer, emitLog: (level: string, message: string) => void): Promise<
|
|
1192
|
+
static parseServiceData(serviceData: Buffer, emitLog: (level: string, message: string) => void): Promise<meterProServiceData | null>;
|
|
1193
1193
|
}
|
|
1194
1194
|
/**
|
|
1195
1195
|
* Class representing a WoSensorTH device.
|
|
@@ -1197,7 +1197,7 @@ export declare class WoSensorTHPro extends SwitchbotDevice {
|
|
|
1197
1197
|
*/
|
|
1198
1198
|
export declare class WoSensorTHProCO2 extends SwitchbotDevice {
|
|
1199
1199
|
constructor(peripheral: NobleTypes['peripheral'], noble: NobleTypes['noble']);
|
|
1200
|
-
static parseServiceData(serviceData: Buffer, manufacturerData: Buffer, emitLog: (level: string, message: string) => void): Promise<
|
|
1200
|
+
static parseServiceData(serviceData: Buffer, manufacturerData: Buffer, emitLog: (level: string, message: string) => void): Promise<meterProCO2ServiceData | null>;
|
|
1201
1201
|
}
|
|
1202
1202
|
/**
|
|
1203
1203
|
* Class representing a WoSmartLock device.
|
|
@@ -1219,9 +1219,9 @@ export declare class WoSmartLock extends SwitchbotDevice {
|
|
|
1219
1219
|
* @param {Buffer} serviceData - The service data buffer.
|
|
1220
1220
|
* @param {Buffer} manufacturerData - The manufacturer data buffer.
|
|
1221
1221
|
* @param {Function} emitLog - The function to emit log messages.
|
|
1222
|
-
* @returns {Promise<
|
|
1222
|
+
* @returns {Promise<lockServiceData | null>} - Parsed service data or null if invalid.
|
|
1223
1223
|
*/
|
|
1224
|
-
static parseServiceData(serviceData: Buffer, manufacturerData: Buffer, emitLog: (level: string, message: string) => void): Promise<
|
|
1224
|
+
static parseServiceData(serviceData: Buffer, manufacturerData: Buffer, emitLog: (level: string, message: string) => void): Promise<lockServiceData | null>;
|
|
1225
1225
|
constructor(peripheral: NobleTypes['peripheral'], noble: NobleTypes['noble']);
|
|
1226
1226
|
/**
|
|
1227
1227
|
* Initializes the encryption key info for valid lock communication.
|
|
@@ -1300,9 +1300,9 @@ export declare class WoSmartLockPro extends SwitchbotDevice {
|
|
|
1300
1300
|
* @param {Buffer} serviceData - The service data buffer.
|
|
1301
1301
|
* @param {Buffer} manufacturerData - The manufacturer data buffer.
|
|
1302
1302
|
* @param {Function} emitLog - The function to emit log messages.
|
|
1303
|
-
* @returns {Promise<
|
|
1303
|
+
* @returns {Promise<lockProServiceData | null>} - Parsed service data or null if invalid.
|
|
1304
1304
|
*/
|
|
1305
|
-
static parseServiceData(serviceData: Buffer, manufacturerData: Buffer, emitLog: (level: string, message: string) => void): Promise<
|
|
1305
|
+
static parseServiceData(serviceData: Buffer, manufacturerData: Buffer, emitLog: (level: string, message: string) => void): Promise<lockProServiceData | null>;
|
|
1306
1306
|
constructor(peripheral: NobleTypes['peripheral'], noble: NobleTypes['noble']);
|
|
1307
1307
|
/**
|
|
1308
1308
|
* Initializes the encryption key info for valid lock communication.
|
|
@@ -1370,9 +1370,9 @@ export declare class WoStrip extends SwitchbotDevice {
|
|
|
1370
1370
|
* Parses the service data from the SwitchBot Strip Light.
|
|
1371
1371
|
* @param {Buffer} serviceData - The service data buffer.
|
|
1372
1372
|
* @param {Function} emitLog - The function to emit log messages.
|
|
1373
|
-
* @returns {Promise<
|
|
1373
|
+
* @returns {Promise<stripLightServiceData | null>} - Parsed service data or null if invalid.
|
|
1374
1374
|
*/
|
|
1375
|
-
static parseServiceData(serviceData: Buffer, emitLog: (level: string, message: string) => void): Promise<
|
|
1375
|
+
static parseServiceData(serviceData: Buffer, emitLog: (level: string, message: string) => void): Promise<stripLightServiceData | null>;
|
|
1376
1376
|
constructor(peripheral: NobleTypes['peripheral'], noble: NobleTypes['noble']);
|
|
1377
1377
|
/**
|
|
1378
1378
|
* Reads the state of the strip light.
|
package/dist/device.js
CHANGED
|
@@ -885,7 +885,7 @@ export class WoBlindTilt extends SwitchbotDevice {
|
|
|
885
885
|
* @param {Buffer} manufacturerData - The manufacturer data buffer.
|
|
886
886
|
* @param {Function} emitLog - The function to emit log messages.
|
|
887
887
|
* @param {boolean} [reverse] - Whether to reverse the tilt percentage.
|
|
888
|
-
* @returns {Promise<
|
|
888
|
+
* @returns {Promise<blindTiltServiceData | null>} - The parsed data object or null if the data is invalid.
|
|
889
889
|
*/
|
|
890
890
|
static async parseServiceData(serviceData, manufacturerData, emitLog, reverse = false) {
|
|
891
891
|
if (![5, 6].includes(manufacturerData.length)) {
|
|
@@ -1057,7 +1057,7 @@ export class WoBulb extends SwitchbotDevice {
|
|
|
1057
1057
|
* @param {Buffer} serviceData - The service data buffer.
|
|
1058
1058
|
* @param {Buffer} manufacturerData - The manufacturer data buffer.
|
|
1059
1059
|
* @param {Function} emitLog - The function to emit log messages.
|
|
1060
|
-
* @returns {Promise<
|
|
1060
|
+
* @returns {Promise<colorBulbServiceData | null>} - Parsed service data or null if invalid.
|
|
1061
1061
|
*/
|
|
1062
1062
|
static async parseServiceData(serviceData, manufacturerData,
|
|
1063
1063
|
// eslint-disable-next-line unused-imports/no-unused-vars
|
|
@@ -1184,7 +1184,7 @@ export class WoCeilingLight extends SwitchbotDevice {
|
|
|
1184
1184
|
* Parses the service data for WoCeilingLight.
|
|
1185
1185
|
* @param {Buffer} manufacturerData - The manufacturer data buffer.
|
|
1186
1186
|
* @param {Function} emitLog - The function to emit log messages.
|
|
1187
|
-
* @returns {Promise<
|
|
1187
|
+
* @returns {Promise<ceilingLightServiceData | null>} - Parsed service data or null if invalid.
|
|
1188
1188
|
*/
|
|
1189
1189
|
static async parseServiceData(manufacturerData, emitLog) {
|
|
1190
1190
|
if (manufacturerData.length !== 13) {
|
|
@@ -1215,7 +1215,7 @@ export class WoCeilingLight extends SwitchbotDevice {
|
|
|
1215
1215
|
* Parses the service data for WoCeilingLight Pro.
|
|
1216
1216
|
* @param {Buffer} manufacturerData - The manufacturer data buffer.
|
|
1217
1217
|
* @param {Function} emitLog - The function to emit log messages.
|
|
1218
|
-
* @returns {Promise<
|
|
1218
|
+
* @returns {Promise<ceilingLightProServiceData | null>} - Parsed service data or null if invalid.
|
|
1219
1219
|
*/
|
|
1220
1220
|
static async parseServiceData_Pro(manufacturerData, emitLog) {
|
|
1221
1221
|
if (manufacturerData.length !== 13) {
|
|
@@ -1341,7 +1341,7 @@ export class WoContact extends SwitchbotDevice {
|
|
|
1341
1341
|
* Parses the service data for WoContact.
|
|
1342
1342
|
* @param {Buffer} serviceData - The service data buffer.
|
|
1343
1343
|
* @param {Function} emitLog - The function to emit log messages.
|
|
1344
|
-
* @returns {Promise<
|
|
1344
|
+
* @returns {Promise<contactSensorServiceData | null>} - Parsed service data or null if invalid.
|
|
1345
1345
|
*/
|
|
1346
1346
|
static async parseServiceData(serviceData, emitLog) {
|
|
1347
1347
|
if (serviceData.length !== 9) {
|
|
@@ -1389,7 +1389,7 @@ export class WoCurtain extends SwitchbotDevice {
|
|
|
1389
1389
|
* @param {Buffer} manufacturerData - The manufacturer data buffer.
|
|
1390
1390
|
* @param {Function} emitLog - The function to emit log messages.
|
|
1391
1391
|
* @param {boolean} [reverse] - Whether to reverse the position.
|
|
1392
|
-
* @returns {Promise<
|
|
1392
|
+
* @returns {Promise<curtainServiceData | curtain3ServiceData | null>} - Parsed service data or null if invalid.
|
|
1393
1393
|
*/
|
|
1394
1394
|
static async parseServiceData(serviceData, manufacturerData, emitLog, reverse = false) {
|
|
1395
1395
|
if (![5, 6].includes(serviceData.length)) {
|
|
@@ -1517,7 +1517,7 @@ export class WoHand extends SwitchbotDevice {
|
|
|
1517
1517
|
* Parses the service data for WoHand.
|
|
1518
1518
|
* @param {Buffer} serviceData - The service data buffer.
|
|
1519
1519
|
* @param {Function} emitLog - The function to emit log messages.
|
|
1520
|
-
* @returns {Promise<
|
|
1520
|
+
* @returns {Promise<botServiceData | null>} - Parsed service data or null if invalid.
|
|
1521
1521
|
*/
|
|
1522
1522
|
static async parseServiceData(serviceData, emitLog) {
|
|
1523
1523
|
if (!serviceData || serviceData.length < 3) {
|
|
@@ -1596,7 +1596,7 @@ export class WoHub2 extends SwitchbotDevice {
|
|
|
1596
1596
|
* Parses the service data for WoHub2.
|
|
1597
1597
|
* @param {Buffer} manufacturerData - The manufacturer data buffer.
|
|
1598
1598
|
* @param {Function} emitLog - The function to emit log messages.
|
|
1599
|
-
* @returns {Promise<
|
|
1599
|
+
* @returns {Promise<hub2ServiceData | null>} - Parsed service data or null if invalid.
|
|
1600
1600
|
*/
|
|
1601
1601
|
static async parseServiceData(manufacturerData, emitLog) {
|
|
1602
1602
|
if (manufacturerData.length !== 16) {
|
|
@@ -1636,7 +1636,7 @@ export class WoHumi extends SwitchbotDevice {
|
|
|
1636
1636
|
* Parses the service data for WoHumi.
|
|
1637
1637
|
* @param {Buffer} serviceData - The service data buffer.
|
|
1638
1638
|
* @param {Function} emitLog - The function to emit log messages.
|
|
1639
|
-
* @returns {Promise<
|
|
1639
|
+
* @returns {Promise<humidifierServiceData | null>} - Parsed service data or null if invalid.
|
|
1640
1640
|
*/
|
|
1641
1641
|
static async parseServiceData(serviceData, emitLog) {
|
|
1642
1642
|
if (serviceData.length !== 8) {
|
|
@@ -1739,7 +1739,7 @@ export class WoHumi2 extends SwitchbotDevice {
|
|
|
1739
1739
|
* Parses the service data for WoHumi.
|
|
1740
1740
|
* @param {Buffer} serviceData - The service data buffer.
|
|
1741
1741
|
* @param {Function} emitLog - The function to emit log messages.
|
|
1742
|
-
* @returns {Promise<
|
|
1742
|
+
* @returns {Promise<humidifier2ServiceData | null>} - Parsed service data or null if invalid.
|
|
1743
1743
|
*/
|
|
1744
1744
|
static async parseServiceData(serviceData, emitLog) {
|
|
1745
1745
|
if (serviceData.length !== 8) {
|
|
@@ -1862,7 +1862,7 @@ export class WoIOSensorTH extends SwitchbotDevice {
|
|
|
1862
1862
|
* @param {Buffer} serviceData - The service data buffer.
|
|
1863
1863
|
* @param {Buffer} manufacturerData - The manufacturer data buffer.
|
|
1864
1864
|
* @param {Function} emitLog - The function to emit log messages.
|
|
1865
|
-
* @returns {Promise<
|
|
1865
|
+
* @returns {Promise<outdoorMeterServiceData | null>} - Parsed service data or null if invalid.
|
|
1866
1866
|
*/
|
|
1867
1867
|
static async parseServiceData(serviceData, manufacturerData, emitLog) {
|
|
1868
1868
|
if (serviceData.length !== 3) {
|
|
@@ -1907,7 +1907,7 @@ export class WoKeypad extends SwitchbotDevice {
|
|
|
1907
1907
|
* @param {Buffer} serviceData - The service data buffer.
|
|
1908
1908
|
* @param {Buffer} manufacturerData - The manufacturer data buffer.
|
|
1909
1909
|
* @param {Function} emitLog - The function to emit log messages.
|
|
1910
|
-
* @returns {Promise<
|
|
1910
|
+
* @returns {Promise<keypadDetectorServiceData | null>} - Parsed service data or null if invalid.
|
|
1911
1911
|
*/
|
|
1912
1912
|
static async parseServiceData(serviceData, manufacturerData, emitLog) {
|
|
1913
1913
|
if (!serviceData || serviceData.length < 3) {
|
|
@@ -1956,7 +1956,7 @@ export class WoLeak extends SwitchbotDevice {
|
|
|
1956
1956
|
* @param {Buffer} serviceData - The service data buffer.
|
|
1957
1957
|
* @param {Buffer} manufacturerData - The manufacturer data buffer.
|
|
1958
1958
|
* @param {Function} emitLog - The function to emit log messages.
|
|
1959
|
-
* @returns {Promise<
|
|
1959
|
+
* @returns {Promise<waterLeakDetectorServiceData | null>} - Parsed service data or null if invalid.
|
|
1960
1960
|
*/
|
|
1961
1961
|
static async parseServiceData(serviceData, manufacturerData, emitLog) {
|
|
1962
1962
|
if (!serviceData || serviceData.length < 3) {
|
|
@@ -1999,7 +1999,7 @@ export class WoPlugMiniJP extends SwitchbotDevice {
|
|
|
1999
1999
|
* Parses the service data for WoPlugMini JP.
|
|
2000
2000
|
* @param {Buffer} manufacturerData - The manufacturer data buffer.
|
|
2001
2001
|
* @param {Function} emitLog - The function to emit log messages.
|
|
2002
|
-
* @returns {Promise<
|
|
2002
|
+
* @returns {Promise<plugMiniJPServiceData | null>} - Parsed service data or null if invalid.
|
|
2003
2003
|
*/
|
|
2004
2004
|
static async parseServiceData(manufacturerData, emitLog) {
|
|
2005
2005
|
if (manufacturerData.length !== 14) {
|
|
@@ -2105,7 +2105,7 @@ export class WoPlugMiniUS extends SwitchbotDevice {
|
|
|
2105
2105
|
* Parses the service data for WoPlugMini US.
|
|
2106
2106
|
* @param {Buffer} manufacturerData - The manufacturer data buffer.
|
|
2107
2107
|
* @param {Function} emitLog - The function to emit log messages.
|
|
2108
|
-
* @returns {Promise<
|
|
2108
|
+
* @returns {Promise<plugMiniUSServiceData | null>} - Parsed service data or null if invalid.
|
|
2109
2109
|
*/
|
|
2110
2110
|
static async parseServiceData(manufacturerData, emitLog) {
|
|
2111
2111
|
if (manufacturerData.length !== 14) {
|
|
@@ -2208,7 +2208,7 @@ export class WoPresence extends SwitchbotDevice {
|
|
|
2208
2208
|
* Parses the service data for WoPresence.
|
|
2209
2209
|
* @param {Buffer} serviceData - The service data buffer.
|
|
2210
2210
|
* @param {Function} emitLog - The function to emit log messages.
|
|
2211
|
-
* @returns {Promise<
|
|
2211
|
+
* @returns {Promise<motionSensorServiceData | null>} - Parsed service data or null if invalid.
|
|
2212
2212
|
*/
|
|
2213
2213
|
static async parseServiceData(serviceData, emitLog) {
|
|
2214
2214
|
if (serviceData.length !== 6) {
|
|
@@ -2248,7 +2248,7 @@ export class WoRelaySwitch1 extends SwitchbotDevice {
|
|
|
2248
2248
|
* @param {Buffer} serviceData - The service data buffer.
|
|
2249
2249
|
* @param {Buffer} manufacturerData - The manufacturer data buffer.
|
|
2250
2250
|
* @param {Function} emitLog - The function to emit log messages.
|
|
2251
|
-
* @returns {Promise<
|
|
2251
|
+
* @returns {Promise<relaySwitch1ServiceData | null>} - Parsed service data or null if invalid.
|
|
2252
2252
|
*/
|
|
2253
2253
|
static async parseServiceData(serviceData, manufacturerData, emitLog) {
|
|
2254
2254
|
if (serviceData.length < 8 || manufacturerData.length === null) {
|
|
@@ -2305,7 +2305,7 @@ export class WoRelaySwitch1PM extends SwitchbotDevice {
|
|
|
2305
2305
|
* @param {Buffer} serviceData - The service data buffer.
|
|
2306
2306
|
* @param {Buffer} manufacturerData - The manufacturer data buffer.
|
|
2307
2307
|
* @param {Function} emitLog - The function to emit log messages.
|
|
2308
|
-
* @returns {Promise<
|
|
2308
|
+
* @returns {Promise<relaySwitch1PMServiceData | null>} - Parsed service data or null if invalid.
|
|
2309
2309
|
*/
|
|
2310
2310
|
static async parseServiceData(serviceData, manufacturerData, emitLog) {
|
|
2311
2311
|
if (serviceData.length < 8 || manufacturerData.length === 0) {
|
|
@@ -2361,7 +2361,7 @@ export class WoRemote extends SwitchbotDevice {
|
|
|
2361
2361
|
* Parses the service data for WoRemote.
|
|
2362
2362
|
* @param {Buffer} serviceData - The service data buffer.
|
|
2363
2363
|
* @param {Function} emitLog - The function to emit log messages.
|
|
2364
|
-
* @returns {Promise<
|
|
2364
|
+
* @returns {Promise<remoteServiceData | null>} - Parsed service data or null if invalid.
|
|
2365
2365
|
*/
|
|
2366
2366
|
static async parseServiceData(serviceData, emitLog) {
|
|
2367
2367
|
if (serviceData.length !== 9) {
|
|
@@ -2586,7 +2586,7 @@ export class WoSmartLock extends SwitchbotDevice {
|
|
|
2586
2586
|
* @param {Buffer} serviceData - The service data buffer.
|
|
2587
2587
|
* @param {Buffer} manufacturerData - The manufacturer data buffer.
|
|
2588
2588
|
* @param {Function} emitLog - The function to emit log messages.
|
|
2589
|
-
* @returns {Promise<
|
|
2589
|
+
* @returns {Promise<lockServiceData | null>} - Parsed service data or null if invalid.
|
|
2590
2590
|
*/
|
|
2591
2591
|
static async parseServiceData(serviceData, manufacturerData, emitLog) {
|
|
2592
2592
|
if (manufacturerData.length < 11) {
|
|
@@ -2778,7 +2778,7 @@ export class WoSmartLockPro extends SwitchbotDevice {
|
|
|
2778
2778
|
* @param {Buffer} serviceData - The service data buffer.
|
|
2779
2779
|
* @param {Buffer} manufacturerData - The manufacturer data buffer.
|
|
2780
2780
|
* @param {Function} emitLog - The function to emit log messages.
|
|
2781
|
-
* @returns {Promise<
|
|
2781
|
+
* @returns {Promise<lockProServiceData | null>} - Parsed service data or null if invalid.
|
|
2782
2782
|
*/
|
|
2783
2783
|
static async parseServiceData(serviceData, manufacturerData, emitLog) {
|
|
2784
2784
|
if (manufacturerData.length < 11) {
|
|
@@ -2942,7 +2942,7 @@ export class WoStrip extends SwitchbotDevice {
|
|
|
2942
2942
|
* Parses the service data from the SwitchBot Strip Light.
|
|
2943
2943
|
* @param {Buffer} serviceData - The service data buffer.
|
|
2944
2944
|
* @param {Function} emitLog - The function to emit log messages.
|
|
2945
|
-
* @returns {Promise<
|
|
2945
|
+
* @returns {Promise<stripLightServiceData | null>} - Parsed service data or null if invalid.
|
|
2946
2946
|
*/
|
|
2947
2947
|
static async parseServiceData(serviceData, emitLog) {
|
|
2948
2948
|
if (serviceData.length !== 18) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Server } from 'node:http';
|
|
2
|
-
import type {
|
|
2
|
+
import type { commandType, devices, deviceStatus, deviceStatusRequest, pushResponseBody } from './types/openapi.js';
|
|
3
3
|
import { EventEmitter } from 'node:events';
|
|
4
4
|
/**
|
|
5
5
|
* The `SwitchBotOpenAPI` class provides methods to interact with the SwitchBot OpenAPI.
|
|
@@ -90,8 +90,8 @@ export declare class SwitchBotOpenAPI extends EventEmitter {
|
|
|
90
90
|
* @returns A promise that resolves to an object containing the response body and status code.
|
|
91
91
|
* @throws An error if the device control fails.
|
|
92
92
|
*/
|
|
93
|
-
controlDevice(deviceId: string, command: string, parameter: string, commandType?:
|
|
94
|
-
response:
|
|
93
|
+
controlDevice(deviceId: string, command: string, parameter: string, commandType?: commandType, token?: string, secret?: string): Promise<{
|
|
94
|
+
response: pushResponseBody;
|
|
95
95
|
statusCode: number;
|
|
96
96
|
}>;
|
|
97
97
|
/**
|
|
@@ -2,7 +2,7 @@ import { describe, expect, it } from 'vitest';
|
|
|
2
2
|
import { SwitchBotBLEModel, SwitchBotBLEModelFriendlyName, SwitchBotBLEModelName } from '../device';
|
|
3
3
|
import { isServiceDataOfModel } from './ble-guards';
|
|
4
4
|
describe('ble service data guards', () => {
|
|
5
|
-
it('identifies
|
|
5
|
+
it('identifies colorBulbServiceData correctly', () => {
|
|
6
6
|
const sample = {
|
|
7
7
|
model: SwitchBotBLEModel.ColorBulb,
|
|
8
8
|
modelName: SwitchBotBLEModelName.ColorBulb,
|
|
@@ -23,7 +23,7 @@ describe('ble service data guards', () => {
|
|
|
23
23
|
expect(isServiceDataOfModel(sample, SwitchBotBLEModel.ColorBulb)).toBe(true);
|
|
24
24
|
expect(isServiceDataOfModel(sample, SwitchBotBLEModel.CeilingLight)).toBe(false);
|
|
25
25
|
});
|
|
26
|
-
it('identifies
|
|
26
|
+
it('identifies ceilingLightServiceData correctly', () => {
|
|
27
27
|
const sample = {
|
|
28
28
|
model: SwitchBotBLEModel.CeilingLight,
|
|
29
29
|
modelName: SwitchBotBLEModelName.CeilingLight,
|
|
@@ -44,7 +44,7 @@ describe('ble service data guards', () => {
|
|
|
44
44
|
expect(isServiceDataOfModel(sample, SwitchBotBLEModel.CeilingLight)).toBe(true);
|
|
45
45
|
expect(isServiceDataOfModel(sample, SwitchBotBLEModel.Meter)).toBe(false);
|
|
46
46
|
});
|
|
47
|
-
it('identifies
|
|
47
|
+
it('identifies meterServiceData correctly', () => {
|
|
48
48
|
const sample = {
|
|
49
49
|
model: SwitchBotBLEModel.Meter,
|
|
50
50
|
modelName: SwitchBotBLEModelName.Meter,
|