node-switchbot 2.0.0 → 2.0.1-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/npm-version-script.cjs +81 -0
- package/README.md +51 -51
- package/dist/switchbot.d.ts +2 -0
- package/dist/switchbot.d.ts.map +1 -1
- package/dist/switchbot.js +22 -19
- package/dist/switchbot.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
#!/bin/env node
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* This scripts queries the npm registry to pull out the latest version for a given tag.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
const fs = require("fs");
|
|
8
|
+
const semver = require("semver");
|
|
9
|
+
const child_process = require("child_process");
|
|
10
|
+
const assert = require("assert");
|
|
11
|
+
|
|
12
|
+
const BRANCH_VERSION_PATTERN = /^([A-Za-z]*)-(\d+.\d+.\d+)$/
|
|
13
|
+
|
|
14
|
+
// Load the contents of the package.json file
|
|
15
|
+
const packageJSON = JSON.parse(fs.readFileSync("package.json", "utf8"));
|
|
16
|
+
|
|
17
|
+
let refArgument = process.argv[2];
|
|
18
|
+
let tagArgument = process.argv[3] || "latest";
|
|
19
|
+
|
|
20
|
+
if (refArgument == null) {
|
|
21
|
+
console.error("ref argument is missing");
|
|
22
|
+
console.error("Usage: npm-version-script.cjs <ref> [tag]");
|
|
23
|
+
process.exit(1);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Queries the NPM registry for the latest version for the provided tag.
|
|
28
|
+
* @param tag The tag to query for.
|
|
29
|
+
* @returns {string} Returns the version.
|
|
30
|
+
*/
|
|
31
|
+
function getTagVersionFromNpm(tag) {
|
|
32
|
+
try {
|
|
33
|
+
return child_process.execSync(`npm info ${packageJSON.name} version --tag="${tag}"`).toString("utf8").trim();
|
|
34
|
+
} catch (e) {
|
|
35
|
+
throw e;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
function desiredTargetVersion(ref) {
|
|
40
|
+
// ref is a GitHub action ref string
|
|
41
|
+
if (ref.startsWith("refs/pull/")) {
|
|
42
|
+
throw Error("The version script was executed inside a PR!");
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
assert(ref.startsWith("refs/heads/"))
|
|
46
|
+
let branchName = ref.slice("refs/heads/".length);
|
|
47
|
+
|
|
48
|
+
let results = branchName.match(BRANCH_VERSION_PATTERN);
|
|
49
|
+
if (results != null) {
|
|
50
|
+
if (results[1] !== tagArgument) {
|
|
51
|
+
console.warn(`The base branch name (${results[1]}) differs from the tag name ${tagArgument}`);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
return results[2];
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
// legacy mode were we use the `betaVersion` property in the package.json
|
|
58
|
+
if (branchName === "beta" && packageJSON.betaVersion) {
|
|
59
|
+
return packageJSON.betaVersion
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
throw new Error("Malformed branch name for ref: " + ref + ". Can't derive the base version. Use a branch name like: beta-x.x.x!");
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
// derive the base version from the branch ref
|
|
66
|
+
const baseVersion = desiredTargetVersion(refArgument);
|
|
67
|
+
|
|
68
|
+
// query the npm registry for the latest version of the provided tag name
|
|
69
|
+
const latestReleasedVersion = getTagVersionFromNpm(tagArgument); // e.g. 0.7.0-beta.12
|
|
70
|
+
const latestReleaseBase = semver.inc(latestReleasedVersion, "patch"); // will produce 0.7.0 (removing the preid, needed for the equality check below)
|
|
71
|
+
|
|
72
|
+
let publishTag;
|
|
73
|
+
if (semver.eq(baseVersion, latestReleaseBase)) { // check if we are releasing another version for the latest beta
|
|
74
|
+
publishTag = latestReleasedVersion; // set the current latest beta to be incremented
|
|
75
|
+
} else {
|
|
76
|
+
publishTag = baseVersion; // start of with a new beta version
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
// save the package.json
|
|
80
|
+
packageJSON.version = publishTag;
|
|
81
|
+
fs.writeFileSync("package.json", JSON.stringify(packageJSON, null, 2));
|
package/README.md
CHANGED
|
@@ -43,18 +43,18 @@ But some functionalities of this module were developed through trial and error.
|
|
|
43
43
|
- [`disconnect()` method](#disconnect-method)
|
|
44
44
|
- [`onconnect` event handler](#onconnect-event-handler)
|
|
45
45
|
- [`ondisconnect` event handler](#ondisconnect-event-handler)
|
|
46
|
-
- [`
|
|
46
|
+
- [`WoHand` object](#switchbotdevicewohand-object)
|
|
47
47
|
- [`press()` method](#press-method)
|
|
48
48
|
- [`turnOn()` method](#turnon-method)
|
|
49
49
|
- [`turnOff()` method](#turnoff-method)
|
|
50
50
|
- [`down()` method](#down-method)
|
|
51
51
|
- [`up()` method](#up-method)
|
|
52
|
-
- [`
|
|
52
|
+
- [`WoCurtain` object](#switchbotdevicewocurtain-object)
|
|
53
53
|
- [`open()` method](#open-method)
|
|
54
54
|
- [`close()` method](#close-method)
|
|
55
55
|
- [`pause()` method](#pause-method)
|
|
56
56
|
- [`runToPos()` method](#runtopos-method)
|
|
57
|
-
- [`
|
|
57
|
+
- [`WoPlugMini` object](#switchbotdevicewoplugmini-object)
|
|
58
58
|
- [`turnOn()` method](#turnon-method)
|
|
59
59
|
- [`turnOff()` method](#turnoff-method)
|
|
60
60
|
- [`toggle()` method](#toggle-method)
|
|
@@ -108,11 +108,11 @@ $ npm install node-switchbot
|
|
|
108
108
|
|
|
109
109
|
Monitoring the advertising packets, you can find your devices and know the latest state of each device. The packet contains the settings of the device, the arm position of the Bot, the temperature and humidity of the Meter, and so on.
|
|
110
110
|
|
|
111
|
-
```
|
|
111
|
+
```Typescript
|
|
112
112
|
// Load the node-switchbot and get a `Switchbot` constructor object
|
|
113
|
-
|
|
113
|
+
import { SwitchBot } from 'node-switchbot';
|
|
114
114
|
// Create an `Switchbot` object
|
|
115
|
-
const switchbot = new
|
|
115
|
+
const switchbot = new SwitchBot();
|
|
116
116
|
|
|
117
117
|
(async () => {
|
|
118
118
|
// Start to monitor advertisement packets
|
|
@@ -135,7 +135,7 @@ The [`wait()`](#Switchbot-wait-method) method is just a utility method, which wa
|
|
|
135
135
|
|
|
136
136
|
The [`startScan()`](#startscan-method) and [`wait()`](#Switchbot-wait-method) methods are asynchronous, they return a `Promise` object. You can write code in promise style as well. What the code below does is as same as what the code above does:
|
|
137
137
|
|
|
138
|
-
```
|
|
138
|
+
```Typescript
|
|
139
139
|
// Load the node-switchbot and get a `Switchbot` constructor object
|
|
140
140
|
const Switchbot = require("node-switchbot");
|
|
141
141
|
// Create an `Switchbot` object
|
|
@@ -211,11 +211,11 @@ See the section "[Advertisement data](#Advertisement-data)" for the details of t
|
|
|
211
211
|
|
|
212
212
|
This sample discovers a Bot (WoHand), then put the Bot's arm down, finally put it up in 5 seconds.
|
|
213
213
|
|
|
214
|
-
```
|
|
214
|
+
```Typescript
|
|
215
215
|
// Load the node-switchbot and get a `Switchbot` constructor object
|
|
216
|
-
|
|
216
|
+
import { SwitchBot } from 'node-switchbot';
|
|
217
217
|
// Create an `Switchbot` object
|
|
218
|
-
const switchbot = new
|
|
218
|
+
const switchbot = new SwitchBot();
|
|
219
219
|
|
|
220
220
|
(async () => {
|
|
221
221
|
// Find a Bot (WoHand)
|
|
@@ -223,7 +223,7 @@ const switchbot = new Switchbot();
|
|
|
223
223
|
if (bot_list.length === 0) {
|
|
224
224
|
throw new Error("No device was found.");
|
|
225
225
|
}
|
|
226
|
-
// The `
|
|
226
|
+
// The `WoHand` object representing the found Bot.
|
|
227
227
|
const device = bot_list[0];
|
|
228
228
|
// Put the Bot's arm down (stretch the arm)
|
|
229
229
|
await device.down();
|
|
@@ -237,7 +237,7 @@ const switchbot = new Switchbot();
|
|
|
237
237
|
|
|
238
238
|
In order to manipulate the arm of your Bot, you have to discover your Bot using the [`discover()`](#Switchbot-discover-method) method. The object `{ model: 'H' }` passed to the method means that only Bots will be discovered. That is, Meters will be ignored.
|
|
239
239
|
|
|
240
|
-
In this code, you can get a [`
|
|
240
|
+
In this code, you can get a [`WoHand`](#SwitchbotDeviceWoHand-object) object representing the found Bot. Using the [`down()`](#SwitchbotDeviceWoHand-down-method) and [`up()`](#SwitchbotDeviceWoHand-up-method) methods of the object, you can move the arm. In addition to these methods, you can use the [`press()`](#SwitchbotDeviceWoHand-press-method), [`turnOn()`](#SwitchbotDeviceWoHand-turnOn-method), and [`turnOff()`](#SwitchbotDeviceWoHand-turnOff-method) methods as well.
|
|
241
241
|
|
|
242
242
|
---
|
|
243
243
|
|
|
@@ -245,17 +245,17 @@ In this code, you can get a [`SwitchbotDeviceWoHand`](#SwitchbotDeviceWoHand-obj
|
|
|
245
245
|
|
|
246
246
|
In order to use the node-switchbot, you have to load the node-switchbot module as follows:
|
|
247
247
|
|
|
248
|
-
```
|
|
249
|
-
|
|
248
|
+
```Typescript
|
|
249
|
+
import { SwitchBot } from 'node-switchbot';
|
|
250
250
|
```
|
|
251
251
|
|
|
252
|
-
You can get an `
|
|
252
|
+
You can get an `SwitchBot` constructor from the code above. Then you have to create an `SwitchBot` object from the `SwitchBot` constructor as follows:
|
|
253
253
|
|
|
254
|
-
```
|
|
255
|
-
const switchbot = new
|
|
254
|
+
```typescript
|
|
255
|
+
const switchbot = new SwitchBot();
|
|
256
256
|
```
|
|
257
257
|
|
|
258
|
-
The `
|
|
258
|
+
The `SwitchBot` constructor takes an argument optionally. It must be a hash object containing the properties as follows:
|
|
259
259
|
|
|
260
260
|
| Property | Type | Required | Description |
|
|
261
261
|
| :------- | :---- | :------- | :---------------------------------------------------------------------------------------- |
|
|
@@ -265,16 +265,16 @@ The node-switchbot module uses the [`@abandonware/noble`](https://github.com/aba
|
|
|
265
265
|
|
|
266
266
|
The sample code below shows how to pass a `Noble` object to the `Switchbot` constructor.
|
|
267
267
|
|
|
268
|
-
```
|
|
268
|
+
```Typescript
|
|
269
269
|
// Create a Noble object
|
|
270
270
|
const noble = require('@abandonware/noble');
|
|
271
271
|
|
|
272
272
|
// Create a Switchbot object
|
|
273
|
-
|
|
274
|
-
const switchbot = new
|
|
273
|
+
import { SwitchBot } from 'node-switchbot';
|
|
274
|
+
const switchbot = new SwitchBot({ 'noble': noble })
|
|
275
275
|
```
|
|
276
276
|
|
|
277
|
-
In the code snippet above, the variable `switchbot` is an `
|
|
277
|
+
In the code snippet above, the variable `switchbot` is an `SwitchBot` object. The `SwitchBot` object has a lot of methods as described in sections below.
|
|
278
278
|
|
|
279
279
|
### `discover()` method
|
|
280
280
|
|
|
@@ -289,7 +289,7 @@ The `discover` method finds devices. This method returns a `Promise` object. Thi
|
|
|
289
289
|
|
|
290
290
|
In the code snippet below, no parameter is passed to the method:
|
|
291
291
|
|
|
292
|
-
```
|
|
292
|
+
```Typescript
|
|
293
293
|
switchbot.discover().then((device_list) => {
|
|
294
294
|
// Do something...
|
|
295
295
|
}).catch((error) => {
|
|
@@ -301,7 +301,7 @@ If no parameter is passed to the method as the code above, an `Array` object wil
|
|
|
301
301
|
|
|
302
302
|
If you want a quick response, you can set the `quick` property to `true`.
|
|
303
303
|
|
|
304
|
-
```
|
|
304
|
+
```Typescript
|
|
305
305
|
switchbot.discover({
|
|
306
306
|
duration: 5000,
|
|
307
307
|
quick: true
|
|
@@ -319,7 +319,7 @@ As the `quick` property is set to `true`, the `resolve()` function will be calle
|
|
|
319
319
|
|
|
320
320
|
The `ondiscover` property on the [`Switchbot`](#Switchbot-object) object is an event handler called whenever a device is newly found in the discovery process. A [`SwitchbotDevice`](#SwitchbotDevice-object) object is passed to the callback function set to the `ondiscover` property.
|
|
321
321
|
|
|
322
|
-
```
|
|
322
|
+
```Typescript
|
|
323
323
|
switchbot.ondiscover = (device) => {
|
|
324
324
|
console.log(device.id + ' (' + device.modelName + ')');
|
|
325
325
|
};
|
|
@@ -350,7 +350,7 @@ The `startScan()` method starts to scan advertising packets coming from devices.
|
|
|
350
350
|
|
|
351
351
|
Whenever a packet is received, the callback function set to the [`onadvertisement`](#Switchbot-onadvertisement-event-handler) property of the [`Switchbot`](#Switchbot-object) object will be called. When a packet is received, a hash object representing the packet will be passed to the callback function.
|
|
352
352
|
|
|
353
|
-
```
|
|
353
|
+
```Typescript
|
|
354
354
|
// Set a callback function called when a packet is received
|
|
355
355
|
switchbot.onadvertisement = (ad) => {
|
|
356
356
|
console.log(ad);
|
|
@@ -414,9 +414,9 @@ This method has nothing to do with Switchbot devices. It's just a utility method
|
|
|
414
414
|
|
|
415
415
|
The `SwitchbotDevice` object represents a Switchbot device (Bot, Meter, Curtain, Contact or Motion), which is created through the discovery process triggered by the [`Switchbot.discover()`](#Switchbot-discover-method) method.
|
|
416
416
|
|
|
417
|
-
Actually, the `SwitchbotDevice` object is a super class of the [`
|
|
417
|
+
Actually, the `SwitchbotDevice` object is a super class of the [`WoHand`](#SwitchbotDeviceWoHand-object) and `WoSensorTH` objects. The [`WoHand`](#SwitchbotDeviceWoHand-object) object represents a Bot, the `WoSensorTH` object represents a Meter.
|
|
418
418
|
|
|
419
|
-
You can use the properties and methods described in this section on Bot, Meter, Curtain, Contact and Motion. See the section "[`
|
|
419
|
+
You can use the properties and methods described in this section on Bot, Meter, Curtain, Contact and Motion. See the section "[`WoHand` object](#SwitchbotDeviceWoHand-object)" for the details of the functionalities available only on Bot. For now, `WoSensorTH` object has no additional functionality.
|
|
420
420
|
|
|
421
421
|
### Properties
|
|
422
422
|
|
|
@@ -440,7 +440,7 @@ If no connection is established with the device, this method automatically estab
|
|
|
440
440
|
|
|
441
441
|
If the device name is fetched successfully, the device name will be passed to the `resolve()`.
|
|
442
442
|
|
|
443
|
-
```
|
|
443
|
+
```Typescript
|
|
444
444
|
switchbot
|
|
445
445
|
.discover({ model: "H", quick: true })
|
|
446
446
|
.then((device_list) => {
|
|
@@ -458,7 +458,7 @@ switchbot
|
|
|
458
458
|
|
|
459
459
|
The code above will output the result as follows:
|
|
460
460
|
|
|
461
|
-
```
|
|
461
|
+
```Typescript
|
|
462
462
|
WoHand;
|
|
463
463
|
```
|
|
464
464
|
|
|
@@ -470,7 +470,7 @@ If no connection is established with the device, this method automatically estab
|
|
|
470
470
|
|
|
471
471
|
The character set of the device name saved in the device is UTF-8. The byte length of the name must be less than or equal to 20 bytes. If the name consists of only ASCII characters, up to 20 characters would be allowed. But if the name consists of multibyte characters, the upper limit of characters would be fewer than half. For example, Japanese characters could be saved at most 6 characters because most of Japanese characters consume 3 byte per each character.
|
|
472
472
|
|
|
473
|
-
```
|
|
473
|
+
```Typescript
|
|
474
474
|
switchbot
|
|
475
475
|
.discover({ model: "H", quick: true })
|
|
476
476
|
.then((device_list) => {
|
|
@@ -496,7 +496,7 @@ The connection established using the `connect()` method is not disconnected auto
|
|
|
496
496
|
|
|
497
497
|
The code snippet below establishes a connection with the Bot using the `connect()` method, then puts the Bot's arm down, then waits for 5 seconds, then puts the arm down, finally disconnects the device using the [`disconnect()`](#SwitchbotDevice-disconnect-method) method:
|
|
498
498
|
|
|
499
|
-
```
|
|
499
|
+
```Typescript
|
|
500
500
|
let device = null;
|
|
501
501
|
|
|
502
502
|
switchbot
|
|
@@ -561,7 +561,7 @@ The `onconnect` event handler will be called when the connection with the device
|
|
|
561
561
|
|
|
562
562
|
The code below calls the [`press()`](#SwitchbotDeviceWoHand-press-method) method, while callback functions are attached to the `onconnect` and `ondisconnect`.
|
|
563
563
|
|
|
564
|
-
```
|
|
564
|
+
```Typescript
|
|
565
565
|
switchbot
|
|
566
566
|
.discover({ model: "H", quick: true })
|
|
567
567
|
.then((device_list) => {
|
|
@@ -611,11 +611,11 @@ The `ondisconnect` event handler will be called when the connection with the dev
|
|
|
611
611
|
|
|
612
612
|
---
|
|
613
613
|
|
|
614
|
-
## `
|
|
614
|
+
## `WoHand` object
|
|
615
615
|
|
|
616
|
-
The `
|
|
616
|
+
The `WoHand` object represents a Bot, which is created through the discovery process triggered by the [`Switchbot.discover()`](#Switchbot-discover-method) method.
|
|
617
617
|
|
|
618
|
-
Actually, the `
|
|
618
|
+
Actually, the `WoHand` is an object inherited from the [`SwitchbotDevice`](#SwitchbotDevice-object). You can use not only the method described in this section but also the properties and methods implemented in the [`SwitchbotDevice`](#SwitchbotDevice-object) object.
|
|
619
619
|
|
|
620
620
|
### `press()` method
|
|
621
621
|
|
|
@@ -623,7 +623,7 @@ The `press()` method sends a press command to the Bot. This method returns a `Pr
|
|
|
623
623
|
|
|
624
624
|
If no connection is established with the device, this method automatically establishes a connection with the device, then finally closes the connection. You don't have to call the [`connect()`](#SwitchbotDevice-connect-method) method in advance.
|
|
625
625
|
|
|
626
|
-
```
|
|
626
|
+
```Typescript
|
|
627
627
|
switchbot
|
|
628
628
|
.discover({ model: "H", quick: true })
|
|
629
629
|
.then((device_list) => {
|
|
@@ -653,7 +653,7 @@ When the Bot receives this command, the Bot's arm will be put down (stretched) o
|
|
|
653
653
|
| Switch mode | Disabled | Down (stretched) |
|
|
654
654
|
| | Enabled | Up (retracted) |
|
|
655
655
|
|
|
656
|
-
```
|
|
656
|
+
```Typescript
|
|
657
657
|
switchbot
|
|
658
658
|
.discover({ model: "H", quick: true })
|
|
659
659
|
.then((device_list) => {
|
|
@@ -681,7 +681,7 @@ When the Bot receives this command, the Bot's arm will be put down (stretched) o
|
|
|
681
681
|
| Switch mode | Disabled | Up (retracted) |
|
|
682
682
|
| | Enabled | Down (stretched) |
|
|
683
683
|
|
|
684
|
-
```
|
|
684
|
+
```Typescript
|
|
685
685
|
switchbot
|
|
686
686
|
.discover({ model: "H", quick: true })
|
|
687
687
|
.then((device_list) => {
|
|
@@ -703,7 +703,7 @@ If no connection is established with the device, this method automatically estab
|
|
|
703
703
|
|
|
704
704
|
When the Bot receives this command, the Bot's arm will be put down (stretched) regardless of the mode setting.
|
|
705
705
|
|
|
706
|
-
```
|
|
706
|
+
```Typescript
|
|
707
707
|
switchbot
|
|
708
708
|
.discover({ model: "H", quick: true })
|
|
709
709
|
.then((device_list) => {
|
|
@@ -725,7 +725,7 @@ If no connection is established with the device, this method automatically estab
|
|
|
725
725
|
|
|
726
726
|
When the Bot receives this command, the Bot's arm will be put up (retracted) regardless of the mode setting.
|
|
727
727
|
|
|
728
|
-
```
|
|
728
|
+
```Typescript
|
|
729
729
|
switchbot
|
|
730
730
|
.discover({ model: "H", quick: true })
|
|
731
731
|
.then((device_list) => {
|
|
@@ -741,11 +741,11 @@ switchbot
|
|
|
741
741
|
|
|
742
742
|
---
|
|
743
743
|
|
|
744
|
-
## `
|
|
744
|
+
## `WoCurtain` object
|
|
745
745
|
|
|
746
|
-
The `
|
|
746
|
+
The `WoCurtain` object represents a Curtain, which is created through the discovery process triggered by the [`Switchbot.discover()`](#Switchbot-discover-method) method.
|
|
747
747
|
|
|
748
|
-
Actually, the `
|
|
748
|
+
Actually, the `WoCurtain` is an object inherited from the [`SwitchbotDevice`](#SwitchbotDevice-object). You can use not only the method described in this section but also the properties and methods implemented in the [`SwitchbotDevice`](#SwitchbotDevice-object) object.
|
|
749
749
|
|
|
750
750
|
### `open()` method
|
|
751
751
|
|
|
@@ -757,7 +757,7 @@ When the Curtain receives this command, the Curtain will open the curtain (0% po
|
|
|
757
757
|
|
|
758
758
|
The `open()` method receives an optional `mode` parameter. (See [`runToPos()`](#runtopos-method))
|
|
759
759
|
|
|
760
|
-
```
|
|
760
|
+
```Typescript
|
|
761
761
|
switchbot
|
|
762
762
|
.discover({ model: "c", quick: true })
|
|
763
763
|
.then((device_list) => {
|
|
@@ -781,7 +781,7 @@ When the Curtain receives this command, the Curtain will close the curtain (100%
|
|
|
781
781
|
|
|
782
782
|
The `close()` method receives an optional `mode` parameter. (See [`runToPos()`](#runtopos-method))
|
|
783
783
|
|
|
784
|
-
```
|
|
784
|
+
```Typescript
|
|
785
785
|
switchbot
|
|
786
786
|
.discover({ model: "c", quick: true })
|
|
787
787
|
.then((device_list) => {
|
|
@@ -803,7 +803,7 @@ If no connection is established with the device, this method automatically estab
|
|
|
803
803
|
|
|
804
804
|
When the Curtain receives this command, the Curtain will pause.
|
|
805
805
|
|
|
806
|
-
```
|
|
806
|
+
```Typescript
|
|
807
807
|
switchbot
|
|
808
808
|
.discover({ model: "c", quick: true })
|
|
809
809
|
.then((device_list) => {
|
|
@@ -836,7 +836,7 @@ When the Curtain receives this command, the Curtain will open the curtain (0% po
|
|
|
836
836
|
| `percent` | Integer | Required | The percentage of target position (`0-100`). (e.g., `50`) |
|
|
837
837
|
| `mode` | Integer | Optional | The running mode of Curtain. <br/>`0x00` - Performance mode.<br/> `0x01` - Silent mode. <br/>`0xff` - Default. Unspecified, from Curtain's settings. |
|
|
838
838
|
|
|
839
|
-
```
|
|
839
|
+
```Typescript
|
|
840
840
|
switchbot
|
|
841
841
|
.discover({ model: "c", quick: true })
|
|
842
842
|
.then((device_list) => {
|
|
@@ -851,11 +851,11 @@ switchbot
|
|
|
851
851
|
```
|
|
852
852
|
|
|
853
853
|
---
|
|
854
|
-
## `
|
|
854
|
+
## `WoPlugMini` object
|
|
855
855
|
|
|
856
|
-
The `
|
|
856
|
+
The `WoPlugMini ` object represents a PlugMini, which is created through the discovery process triggered by the [`Switchbot.discover()`](#Switchbot-discover-method) method.
|
|
857
857
|
|
|
858
|
-
Actually, the `
|
|
858
|
+
Actually, the `WoPlugMini ` is an object inherited from the [`SwitchbotDevice`](#SwitchbotDevice-object). You can use not only the method described in this section but also the properties and methods implemented in the [`SwitchbotDevice`](#SwitchbotDevice-object) object.
|
|
859
859
|
|
|
860
860
|
### `turnOn()` method
|
|
861
861
|
|
package/dist/switchbot.d.ts
CHANGED
|
@@ -7,6 +7,7 @@ type params = {
|
|
|
7
7
|
noble?: any;
|
|
8
8
|
};
|
|
9
9
|
export declare class SwitchBot {
|
|
10
|
+
private ready;
|
|
10
11
|
noble: any;
|
|
11
12
|
ondiscover: any;
|
|
12
13
|
onadvertisement: any;
|
|
@@ -17,6 +18,7 @@ export declare class SwitchBot {
|
|
|
17
18
|
static onlog: any;
|
|
18
19
|
static noble: any;
|
|
19
20
|
constructor(params?: params);
|
|
21
|
+
init(params?: params): Promise<void>;
|
|
20
22
|
discover(params?: params): Promise<unknown>;
|
|
21
23
|
_init(): Promise<void>;
|
|
22
24
|
static getDeviceObject(peripheral: any, id: any, model: any): any;
|
package/dist/switchbot.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"switchbot.d.ts","sourceRoot":"","sources":["../src/switchbot.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAa9C,KAAK,MAAM,GAAG;IACV,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,KAAK,CAAC,EAAE,GAAG,CAAC;CACf,CAAA;AAOD,qBAAa,SAAS;IACpB,KAAK,MAAC;IACN,UAAU,MAAC;IACX,eAAe,MAAC;IAChB,KAAK,MAAC;IACN,QAAQ,MAAC;IACT,0BAA0B,MAAC;IAC3B,yBAAyB,MAAC;IAC1B,MAAM,CAAC,KAAK,EAAE,GAAG,CAAC;IAClB,MAAM,CAAC,KAAK,EAAE,GAAG,CAAC;gBAaN,MAAM,
|
|
1
|
+
{"version":3,"file":"switchbot.d.ts","sourceRoot":"","sources":["../src/switchbot.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAa9C,KAAK,MAAM,GAAG;IACV,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,KAAK,CAAC,EAAE,GAAG,CAAC;CACf,CAAA;AAOD,qBAAa,SAAS;IACpB,OAAO,CAAC,KAAK,CAAgB;IAC7B,KAAK,MAAC;IACN,UAAU,MAAC;IACX,eAAe,MAAC;IAChB,KAAK,MAAC;IACN,QAAQ,MAAC;IACT,0BAA0B,MAAC;IAC3B,yBAAyB,MAAC;IAC1B,MAAM,CAAC,KAAK,EAAE,GAAG,CAAC;IAClB,MAAM,CAAC,KAAK,EAAE,GAAG,CAAC;gBAaN,MAAM,CAAC,EAAE,MAAM;IAOrB,IAAI,CAAC,MAAM,CAAC,EAAE,MAAM;IAwD1B,QAAQ,CAAC,MAAM,GAAE,MAAW;IAgHtB,KAAK;IAwCX,MAAM,CAAC,eAAe,CAAC,UAAU,KAAA,EAAE,EAAE,KAAA,EAAE,KAAK,KAAA;IAyD5C,MAAM,CAAC,iBAAiB,CAAC,EAAE,KAAA,EAAE,EAAE,KAAA,EAAE,KAAK,KAAA;IA6EtC,SAAS,CAAC,MAAM,KAAA;IA4FhB,QAAQ;IAgBR,MAAM,CAAC,IAAI,CAAC,IAAI,EAAE,MAAM;CAmBzB;AAED,OAAO,EAAE,eAAe,EAAE,CAAC"}
|
package/dist/switchbot.js
CHANGED
|
@@ -13,6 +13,7 @@ import { WoPlugMini } from './device/woplugmini.js';
|
|
|
13
13
|
import { WoBulb } from './device/wobulb.js';
|
|
14
14
|
import { WoStrip } from './device/wostrip.js';
|
|
15
15
|
export class SwitchBot {
|
|
16
|
+
ready;
|
|
16
17
|
noble;
|
|
17
18
|
ondiscover;
|
|
18
19
|
onadvertisement;
|
|
@@ -32,26 +33,27 @@ export class SwitchBot {
|
|
|
32
33
|
* | | | If you don't specify this parameter, this
|
|
33
34
|
* | | | module automatically creates it.
|
|
34
35
|
* ---------------------------------------------------------------- */
|
|
35
|
-
constructor(params
|
|
36
|
-
// Check parameters
|
|
37
|
-
(async () => {
|
|
38
|
-
let noble;
|
|
39
|
-
if (params && params.noble) {
|
|
40
|
-
noble = params.noble;
|
|
41
|
-
}
|
|
42
|
-
else {
|
|
43
|
-
noble = (await import('@abandonware/noble')).default;
|
|
44
|
-
}
|
|
45
|
-
// Public properties
|
|
46
|
-
this.noble = noble;
|
|
47
|
-
this.ondiscover = null;
|
|
48
|
-
this.onadvertisement = null;
|
|
49
|
-
this.onlog = null;
|
|
50
|
-
// Private properties
|
|
51
|
-
this.scanning = false;
|
|
52
|
-
})();
|
|
36
|
+
constructor(params) {
|
|
53
37
|
this.DEFAULT_DISCOVERY_DURATION = 5000;
|
|
54
38
|
this.PRIMARY_SERVICE_UUID_LIST = [];
|
|
39
|
+
this.ready = this.init(params);
|
|
40
|
+
}
|
|
41
|
+
// Check parameters
|
|
42
|
+
async init(params) {
|
|
43
|
+
let noble;
|
|
44
|
+
if (params && params.noble) {
|
|
45
|
+
noble = params.noble;
|
|
46
|
+
}
|
|
47
|
+
else {
|
|
48
|
+
noble = (await import('@abandonware/noble')).default;
|
|
49
|
+
}
|
|
50
|
+
// Public properties
|
|
51
|
+
this.noble = noble;
|
|
52
|
+
this.ondiscover = null;
|
|
53
|
+
this.onadvertisement = null;
|
|
54
|
+
this.onlog = null;
|
|
55
|
+
// Private properties
|
|
56
|
+
this.scanning = false;
|
|
55
57
|
}
|
|
56
58
|
/* ------------------------------------------------------------------
|
|
57
59
|
* discover([params])
|
|
@@ -186,7 +188,8 @@ export class SwitchBot {
|
|
|
186
188
|
});
|
|
187
189
|
return promise;
|
|
188
190
|
}
|
|
189
|
-
_init() {
|
|
191
|
+
async _init() {
|
|
192
|
+
await this.ready;
|
|
190
193
|
const promise = new Promise((resolve, reject) => {
|
|
191
194
|
let err;
|
|
192
195
|
if (this.noble.state === 'poweredOn') {
|
package/dist/switchbot.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"switchbot.js","sourceRoot":"","sources":["../src/switchbot.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAE9C,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAAE,WAAW,EA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C,KAAK,CAAC,YAAY,EAAE,CAAC;IAC5B,CAAC;IAED;;;;;;;;;;4EAUwE;IACxE,MAAM,CAAC,IAAI,CAAC,IAAY;QACtB,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YACrC,uBAAuB;YACvB,MAAM,KAAK,GAAG,gBAAgB,CAAC,KAAK,CAClC,EAAE,IAAI,EAAE,IAAI,EAAE,EACd;gBACE,IAAI,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,GAAG,EAAE,CAAC,EAAE;aAClD,EACD,EAAE,CACH,CAAC;YAEF,IAAI,CAAC,KAAK,EAAE,CAAC;gBACX,MAAM,CAAC,IAAI,KAAK,CAAC,gBAAgB,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC;gBAClD,OAAO;YACT,CAAC;YACD,cAAc;YACd,UAAU,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;QAC5B,CAAC,CAAC,CAAC;IACL,CAAC;CACF;AAED,OAAO,EAAE,eAAe,EAAE,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "node-switchbot",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.1-beta.1",
|
|
4
4
|
"description": "The node-switchbot is a Node.js module which allows you to control your Switchbot Devices through Bluetooth (BLE).",
|
|
5
5
|
"homepage": "https://github.com/OpenWonderLabs/node-switchbot",
|
|
6
6
|
"author": "OpenWonderLabs (https://github.com/OpenWonderLabs)",
|