node-switchbot 2.5.0-beta.2 → 2.5.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/switchbot.d.ts +40 -15
- package/dist/switchbot.d.ts.map +1 -1
- package/dist/switchbot.js +41 -59
- package/dist/switchbot.js.map +1 -1
- package/package.json +1 -1
package/dist/switchbot.d.ts
CHANGED
|
@@ -2,14 +2,23 @@ import type { Ad } from './advertising.js';
|
|
|
2
2
|
import type { Params } from './types/types.js';
|
|
3
3
|
import * as Noble from '@stoprocent/noble';
|
|
4
4
|
import { SwitchbotDevice } from './device.js';
|
|
5
|
+
/**
|
|
6
|
+
* SwitchBot class to interact with SwitchBot devices.
|
|
7
|
+
*/
|
|
5
8
|
export declare class SwitchBot {
|
|
6
9
|
private ready;
|
|
7
10
|
noble: typeof Noble;
|
|
8
11
|
ondiscover?: (device: SwitchbotDevice) => void;
|
|
9
12
|
onadvertisement?: (ad: Ad) => void;
|
|
10
|
-
onlog
|
|
13
|
+
onlog?: (message: string) => void;
|
|
11
14
|
DEFAULT_DISCOVERY_DURATION: number;
|
|
12
|
-
PRIMARY_SERVICE_UUID_LIST:
|
|
15
|
+
PRIMARY_SERVICE_UUID_LIST: string[];
|
|
16
|
+
/**
|
|
17
|
+
* Constructor
|
|
18
|
+
*
|
|
19
|
+
* @param {Params} [params] - Optional parameters
|
|
20
|
+
* @param {typeof Noble} [params.noble] - Optional noble instance
|
|
21
|
+
*/
|
|
13
22
|
constructor(params?: Params);
|
|
14
23
|
/**
|
|
15
24
|
* Initializes the noble object.
|
|
@@ -26,32 +35,48 @@ export declare class SwitchBot {
|
|
|
26
35
|
* @returns {Promise<SwitchbotDevice[]>} - A promise that resolves with a list of discovered devices.
|
|
27
36
|
*/
|
|
28
37
|
discover(params?: Params): Promise<SwitchbotDevice[]>;
|
|
38
|
+
/**
|
|
39
|
+
* Initializes the noble object and waits for it to be powered on.
|
|
40
|
+
*
|
|
41
|
+
* @returns {Promise<void>} - Resolves when the noble object is powered on.
|
|
42
|
+
*/
|
|
29
43
|
_init(): Promise<void>;
|
|
44
|
+
/**
|
|
45
|
+
* Gets the device object based on the peripheral, id, and model.
|
|
46
|
+
*
|
|
47
|
+
* @param {Noble.Peripheral} peripheral - The peripheral object.
|
|
48
|
+
* @param {string} id - The device id.
|
|
49
|
+
* @param {string} model - The device model.
|
|
50
|
+
* @returns {Promise<SwitchbotDevice | null>} - The device object or null.
|
|
51
|
+
*/
|
|
30
52
|
getDeviceObject(peripheral: Noble.Peripheral, id: string, model: string): Promise<SwitchbotDevice | null>;
|
|
53
|
+
/**
|
|
54
|
+
* Filters advertising data based on id and model.
|
|
55
|
+
*
|
|
56
|
+
* @param {Ad} ad - The advertising data.
|
|
57
|
+
* @param {string} id - The device id.
|
|
58
|
+
* @param {string} model - The device model.
|
|
59
|
+
* @returns {boolean} - True if the advertising data matches the id and model, false otherwise.
|
|
60
|
+
*/
|
|
31
61
|
filterAdvertising(ad: Ad, id: string, model: string): boolean;
|
|
32
62
|
/**
|
|
33
|
-
*
|
|
34
|
-
* - Start to monitor advertising packets coming from switchbot devices
|
|
63
|
+
* Starts scanning for SwitchBot devices.
|
|
35
64
|
*
|
|
36
|
-
* @param {
|
|
37
|
-
* @
|
|
38
|
-
* @param {string} [params.id] - Optional ID filter (MAC address, case-insensitive, colons ignored)
|
|
39
|
-
* @returns {Promise<void>} - Resolves when scanning starts successfully
|
|
65
|
+
* @param {Params} [params] - Optional parameters.
|
|
66
|
+
* @returns {Promise<void>} - Resolves when scanning starts successfully.
|
|
40
67
|
*/
|
|
41
68
|
startScan(params?: Params): Promise<void>;
|
|
42
69
|
/**
|
|
43
|
-
*
|
|
44
|
-
* - Stop monitoring advertising packets from SwitchBot devices
|
|
70
|
+
* Stops scanning for SwitchBot devices.
|
|
45
71
|
*
|
|
46
|
-
* @returns {Promise<void>} - Resolves when scanning stops successfully
|
|
72
|
+
* @returns {Promise<void>} - Resolves when scanning stops successfully.
|
|
47
73
|
*/
|
|
48
74
|
stopScan(): Promise<void>;
|
|
49
75
|
/**
|
|
50
|
-
*
|
|
51
|
-
* - Wait for the specified time (msec)
|
|
76
|
+
* Waits for the specified time.
|
|
52
77
|
*
|
|
53
|
-
* @param {number} msec - The time to wait in milliseconds
|
|
54
|
-
* @returns {Promise<void>} - Resolves after the specified time
|
|
78
|
+
* @param {number} msec - The time to wait in milliseconds.
|
|
79
|
+
* @returns {Promise<void>} - Resolves after the specified time.
|
|
55
80
|
*/
|
|
56
81
|
wait(msec: number): Promise<void>;
|
|
57
82
|
}
|
package/dist/switchbot.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"switchbot.d.ts","sourceRoot":"","sources":["../src/switchbot.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,kBAAkB,CAAA;AAC1C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;AAE9C,OAAO,KAAK,KAAK,MAAM,mBAAmB,CAAA;AAG1C,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAmB7C,qBAAa,SAAS;IACpB,OAAO,CAAC,KAAK,CAAe;IAC5B,KAAK,EAAG,OAAO,KAAK,CAAA;IACpB,UAAU,CAAC,EAAE,CAAC,MAAM,EAAE,eAAe,KAAK,IAAI,CAAA;IAC9C,eAAe,CAAC,EAAE,CAAC,EAAE,EAAE,EAAE,KAAK,IAAI,CAAA;IAClC,KAAK,EAAE,CAAC,
|
|
1
|
+
{"version":3,"file":"switchbot.d.ts","sourceRoot":"","sources":["../src/switchbot.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,kBAAkB,CAAA;AAC1C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;AAE9C,OAAO,KAAK,KAAK,MAAM,mBAAmB,CAAA;AAG1C,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa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-18,6 +18,9 @@ import { WoSmartLockPro } from './device/wosmartlockpro.js';
|
|
|
18
18
|
import { WoStrip } from './device/wostrip.js';
|
|
19
19
|
import { parameterChecker } from './parameter-checker.js';
|
|
20
20
|
import { SwitchBotBLEModel } from './types/types.js';
|
|
21
|
+
/**
|
|
22
|
+
* SwitchBot class to interact with SwitchBot devices.
|
|
23
|
+
*/
|
|
21
24
|
export class SwitchBot {
|
|
22
25
|
ready;
|
|
23
26
|
noble;
|
|
@@ -26,16 +29,12 @@ export class SwitchBot {
|
|
|
26
29
|
onlog;
|
|
27
30
|
DEFAULT_DISCOVERY_DURATION = 5000;
|
|
28
31
|
PRIMARY_SERVICE_UUID_LIST = [];
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
* | | | This parameter is optional.
|
|
36
|
-
* | | | If you don't specify this parameter, this
|
|
37
|
-
* | | | module automatically creates it.
|
|
38
|
-
* ---------------------------------------------------------------- */
|
|
32
|
+
/**
|
|
33
|
+
* Constructor
|
|
34
|
+
*
|
|
35
|
+
* @param {Params} [params] - Optional parameters
|
|
36
|
+
* @param {typeof Noble} [params.noble] - Optional noble instance
|
|
37
|
+
*/
|
|
39
38
|
constructor(params) {
|
|
40
39
|
this.ready = this.init(params);
|
|
41
40
|
}
|
|
@@ -56,7 +55,6 @@ export class SwitchBot {
|
|
|
56
55
|
* @returns {Promise<SwitchbotDevice[]>} - A promise that resolves with a list of discovered devices.
|
|
57
56
|
*/
|
|
58
57
|
async discover(params = {}) {
|
|
59
|
-
// Validate parameters
|
|
60
58
|
const valid = parameterChecker.check(params, {
|
|
61
59
|
duration: { required: false, type: 'integer', min: 1, max: 60000 },
|
|
62
60
|
model: { required: false, type: 'string', enum: Object.values(SwitchBotBLEModel) },
|
|
@@ -67,7 +65,6 @@ export class SwitchBot {
|
|
|
67
65
|
throw new Error(parameterChecker.error.message);
|
|
68
66
|
}
|
|
69
67
|
const { duration = this.DEFAULT_DISCOVERY_DURATION, model = '', id = '', quick = false } = params;
|
|
70
|
-
// Initialize the noble object
|
|
71
68
|
await this._init();
|
|
72
69
|
if (!this.noble) {
|
|
73
70
|
throw new Error('noble failed to initialize');
|
|
@@ -82,7 +79,6 @@ export class SwitchBot {
|
|
|
82
79
|
};
|
|
83
80
|
return new Promise((resolve, reject) => {
|
|
84
81
|
try {
|
|
85
|
-
// Set a handler for the 'discover' event
|
|
86
82
|
this.noble.on('discover', async (peripheral) => {
|
|
87
83
|
const device = await this.getDeviceObject(peripheral, id, model);
|
|
88
84
|
if (device) {
|
|
@@ -95,7 +91,6 @@ export class SwitchBot {
|
|
|
95
91
|
}
|
|
96
92
|
}
|
|
97
93
|
});
|
|
98
|
-
// Start scanning
|
|
99
94
|
this.noble.startScanningAsync(this.PRIMARY_SERVICE_UUID_LIST, false)
|
|
100
95
|
.then(() => {
|
|
101
96
|
timer = setTimeout(() => {
|
|
@@ -111,6 +106,11 @@ export class SwitchBot {
|
|
|
111
106
|
}
|
|
112
107
|
});
|
|
113
108
|
}
|
|
109
|
+
/**
|
|
110
|
+
* Initializes the noble object and waits for it to be powered on.
|
|
111
|
+
*
|
|
112
|
+
* @returns {Promise<void>} - Resolves when the noble object is powered on.
|
|
113
|
+
*/
|
|
114
114
|
async _init() {
|
|
115
115
|
await this.ready;
|
|
116
116
|
if (this.noble._state === 'poweredOn') {
|
|
@@ -133,12 +133,17 @@ export class SwitchBot {
|
|
|
133
133
|
});
|
|
134
134
|
});
|
|
135
135
|
}
|
|
136
|
+
/**
|
|
137
|
+
* Gets the device object based on the peripheral, id, and model.
|
|
138
|
+
*
|
|
139
|
+
* @param {Noble.Peripheral} peripheral - The peripheral object.
|
|
140
|
+
* @param {string} id - The device id.
|
|
141
|
+
* @param {string} model - The device model.
|
|
142
|
+
* @returns {Promise<SwitchbotDevice | null>} - The device object or null.
|
|
143
|
+
*/
|
|
136
144
|
async getDeviceObject(peripheral, id, model) {
|
|
137
145
|
const ad = await Advertising.parse(peripheral, this.onlog);
|
|
138
|
-
if (!ad) {
|
|
139
|
-
return null;
|
|
140
|
-
}
|
|
141
|
-
if (!this.filterAdvertising(ad, id, model)) {
|
|
146
|
+
if (!ad || !this.filterAdvertising(ad, id, model)) {
|
|
142
147
|
return null;
|
|
143
148
|
}
|
|
144
149
|
const modelMapping = {
|
|
@@ -165,6 +170,14 @@ export class SwitchBot {
|
|
|
165
170
|
const DeviceClass = ad?.serviceData?.model ? modelMapping[ad.serviceData.model] : SwitchbotDevice;
|
|
166
171
|
return new DeviceClass(peripheral, this.noble);
|
|
167
172
|
}
|
|
173
|
+
/**
|
|
174
|
+
* Filters advertising data based on id and model.
|
|
175
|
+
*
|
|
176
|
+
* @param {Ad} ad - The advertising data.
|
|
177
|
+
* @param {string} id - The device id.
|
|
178
|
+
* @param {string} model - The device model.
|
|
179
|
+
* @returns {boolean} - True if the advertising data matches the id and model, false otherwise.
|
|
180
|
+
*/
|
|
168
181
|
filterAdvertising(ad, id, model) {
|
|
169
182
|
if (!ad) {
|
|
170
183
|
return false;
|
|
@@ -182,54 +195,28 @@ export class SwitchBot {
|
|
|
182
195
|
return true;
|
|
183
196
|
}
|
|
184
197
|
/**
|
|
185
|
-
*
|
|
186
|
-
* - Start to monitor advertising packets coming from switchbot devices
|
|
198
|
+
* Starts scanning for SwitchBot devices.
|
|
187
199
|
*
|
|
188
|
-
* @param {
|
|
189
|
-
* @
|
|
190
|
-
* @param {string} [params.id] - Optional ID filter (MAC address, case-insensitive, colons ignored)
|
|
191
|
-
* @returns {Promise<void>} - Resolves when scanning starts successfully
|
|
200
|
+
* @param {Params} [params] - Optional parameters.
|
|
201
|
+
* @returns {Promise<void>} - Resolves when scanning starts successfully.
|
|
192
202
|
*/
|
|
193
203
|
async startScan(params = {}) {
|
|
194
|
-
// Validate parameters
|
|
195
204
|
const valid = parameterChecker.check(params, {
|
|
196
205
|
model: {
|
|
197
206
|
required: false,
|
|
198
207
|
type: 'string',
|
|
199
|
-
enum:
|
|
200
|
-
SwitchBotBLEModel.Bot,
|
|
201
|
-
SwitchBotBLEModel.Curtain,
|
|
202
|
-
SwitchBotBLEModel.Curtain3,
|
|
203
|
-
SwitchBotBLEModel.Humidifier,
|
|
204
|
-
SwitchBotBLEModel.Meter,
|
|
205
|
-
SwitchBotBLEModel.MeterPlus,
|
|
206
|
-
SwitchBotBLEModel.Hub2,
|
|
207
|
-
SwitchBotBLEModel.OutdoorMeter,
|
|
208
|
-
SwitchBotBLEModel.MotionSensor,
|
|
209
|
-
SwitchBotBLEModel.ContactSensor,
|
|
210
|
-
SwitchBotBLEModel.ColorBulb,
|
|
211
|
-
SwitchBotBLEModel.CeilingLight,
|
|
212
|
-
SwitchBotBLEModel.CeilingLightPro,
|
|
213
|
-
SwitchBotBLEModel.StripLight,
|
|
214
|
-
SwitchBotBLEModel.PlugMiniUS,
|
|
215
|
-
SwitchBotBLEModel.PlugMiniJP,
|
|
216
|
-
SwitchBotBLEModel.Lock,
|
|
217
|
-
SwitchBotBLEModel.LockPro,
|
|
218
|
-
SwitchBotBLEModel.BlindTilt,
|
|
219
|
-
],
|
|
208
|
+
enum: Object.values(SwitchBotBLEModel),
|
|
220
209
|
},
|
|
221
210
|
id: { required: false, type: 'string', min: 12, max: 17 },
|
|
222
211
|
}, false);
|
|
223
212
|
if (!valid) {
|
|
224
213
|
throw new Error(parameterChecker.error.message);
|
|
225
214
|
}
|
|
226
|
-
// Initialize the noble object
|
|
227
215
|
await this._init();
|
|
228
|
-
if (this.noble
|
|
216
|
+
if (!this.noble) {
|
|
229
217
|
throw new Error('noble object failed to initialize');
|
|
230
218
|
}
|
|
231
219
|
const { model = '', id = '' } = params;
|
|
232
|
-
// Set a handler for the 'discover' event
|
|
233
220
|
this.noble.on('discover', async (peripheral) => {
|
|
234
221
|
const ad = await Advertising.parse(peripheral, this.onlog);
|
|
235
222
|
if (ad && this.filterAdvertising(ad, id, model)) {
|
|
@@ -238,14 +225,12 @@ export class SwitchBot {
|
|
|
238
225
|
}
|
|
239
226
|
}
|
|
240
227
|
});
|
|
241
|
-
// Start scanning
|
|
242
228
|
await this.noble.startScanningAsync(this.PRIMARY_SERVICE_UUID_LIST, true);
|
|
243
229
|
}
|
|
244
230
|
/**
|
|
245
|
-
*
|
|
246
|
-
* - Stop monitoring advertising packets from SwitchBot devices
|
|
231
|
+
* Stops scanning for SwitchBot devices.
|
|
247
232
|
*
|
|
248
|
-
* @returns {Promise<void>} - Resolves when scanning stops successfully
|
|
233
|
+
* @returns {Promise<void>} - Resolves when scanning stops successfully.
|
|
249
234
|
*/
|
|
250
235
|
async stopScan() {
|
|
251
236
|
if (!this.noble) {
|
|
@@ -255,21 +240,18 @@ export class SwitchBot {
|
|
|
255
240
|
await this.noble.stopScanningAsync();
|
|
256
241
|
}
|
|
257
242
|
/**
|
|
258
|
-
*
|
|
259
|
-
* - Wait for the specified time (msec)
|
|
243
|
+
* Waits for the specified time.
|
|
260
244
|
*
|
|
261
|
-
* @param {number} msec - The time to wait in milliseconds
|
|
262
|
-
* @returns {Promise<void>} - Resolves after the specified time
|
|
245
|
+
* @param {number} msec - The time to wait in milliseconds.
|
|
246
|
+
* @returns {Promise<void>} - Resolves after the specified time.
|
|
263
247
|
*/
|
|
264
248
|
async wait(msec) {
|
|
265
|
-
// Validate parameters
|
|
266
249
|
const valid = parameterChecker.check({ msec }, {
|
|
267
250
|
msec: { required: true, type: 'integer', min: 0 },
|
|
268
251
|
}, true);
|
|
269
252
|
if (!valid) {
|
|
270
253
|
throw new Error(parameterChecker.error.message);
|
|
271
254
|
}
|
|
272
|
-
// Return a promise that resolves after the specified time
|
|
273
255
|
return new Promise(resolve => setTimeout(resolve, msec));
|
|
274
256
|
}
|
|
275
257
|
}
|
package/dist/switchbot.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"switchbot.js","sourceRoot":"","sources":["../src/switchbot.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,KAAK,MAAM,mBAAmB,CAAA;AAE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GAAG,gBAAgB,CAAC,KAAK,CAClC,EAAE,IAAI,EAAE,EACR;YACE,IAAI,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,GAAG,EAAE,CAAC,EAAE;SAClD,EACD,IAAI,CACL,CAAA;QAED,IAAI,CAAC,KAAK,EAAE,CAAC;YACX,MAAM,IAAI,KAAK,CAAC,gBAAgB,CAAC,KAAM,CAAC,OAAO,CAAC,CAAA;QAClD,CAAC;QAED,OAAO,IAAI,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC,CAAA;IAC1D,CAAC;CACF;AAED,OAAO,EAAE,eAAe,EAAE,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "node-switchbot",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "2.5.0-beta.
|
|
4
|
+
"version": "2.5.0-beta.3",
|
|
5
5
|
"description": "The node-switchbot is a Node.js module which allows you to control your Switchbot Devices through Bluetooth (BLE).",
|
|
6
6
|
"author": "OpenWonderLabs (https://github.com/OpenWonderLabs)",
|
|
7
7
|
"license": "MIT",
|