node-switchbot 2.4.0-beta.3 → 2.5.0-beta.0
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/CHANGELOG.md +1 -1
- package/dist/advertising.d.ts +14 -148
- package/dist/advertising.d.ts.map +1 -1
- package/dist/advertising.js +36 -92
- package/dist/advertising.js.map +1 -1
- package/dist/device/woblindtilt.d.ts +98 -13
- package/dist/device/woblindtilt.d.ts.map +1 -1
- package/dist/device/woblindtilt.js +192 -86
- package/dist/device/woblindtilt.js.map +1 -1
- package/dist/device/woblindtilt.test.d.ts +2 -0
- package/dist/device/woblindtilt.test.d.ts.map +1 -0
- package/dist/device/woblindtilt.test.js +26 -0
- package/dist/device/woblindtilt.test.js.map +1 -0
- package/dist/device/wobulb.d.ts +17 -34
- package/dist/device/wobulb.d.ts.map +1 -1
- package/dist/device/wobulb.js +53 -61
- package/dist/device/wobulb.js.map +1 -1
- package/dist/device/wobulb.test.d.ts +2 -0
- package/dist/device/wobulb.test.d.ts.map +1 -0
- package/dist/device/wobulb.test.js +52 -0
- package/dist/device/wobulb.test.js.map +1 -0
- package/dist/device/woceilinglight.d.ts +21 -51
- package/dist/device/woceilinglight.d.ts.map +1 -1
- package/dist/device/woceilinglight.js +53 -64
- package/dist/device/woceilinglight.js.map +1 -1
- package/dist/device/woceilinglight.test.d.ts +2 -0
- package/dist/device/woceilinglight.test.d.ts.map +1 -0
- package/dist/device/woceilinglight.test.js +63 -0
- package/dist/device/woceilinglight.test.js.map +1 -0
- package/dist/device/wocontact.d.ts +1 -14
- package/dist/device/wocontact.d.ts.map +1 -1
- package/dist/device/wocontact.js +13 -13
- package/dist/device/wocontact.js.map +1 -1
- package/dist/device/wocontact.test.d.ts +2 -0
- package/dist/device/wocontact.test.d.ts.map +1 -0
- package/dist/device/wocontact.test.js +34 -0
- package/dist/device/wocontact.test.js.map +1 -0
- package/dist/device/wocurtain.d.ts +5 -16
- package/dist/device/wocurtain.d.ts.map +1 -1
- package/dist/device/wocurtain.js +58 -47
- package/dist/device/wocurtain.js.map +1 -1
- package/dist/device/wocurtain.test.d.ts +2 -0
- package/dist/device/wocurtain.test.d.ts.map +1 -0
- package/dist/device/wocurtain.test.js +33 -0
- package/dist/device/wocurtain.test.js.map +1 -0
- package/dist/device/wohand.d.ts +2 -10
- package/dist/device/wohand.d.ts.map +1 -1
- package/dist/device/wohand.js +31 -33
- package/dist/device/wohand.js.map +1 -1
- package/dist/device/wohand.test.d.ts +2 -0
- package/dist/device/wohand.test.d.ts.map +1 -0
- package/dist/device/wohand.test.js +62 -0
- package/dist/device/wohand.test.js.map +1 -0
- package/dist/device/wohand2.test.d.ts +2 -0
- package/dist/device/wohand2.test.d.ts.map +1 -0
- package/dist/device/wohand2.test.js +50 -0
- package/dist/device/wohand2.test.js.map +1 -0
- package/dist/device/wohub2.d.ts +1 -19
- package/dist/device/wohub2.d.ts.map +1 -1
- package/dist/device/wohub2.js +6 -2
- package/dist/device/wohub2.js.map +1 -1
- package/dist/device/wohumi.d.ts +2 -11
- package/dist/device/wohumi.d.ts.map +1 -1
- package/dist/device/wohumi.js +31 -33
- package/dist/device/wohumi.js.map +1 -1
- package/dist/device/wohumi.test.d.ts +2 -0
- package/dist/device/wohumi.test.d.ts.map +1 -0
- package/dist/device/wohumi.test.js +61 -0
- package/dist/device/wohumi.test.js.map +1 -0
- package/dist/device/woiosensorth.d.ts +1 -19
- package/dist/device/woiosensorth.d.ts.map +1 -1
- package/dist/device/woiosensorth.js +14 -10
- package/dist/device/woiosensorth.js.map +1 -1
- package/dist/device/woiosensorth.test.d.ts +2 -0
- package/dist/device/woiosensorth.test.d.ts.map +1 -0
- package/dist/device/woiosensorth.test.js +39 -0
- package/dist/device/woiosensorth.test.js.map +1 -0
- package/dist/device/woplugmini.d.ts +12 -38
- package/dist/device/woplugmini.d.ts.map +1 -1
- package/dist/device/woplugmini.js +35 -40
- package/dist/device/woplugmini.js.map +1 -1
- package/dist/device/woplugmini.test.d.ts +2 -0
- package/dist/device/woplugmini.test.d.ts.map +1 -0
- package/dist/device/woplugmini.test.js +91 -0
- package/dist/device/woplugmini.test.js.map +1 -0
- package/dist/device/wopresence.d.ts +2 -14
- package/dist/device/wopresence.d.ts.map +1 -1
- package/dist/device/wopresence.js +11 -7
- package/dist/device/wopresence.js.map +1 -1
- package/dist/device/wopresence.test.d.ts +2 -0
- package/dist/device/wopresence.test.d.ts.map +1 -0
- package/dist/device/wopresence.test.js +42 -0
- package/dist/device/wopresence.test.js.map +1 -0
- package/dist/device/wosensorth.d.ts +3 -37
- package/dist/device/wosensorth.d.ts.map +1 -1
- package/dist/device/wosensorth.js +24 -20
- package/dist/device/wosensorth.js.map +1 -1
- package/dist/device/wosensorth.test.d.ts +2 -0
- package/dist/device/wosensorth.test.d.ts.map +1 -0
- package/dist/device/wosensorth.test.js +59 -0
- package/dist/device/wosensorth.test.js.map +1 -0
- package/dist/device/wosmartlock.d.ts +19 -33
- package/dist/device/wosmartlock.d.ts.map +1 -1
- package/dist/device/wosmartlock.js +104 -83
- package/dist/device/wosmartlock.js.map +1 -1
- package/dist/device/wosmartlock.test.d.ts +2 -0
- package/dist/device/wosmartlock.test.d.ts.map +1 -0
- package/dist/device/wosmartlock.test.js +84 -0
- package/dist/device/wosmartlock.test.js.map +1 -0
- package/dist/device/wosmartlockpro.d.ts +13 -27
- package/dist/device/wosmartlockpro.d.ts.map +1 -1
- package/dist/device/wosmartlockpro.js +90 -70
- package/dist/device/wosmartlockpro.js.map +1 -1
- package/dist/device/wosmartlockpro.test.d.ts +2 -0
- package/dist/device/wosmartlockpro.test.d.ts.map +1 -0
- package/dist/device/wosmartlockpro.test.js +124 -0
- package/dist/device/wosmartlockpro.test.js.map +1 -0
- package/dist/device/wostrip.d.ts +18 -32
- package/dist/device/wostrip.d.ts.map +1 -1
- package/dist/device/wostrip.js +58 -70
- package/dist/device/wostrip.js.map +1 -1
- package/dist/device/wostrip.test.d.ts +2 -0
- package/dist/device/wostrip.test.d.ts.map +1 -0
- package/dist/device/wostrip.test.js +115 -0
- package/dist/device/wostrip.test.js.map +1 -0
- package/dist/device.d.ts +237 -39
- package/dist/device.d.ts.map +1 -1
- package/dist/device.js +478 -366
- package/dist/device.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/parameter-checker.d.ts.map +1 -1
- package/dist/parameter-checker.js.map +1 -1
- package/dist/settings.d.ts +8 -0
- package/dist/settings.d.ts.map +1 -0
- package/dist/settings.js +12 -0
- package/dist/settings.js.map +1 -0
- package/dist/switchbot.d.ts +30 -10
- package/dist/switchbot.d.ts.map +1 -1
- package/dist/switchbot.js +39 -86
- package/dist/switchbot.js.map +1 -1
- package/dist/types/bledevicestatus.d.ts +288 -0
- package/dist/types/bledevicestatus.d.ts.map +1 -0
- package/dist/types/bledevicestatus.js +2 -0
- package/dist/types/bledevicestatus.js.map +1 -0
- package/dist/types/devicelist.d.ts +89 -0
- package/dist/types/devicelist.d.ts.map +1 -0
- package/dist/types/devicelist.js +6 -0
- package/dist/types/devicelist.js.map +1 -0
- package/dist/types/deviceresponse.d.ts +13 -0
- package/dist/types/deviceresponse.d.ts.map +1 -0
- package/dist/types/deviceresponse.js +2 -0
- package/dist/types/deviceresponse.js.map +1 -0
- package/dist/types/devicestatus.d.ts +149 -0
- package/dist/types/devicestatus.d.ts.map +1 -0
- package/dist/types/devicestatus.js +3 -0
- package/dist/types/devicestatus.js.map +1 -0
- package/dist/types/devicewebhookstatus.d.ts +156 -0
- package/dist/types/devicewebhookstatus.d.ts.map +1 -0
- package/dist/types/devicewebhookstatus.js +2 -0
- package/dist/types/devicewebhookstatus.js.map +1 -0
- package/dist/types/irdevicelist.d.ts +10 -0
- package/dist/types/irdevicelist.d.ts.map +1 -0
- package/dist/types/irdevicelist.js +2 -0
- package/dist/types/irdevicelist.js.map +1 -0
- package/dist/types/pushbody.d.ts +6 -0
- package/dist/types/pushbody.d.ts.map +1 -0
- package/dist/types/pushbody.js +2 -0
- package/dist/types/pushbody.js.map +1 -0
- package/dist/{types.d.ts → types/types.d.ts} +9 -0
- package/dist/types/types.d.ts.map +1 -0
- package/dist/types/types.js.map +1 -0
- package/jest.config.js +3 -0
- package/package.json +22 -14
- package/dist/types.d.ts.map +0 -1
- package/dist/types.js.map +0 -1
- /package/dist/{types.js → types/types.js} +0 -0
|
@@ -1,25 +1,37 @@
|
|
|
1
|
+
import { Buffer } from 'node:buffer';
|
|
1
2
|
/* Copyright(C) 2024, donavanbecker (https://github.com/donavanbecker). All rights reserved.
|
|
2
3
|
*
|
|
3
4
|
* woblindtilt.ts: Switchbot BLE API registration.
|
|
4
5
|
*/
|
|
5
|
-
import { Buffer } from 'node:buffer';
|
|
6
6
|
import { SwitchbotDevice } from '../device.js';
|
|
7
|
-
import { SwitchBotBLEModel, SwitchBotBLEModelFriendlyName, SwitchBotBLEModelName } from '../types.js';
|
|
7
|
+
import { SwitchBotBLEModel, SwitchBotBLEModelFriendlyName, SwitchBotBLEModelName } from '../types/types.js';
|
|
8
8
|
export class WoBlindTilt extends SwitchbotDevice {
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
_reverse = false;
|
|
10
|
+
/**
|
|
11
|
+
* Parses the service data and manufacturer data for the WoBlindTilt device.
|
|
12
|
+
*
|
|
13
|
+
* @param {Buffer} serviceData - The service data buffer.
|
|
14
|
+
* @param {Buffer} manufacturerData - The manufacturer data buffer.
|
|
15
|
+
* @param {(message: string) => void} [onlog] - Optional logging function.
|
|
16
|
+
* @param {boolean} [reverse] - Whether to reverse the tilt percentage.
|
|
17
|
+
* @returns {object | null} The parsed data object or null if the data is invalid.
|
|
18
|
+
*/
|
|
19
|
+
static async parseServiceData(serviceData, manufacturerData, onlog, reverse = false) {
|
|
20
|
+
if (manufacturerData.length !== 5 && manufacturerData.length !== 6) {
|
|
11
21
|
if (onlog && typeof onlog === 'function') {
|
|
12
|
-
onlog(`[parseServiceDataForWoBlindTilt] Buffer length ${
|
|
22
|
+
onlog(`[parseServiceDataForWoBlindTilt] Buffer length ${manufacturerData.length} !== 5 or 6!`);
|
|
13
23
|
}
|
|
14
24
|
return null;
|
|
15
25
|
}
|
|
16
|
-
const byte1 =
|
|
17
|
-
const byte2 =
|
|
18
|
-
const
|
|
19
|
-
const
|
|
26
|
+
// const byte1 = serviceData.readUInt8(1)
|
|
27
|
+
const byte2 = serviceData.readUInt8(2);
|
|
28
|
+
const byte6 = manufacturerData.subarray(6);
|
|
29
|
+
const tilt = Math.max(Math.min(byte6.readUInt8(2) & 0b01111111, 100), 0); // current tilt % (100 - _tilt) if reverse else _tilt,
|
|
20
30
|
const inMotion = !!(byte2 & 0b10000000);
|
|
21
|
-
const
|
|
22
|
-
const
|
|
31
|
+
const lightLevel = (byte6.readUInt8(1) >> 4) & 0b00001111; // light sensor level (1-10)
|
|
32
|
+
const calibration = !!(byte6.readUInt8(1) & 0b00000001); // Whether the calibration is completed
|
|
33
|
+
const sequenceNumber = byte6.readUInt8(0);
|
|
34
|
+
const battery = serviceData.length > 2 ? byte2 & 0b01111111 : null;
|
|
23
35
|
const data = {
|
|
24
36
|
model: SwitchBotBLEModel.BlindTilt,
|
|
25
37
|
modelName: SwitchBotBLEModelName.BlindTilt,
|
|
@@ -27,78 +39,163 @@ export class WoBlindTilt extends SwitchbotDevice {
|
|
|
27
39
|
calibration,
|
|
28
40
|
battery,
|
|
29
41
|
inMotion,
|
|
30
|
-
tilt,
|
|
42
|
+
tilt: reverse ? (100 - tilt) : tilt,
|
|
31
43
|
lightLevel,
|
|
44
|
+
sequenceNumber,
|
|
32
45
|
};
|
|
33
46
|
return data;
|
|
34
47
|
}
|
|
35
|
-
|
|
36
|
-
* open
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
* -
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
* Nothing will be passed to the `resolve()`.
|
|
45
|
-
* ---------------------------------------------------------------- */
|
|
46
|
-
open() {
|
|
47
|
-
return this._operateBlindTilt([0x57, 0x0F, 0x45, 0x01, 0x05, 0xFF, 0x00]);
|
|
48
|
+
/**
|
|
49
|
+
* open
|
|
50
|
+
*
|
|
51
|
+
* Opens the blind tilt to the fully open position.
|
|
52
|
+
*
|
|
53
|
+
* @returns {Promise<void>} - A promise that resolves when the operation is complete. Nothing will be passed to the `resolve()`.
|
|
54
|
+
*/
|
|
55
|
+
async open() {
|
|
56
|
+
return await this.operateBlindTilt([0x57, 0x0F, 0x45, 0x01, 0x05, 0xFF, 0x32]);
|
|
48
57
|
}
|
|
49
|
-
|
|
50
|
-
*
|
|
51
|
-
*
|
|
52
|
-
*
|
|
53
|
-
*
|
|
54
|
-
* -
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
* Nothing will be passed to the `resolve()`.
|
|
59
|
-
* ---------------------------------------------------------------- */
|
|
60
|
-
close() {
|
|
61
|
-
return this._operateBlindTilt([0x57, 0x0F, 0x45, 0x01, 0x05, 0xFF, 0x64]);
|
|
58
|
+
/**
|
|
59
|
+
* closeUp
|
|
60
|
+
*
|
|
61
|
+
* Closes the blind tilt up to the nearest endpoint.
|
|
62
|
+
*
|
|
63
|
+
* @returns {Promise<void>} - A promise that resolves when the operation is complete. Nothing will be passed to the `resolve()`.
|
|
64
|
+
*/
|
|
65
|
+
async closeUp() {
|
|
66
|
+
return await this.operateBlindTilt([0x57, 0x0F, 0x45, 0x01, 0x05, 0xFF, 0x64]);
|
|
62
67
|
}
|
|
63
|
-
|
|
64
|
-
*
|
|
65
|
-
*
|
|
66
|
-
*
|
|
67
|
-
*
|
|
68
|
-
* -
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
* Nothing will be passed to the `resolve()`.
|
|
73
|
-
* ---------------------------------------------------------------- */
|
|
74
|
-
pause() {
|
|
75
|
-
return this._operateBlindTilt([0x57, 0x0F, 0x45, 0x01, 0x00, 0xFF]);
|
|
68
|
+
/**
|
|
69
|
+
* closeDown
|
|
70
|
+
*
|
|
71
|
+
* Closes the blind tilt down to the nearest endpoint.
|
|
72
|
+
*
|
|
73
|
+
* @returns {Promise<void>} - A promise that resolves when the operation is complete. Nothing will be passed to the `resolve()`.
|
|
74
|
+
*/
|
|
75
|
+
async closeDown() {
|
|
76
|
+
return await this.operateBlindTilt([0x57, 0x0F, 0x45, 0x01, 0x05, 0xFF, 0x00]);
|
|
76
77
|
}
|
|
77
|
-
|
|
78
|
-
*
|
|
79
|
-
*
|
|
80
|
-
*
|
|
81
|
-
*
|
|
82
|
-
* -
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
78
|
+
/**
|
|
79
|
+
* close
|
|
80
|
+
*
|
|
81
|
+
* Closes the blind tilt to the nearest endpoint.
|
|
82
|
+
*
|
|
83
|
+
* @returns {Promise<void>} - A promise that resolves when the operation is complete. Nothing will be passed to the `resolve()`.
|
|
84
|
+
*/
|
|
85
|
+
async close() {
|
|
86
|
+
const position = await this.getPosition();
|
|
87
|
+
if (position > 50) {
|
|
88
|
+
return await this.closeUp();
|
|
89
|
+
}
|
|
90
|
+
else {
|
|
91
|
+
return await this.closeDown();
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* getPosition
|
|
96
|
+
*
|
|
97
|
+
* Retrieves the current position of the blind tilt.
|
|
98
|
+
*
|
|
99
|
+
* @returns {number} - The current position of the blind tilt (0-100).
|
|
100
|
+
*/
|
|
101
|
+
async getPosition() {
|
|
102
|
+
// Retrieve the current tilt position using the _getAdvValue method
|
|
103
|
+
const tiltPosition = await this._getAdvValue('tilt');
|
|
104
|
+
// Ensure the tilt position is within the valid range (0-100)
|
|
105
|
+
return Math.max(0, Math.min(tiltPosition, 100));
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* _getAdvValue
|
|
109
|
+
*
|
|
110
|
+
* Retrieves the advertised value for a given key.
|
|
111
|
+
*
|
|
112
|
+
* @param {string} key - The key for the advertised value.
|
|
113
|
+
* @returns {Promise<number>} - The advertised value.
|
|
114
|
+
*/
|
|
115
|
+
async _getAdvValue(key) {
|
|
116
|
+
// Mock implementation, replace with actual logic to retrieve the advertised value
|
|
117
|
+
if (key === 'tilt') {
|
|
118
|
+
return 50; // Example value
|
|
119
|
+
}
|
|
120
|
+
throw new Error(`Unknown key: ${key}`);
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* getBasicInfo
|
|
124
|
+
*
|
|
125
|
+
* Retrieves the basic information of the blind tilt.
|
|
126
|
+
*
|
|
127
|
+
* @returns {Promise<object>} - A promise that resolves to an object containing the basic information of the blind tilt.
|
|
128
|
+
*/
|
|
129
|
+
async getBasicInfo() {
|
|
130
|
+
const data = await this.getBasicInfo();
|
|
131
|
+
if (!data) {
|
|
132
|
+
return null;
|
|
133
|
+
}
|
|
134
|
+
const tilt = Math.max(Math.min(data[6], 100), 0);
|
|
135
|
+
const moving = Boolean(data[5] & 0b00000011);
|
|
136
|
+
let opening = false;
|
|
137
|
+
let closing = false;
|
|
138
|
+
let up = false;
|
|
139
|
+
if (moving) {
|
|
140
|
+
opening = Boolean(data[5] & 0b00000010);
|
|
141
|
+
closing = !opening && Boolean(data[5] & 0b00000001);
|
|
142
|
+
if (opening) {
|
|
143
|
+
const flag = Boolean(data[5] & 0b00000001);
|
|
144
|
+
up = flag ? this._reverse : !flag;
|
|
145
|
+
}
|
|
146
|
+
else {
|
|
147
|
+
up = tilt < 50 ? this._reverse : tilt > 50;
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
return {
|
|
151
|
+
battery: data[1],
|
|
152
|
+
firmware: data[2] / 10.0,
|
|
153
|
+
light: Boolean(data[4] & 0b00100000),
|
|
154
|
+
fault: Boolean(data[4] & 0b00001000),
|
|
155
|
+
solarPanel: Boolean(data[5] & 0b00001000),
|
|
156
|
+
calibration: Boolean(data[5] & 0b00000100),
|
|
157
|
+
calibrated: Boolean(data[5] & 0b00000100),
|
|
158
|
+
inMotion: moving,
|
|
159
|
+
motionDirection: {
|
|
160
|
+
opening: moving && opening,
|
|
161
|
+
closing: moving && closing,
|
|
162
|
+
up: moving && up,
|
|
163
|
+
down: moving && !up,
|
|
164
|
+
},
|
|
165
|
+
tilt: this._reverse ? 100 - tilt : tilt,
|
|
166
|
+
timers: data[7],
|
|
167
|
+
};
|
|
168
|
+
}
|
|
169
|
+
/**
|
|
170
|
+
* Pauses the blind tilt operation.
|
|
171
|
+
*
|
|
172
|
+
* This method sends a command to pause the current operation of the blind tilt.
|
|
173
|
+
*
|
|
174
|
+
* @returns {Promise<void>} A promise that resolves when the operation is complete.
|
|
175
|
+
* No value is passed to the `resolve()` function.
|
|
176
|
+
*/
|
|
177
|
+
async pause() {
|
|
178
|
+
await this.operateBlindTilt([0x57, 0x0F, 0x45, 0x01, 0x00, 0xFF]);
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* runToPos the blind tilt operation.
|
|
182
|
+
*
|
|
183
|
+
* This method sends a command to run the blind tilt to the specified position.
|
|
184
|
+
*
|
|
185
|
+
* @param {number} percent - The target position percentage (0-100).
|
|
186
|
+
* @param {number} mode - The running mode (0 or 1).
|
|
187
|
+
* @returns {Promise<void>} - A promise that resolves when the operation is complete.
|
|
188
|
+
*/
|
|
189
|
+
async runToPos(percent, mode) {
|
|
89
190
|
if (typeof percent !== 'number') {
|
|
90
|
-
|
|
91
|
-
reject(new Error(`The type of target position percentage is incorrect: ${typeof percent}`));
|
|
92
|
-
});
|
|
191
|
+
throw new TypeError(`The type of target position percentage is incorrect: ${typeof percent}`);
|
|
93
192
|
}
|
|
94
193
|
if (mode === null) {
|
|
95
194
|
mode = 0xFF;
|
|
96
195
|
}
|
|
97
196
|
else {
|
|
98
197
|
if (typeof mode !== 'number') {
|
|
99
|
-
|
|
100
|
-
reject(new Error(`The type of running mode is incorrect: ${typeof mode}`));
|
|
101
|
-
});
|
|
198
|
+
throw new TypeError(`The type of running mode is incorrect: ${typeof mode}`);
|
|
102
199
|
}
|
|
103
200
|
if (mode > 1) {
|
|
104
201
|
mode = 0xFF;
|
|
@@ -110,24 +207,33 @@ export class WoBlindTilt extends SwitchbotDevice {
|
|
|
110
207
|
else if (percent < 0) {
|
|
111
208
|
percent = 0;
|
|
112
209
|
}
|
|
113
|
-
|
|
210
|
+
await this.operateBlindTilt([0x57, 0x0F, 0x45, 0x01, 0x05, mode, percent]);
|
|
114
211
|
}
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
212
|
+
/**
|
|
213
|
+
* Sends a command to operate the blind tilt and handles the response.
|
|
214
|
+
*
|
|
215
|
+
* This method constructs a buffer from the provided byte array and sends it as a command to the device.
|
|
216
|
+
* It returns a promise that resolves if the device responds with a success code (0x01) and rejects if the device
|
|
217
|
+
* returns an error or if the command fails.
|
|
218
|
+
*
|
|
219
|
+
* @param {number[]} bytes - The byte array representing the command to be sent to the device.
|
|
220
|
+
* @returns {Promise<void>} A promise that resolves when the command is successfully executed or rejects with an
|
|
221
|
+
* error if the command fails.
|
|
222
|
+
*
|
|
223
|
+
* @throws {Error} Throws an error if the device returns an error code or if the command fails.
|
|
224
|
+
*/
|
|
225
|
+
async operateBlindTilt(bytes) {
|
|
226
|
+
const req_buf = Buffer.from(bytes);
|
|
227
|
+
this.command(req_buf).then((res_buf) => {
|
|
228
|
+
const code = res_buf.readUInt8(0);
|
|
229
|
+
if (res_buf.length === 3 && code === 0x01) {
|
|
230
|
+
// Success: No action needed
|
|
231
|
+
}
|
|
232
|
+
else {
|
|
233
|
+
throw new Error(`The device returned an error: 0x${res_buf.toString('hex')}`);
|
|
234
|
+
}
|
|
235
|
+
}).catch((error) => {
|
|
236
|
+
throw error;
|
|
131
237
|
});
|
|
132
238
|
}
|
|
133
239
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"woblindtilt.js","sourceRoot":"","sources":["../../src/device/woblindtilt.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"woblindtilt.js","sourceRoot":"","sources":["../../src/device/woblindtilt.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AAEpC;;;GAGG;AACH,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AAC9C,OAAO,EAAE,iBAAiB,EAAE,6BAA6B,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAA;AAE3G,MAAM,OAAO,WAAY,SAAQ,eAAe;IACtC,QAAQ,GAAY,KAAK,CAAA;IACjC;;;;;;;;OAQG;IACH,MAAM,CAAC,KAAK,CAAC,gBAAgB,CAC3B,WAAmB,EACnB,gBAAwB,EACxB,KAA8C,EAC9C,UAAmB,KAAK;QAExB,IAAI,gBAAgB,CAAC,MAAM,KAAK,CAAC,IAAI,gBAAgB,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACnE,IAAI,KAAK,IAAI,OAAO,KAAK,KAAK,UAAU,EAAE,CAAC;gBACzC,KAAK,CAAC,kDAAkD,gBAAgB,CAAC,MAAM,cAAc,CAAC,CAAA;YAChG,CAAC;YACD,OAAO,IAAI,CAAA;QACb,CAAC;QAED,yCAAyC;QACzC,MAAM,KAAK,GAAG,WAAW,CAAC,SAAS,CAAC,CAAC,CAAC,CAAA;QACtC,MAAM,KAAK,GAAG,gBAAgB,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAA;QAE1C,MAAM,IAAI,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,GAAG,UAAU,EAAE,GAAG,CAAC,EAAE,CAAC,CAAC,CAAA,CAAC,sDAAsD;QAC/H,MA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G,CAAC,EAAE,CAAC;YACvB,OAAO,GAAG,CAAC,CAAA;QACb,CAAC;QACD,MAAM,IAAI,CAAC,gBAAgB,CAAC,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC,CAAA;IAC5E,CAAC;IAED;;;;;;;;;;;;OAYG;IACH,KAAK,CAAC,gBAAgB,CAAC,KAAe;QACpC,MAAM,OAAO,GAAG,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;QAClC,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,EAAE;YACrC,MAAM,IAAI,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,CAAA;YACjC,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,IAAI,IAAI,KAAK,IAAI,EAAE,CAAC;gBAC1C,4BAA4B;YAC9B,CAAC;iBAAM,CAAC;gBACN,MAAM,IAAI,KAAK,CAAC,mCAAmC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC,CAAA;YAC/E,CAAC;QACH,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;YACjB,MAAM,KAAK,CAAA;QACb,CAAC,CAAC,CAAA;IACJ,CAAC;CACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"woblindtilt.test.d.ts","sourceRoot":"","sources":["../../src/device/woblindtilt.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import * as Noble from '@stoprocent/noble';
|
|
2
|
+
import { beforeEach, describe, it } from 'vitest';
|
|
3
|
+
import { WoBlindTilt } from './woblindtilt.js';
|
|
4
|
+
describe('woBlindTilt', () => {
|
|
5
|
+
let woBlindTilt;
|
|
6
|
+
beforeEach(() => {
|
|
7
|
+
const peripheral = {}; // Replace with the actual peripheral object
|
|
8
|
+
woBlindTilt = new WoBlindTilt(peripheral, Noble); // Replace 'noble' with the actual Noble object
|
|
9
|
+
});
|
|
10
|
+
describe('pause', () => {
|
|
11
|
+
it('should pause the blind tilt operation', async () => {
|
|
12
|
+
// Mock the _operateBlindTilt method
|
|
13
|
+
const operateBlindTiltMock = jest.spyOn(woBlindTilt, 'operateBlindTilt')
|
|
14
|
+
.mockResolvedValueOnce(undefined);
|
|
15
|
+
await woBlindTilt.pause();
|
|
16
|
+
expect(operateBlindTiltMock).toHaveBeenCalledWith([0x57, 0x0F, 0x45, 0x01, 0x00, 0xFF]);
|
|
17
|
+
});
|
|
18
|
+
it('should handle errors correctly', async () => {
|
|
19
|
+
// Mock the _operateBlindTilt method to throw an error
|
|
20
|
+
jest.spyOn(woBlindTilt, 'operateBlindTilt')
|
|
21
|
+
.mockRejectedValueOnce(new Error('Operation failed'));
|
|
22
|
+
await expect(woBlindTilt.pause()).rejects.toThrow('Operation failed');
|
|
23
|
+
});
|
|
24
|
+
});
|
|
25
|
+
});
|
|
26
|
+
//# sourceMappingURL=woblindtilt.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"woblindtilt.test.js","sourceRoot":"","sources":["../../src/device/woblindtilt.test.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,mBAAmB,CAAA;AAC1C,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAA;AAEjD,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAE9C,QAAQ,CAAC,aAAa,EAAE,GAAG,EAAE;IAC3B,IAAI,WAAwB,CAAA;IAE5B,UAAU,CAAC,GAAG,EAAE;QACd,MAAM,UAAU,GAAG,EAAE,CAAA,CAAC,4CAA4C;QAClE,WAAW,GAAG,IAAI,WAAW,CAAC,UAA8B,EAAE,KAAK,CAAC,CAAA,CAAC,+CAA+C;IACtH,CAAC,CAAC,CAAA;IAEF,QAAQ,CAAC,OAAO,EAAE,GAAG,EAAE;QACrB,EAAE,CAAC,uCAAuC,EAAE,KAAK,IAAI,EAAE;YACrD,oCAAoC;YACpC,MAAM,oBAAoB,GAAG,IAAI,CAAC,KAAK,CAAC,WAAW,EAAE,kBAAkB,CAAC;iBACrE,qBAAqB,CAAC,SAAS,CAAC,CAAA;YAEnC,MAAM,WAAW,CAAC,KAAK,EAAE,CAAA;YAEzB,MAAM,CAAC,oBAAoB,CAAC,CAAC,oBAAoB,CAAC,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC,CAAA;QACzF,CAAC,CAAC,CAAA;QAEF,EAAE,CAAC,gCAAgC,EAAE,KAAK,IAAI,EAAE;YAC9C,sDAAsD;YACtD,IAAI,CAAC,KAAK,CAAC,WAAW,EAAE,kBAAkB,CAAC;iBACxC,qBAAqB,CAAC,IAAI,KAAK,CAAC,kBAAkB,CAAU,CAAC,CAAA;YAEhE,MAAM,MAAM,CAAC,WAAW,CAAC,KAAK,EAAE,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,kBAAkB,CAAC,CAAA;QACvE,CAAC,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA"}
|
package/dist/device/wobulb.d.ts
CHANGED
|
@@ -1,58 +1,41 @@
|
|
|
1
1
|
import { Buffer } from 'node:buffer';
|
|
2
2
|
import { SwitchbotDevice } from '../device.js';
|
|
3
|
-
import { SwitchBotBLEModel, SwitchBotBLEModelFriendlyName, SwitchBotBLEModelName } from '../types.js';
|
|
4
3
|
/**
|
|
5
4
|
* @see https://github.com/OpenWonderLabs/SwitchBotAPI-BLE/blob/latest/devicetypes/colorbulb.md
|
|
6
5
|
*/
|
|
7
6
|
export declare class WoBulb extends SwitchbotDevice {
|
|
8
|
-
static parseServiceData(manufacturerData: Buffer, onlog: ((message: string) => void) | undefined):
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
power: number;
|
|
14
|
-
state: boolean;
|
|
15
|
-
red: number;
|
|
16
|
-
green: number;
|
|
17
|
-
blue: number;
|
|
18
|
-
brightness: number;
|
|
19
|
-
delay: number;
|
|
20
|
-
preset: number;
|
|
21
|
-
color_mode: number;
|
|
22
|
-
speed: number;
|
|
23
|
-
loop_index: number;
|
|
24
|
-
} | null;
|
|
25
|
-
/**
|
|
26
|
-
* @returns {Promise<boolean>} resolves with a boolean that tells whether the plug in ON(true) or OFF(false)
|
|
27
|
-
*/
|
|
28
|
-
readState(): Promise<unknown>;
|
|
7
|
+
static parseServiceData(serviceData: Buffer, manufacturerData: Buffer, onlog: ((message: string) => void) | undefined): Promise<object | null>;
|
|
8
|
+
/**
|
|
9
|
+
* @returns resolves with a boolean that tells whether the plug in ON(true) or OFF(false)
|
|
10
|
+
*/
|
|
11
|
+
readState(): Promise<void>;
|
|
29
12
|
/**
|
|
30
13
|
* @private
|
|
31
14
|
*/
|
|
32
|
-
|
|
15
|
+
setState(reqByteArray: number[]): Promise<void>;
|
|
33
16
|
/**
|
|
34
|
-
* @returns
|
|
17
|
+
* @returns resolves with a boolean that tells whether the plug in ON(true) or OFF(false)
|
|
35
18
|
*/
|
|
36
|
-
turnOn(): Promise<
|
|
19
|
+
turnOn(): Promise<void>;
|
|
37
20
|
/**
|
|
38
|
-
* @returns
|
|
21
|
+
* @returns resolves with a boolean that tells whether the plug in ON(true) or OFF(false)
|
|
39
22
|
*/
|
|
40
|
-
turnOff(): Promise<
|
|
23
|
+
turnOff(): Promise<void>;
|
|
41
24
|
/**
|
|
42
|
-
* @returns
|
|
25
|
+
* @returns resolves with brightness percent
|
|
43
26
|
*/
|
|
44
|
-
setBrightness(brightness: number): Promise<
|
|
27
|
+
setBrightness(brightness: number): Promise<void>;
|
|
45
28
|
/**
|
|
46
|
-
* @returns
|
|
29
|
+
* @returns resolves with color_temperature percent
|
|
47
30
|
*/
|
|
48
|
-
setColorTemperature(color_temperature: number): Promise<
|
|
31
|
+
setColorTemperature(color_temperature: number): Promise<void>;
|
|
49
32
|
/**
|
|
50
|
-
* @returns
|
|
33
|
+
* @returns resolves with brightness percent
|
|
51
34
|
*/
|
|
52
|
-
setRGB(brightness: number, red: number, green: number, blue: number): Promise<
|
|
35
|
+
setRGB(brightness: number, red: number, green: number, blue: number): Promise<void>;
|
|
53
36
|
/**
|
|
54
37
|
* @private
|
|
55
38
|
*/
|
|
56
|
-
|
|
39
|
+
operateBulb(bytes: number[]): Promise<void>;
|
|
57
40
|
}
|
|
58
41
|
//# sourceMappingURL=wobulb.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wobulb.d.ts","sourceRoot":"","sources":["../../src/device/wobulb.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"wobulb.d.ts","sourceRoot":"","sources":["../../src/device/wobulb.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AAMpC,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AAG9C;;GAEG;AACH,qBAAa,MAAO,SAAQ,eAAe;WAC5B,gBAAgB,CAC3B,WAAW,EAAE,MAAM,EACnB,gBAAgB,EAAE,MAAM,EACxB,KAAK,EAAE,CAAC,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC,GAAG,SAAS,GAC7C,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;IA0DzB;;OAEG;IACG,SAAS;IAIf;;OAEG;IACG,QAAQ,CAAC,YAAY,EAAE,MAAM,EAAE;IAKrC;;OAEG;IACG,MAAM;IAIZ;;OAEG;IACG,OAAO;IAIb;;OAEG;IACG,aAAa,CAAC,UAAU,EAAE,MAAM;IAYtC;;OAEG;IACG,mBAAmB,CAAC,iBAAiB,EAAE,MAAM;IAWnD;;OAEG;IACG,MAAM,CAAC,UAAU,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM;IAoCzE;;OAEG;IACG,WAAW,CAAC,KAAK,EAAE,MAAM,EAAE;CAqBlC"}
|