node-switchbot 1.1.2 → 1.1.3-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.
@@ -4,8 +4,8 @@ const SwitchbotDevice = require('./switchbot-device.js');
4
4
  class SwitchbotDeviceWoHumi extends SwitchbotDevice {
5
5
 
6
6
  /* ------------------------------------------------------------------
7
- * press()
8
- * - Press
7
+ * Auto()
8
+ * - Set Mode to Auto
9
9
  *
10
10
  * [Arguments]
11
11
  * - none
@@ -14,13 +14,13 @@ class SwitchbotDeviceWoHumi extends SwitchbotDevice {
14
14
  * - Promise object
15
15
  * Nothing will be passed to the `resolve()`.
16
16
  * ---------------------------------------------------------------- */
17
- press() {
18
- return this._operateBot([0x57, 0x01, 0x00]);
17
+ Auto() {
18
+ return this._operateHumi([0x57, 0x01, 0x80]);
19
19
  }
20
20
 
21
21
  /* ------------------------------------------------------------------
22
- * turnOn()
23
- * - Turn on
22
+ * First()
23
+ * - Set Mode to First
24
24
  *
25
25
  * [Arguments]
26
26
  * - none
@@ -29,13 +29,13 @@ class SwitchbotDeviceWoHumi extends SwitchbotDevice {
29
29
  * - Promise object
30
30
  * Nothing will be passed to the `resolve()`.
31
31
  * ---------------------------------------------------------------- */
32
- turnOn() {
33
- return this._operateBot([0x57, 0x01, 0x01]);
32
+ First() {
33
+ return this._operateHumi([0x57, 0x01, 0x65]);
34
34
  }
35
35
 
36
36
  /* ------------------------------------------------------------------
37
- * turnOff()
38
- * - Turn off
37
+ * Second()
38
+ * - Set Mode to Second
39
39
  *
40
40
  * [Arguments]
41
41
  * - none
@@ -44,13 +44,13 @@ class SwitchbotDeviceWoHumi extends SwitchbotDevice {
44
44
  * - Promise object
45
45
  * Nothing will be passed to the `resolve()`.
46
46
  * ---------------------------------------------------------------- */
47
- turnOff() {
48
- return this._operateBot([0x57, 0x01, 0x02]);
47
+ Second() {
48
+ return this._operateHumi([0x57, 0x01, 0x66]);
49
49
  }
50
50
 
51
51
  /* ------------------------------------------------------------------
52
- * down()
53
- * - Down
52
+ * Third()
53
+ * - Set Mode to Third
54
54
  *
55
55
  * [Arguments]
56
56
  * - none
@@ -59,8 +59,8 @@ class SwitchbotDeviceWoHumi extends SwitchbotDevice {
59
59
  * - Promise object
60
60
  * Nothing will be passed to the `resolve()`.
61
61
  * ---------------------------------------------------------------- */
62
- down() {
63
- return this._operateBot([0x57, 0x01, 0x03]);
62
+ Third() {
63
+ return this._operateHumi([0x57, 0x01, 0x67]);
64
64
  }
65
65
 
66
66
  /* ------------------------------------------------------------------
@@ -74,11 +74,26 @@ class SwitchbotDeviceWoHumi extends SwitchbotDevice {
74
74
  * - Promise object
75
75
  * Nothing will be passed to the `resolve()`.
76
76
  * ---------------------------------------------------------------- */
77
- up() {
78
- return this._operateBot([0x57, 0x01, 0x04]);
77
+ percentage() {
78
+ return this._operateHumi([0x57, 0x01, 0x01]);
79
79
  }
80
80
 
81
- _operateBot(bytes) {
81
+ /* ------------------------------------------------------------------
82
+ * turnOff()
83
+ * - Turn off
84
+ *
85
+ * [Arguments]
86
+ * - none
87
+ *
88
+ * [Returen value]
89
+ * - Promise object
90
+ * Nothing will be passed to the `resolve()`.
91
+ * ---------------------------------------------------------------- */
92
+ turnOff() {
93
+ return this._operateHumi([0x57, 0x01, 0x02]);
94
+ }
95
+
96
+ _operateHumi(bytes) {
82
97
  return new Promise((resolve, reject) => {
83
98
  let req_buf = Buffer.from(bytes);
84
99
  this._command(req_buf).then((res_buf) => {
package/package.json CHANGED
@@ -1,42 +1,42 @@
1
1
  {
2
- "name": "node-switchbot",
3
- "version": "1.1.2",
4
- "description": "The node-switchbot is a Node.js module which allows you to move your Switchbot (Bot)'s arm and Switchbot Curtain(Curtain), also monitor the temperature/humidity from SwitchBot Thermometer & Hygrometer (Meter).",
5
- "main": "./lib/switchbot.js",
6
- "files": [
7
- "lib"
8
- ],
9
- "directories": {
10
- "lib": "./lib"
11
- },
12
- "scripts": {
13
- "check": "npm install && npm outdated",
14
- "update": "ncu -u && npm update && npm install"
15
- },
16
- "keywords": [
17
- "switchbot",
18
- "bot",
19
- "meter",
20
- "temperature",
21
- "humidity",
22
- "curtain",
23
- "BLE",
24
- "Bluetooth Low Energy",
25
- "Bluetooth smart",
26
- "Bluetooth"
27
- ],
28
- "homepage": "https://github.com/OpenWonderLabs",
29
- "author": "OpenWonderLabs (https://github.com/OpenWonderLabs)",
30
- "license": "MIT",
31
- "repository": {
32
- "type": "git",
33
- "url": "https://github.com/OpenWonderLabs/node-switchbot.git"
34
- },
35
- "readmeFilename": "README.md",
36
- "dependencies": {
37
- "@abandonware/noble": "^1.9.2-15"
38
- },
39
- "devDependencies": {
40
- "npm-check-updates": "^12.0.2"
41
- }
2
+ "name": "node-switchbot",
3
+ "version": "1.1.3-beta.0",
4
+ "description": "The node-switchbot is a Node.js module which allows you to move your Switchbot (Bot)'s arm and Switchbot Curtain(Curtain), also monitor the temperature/humidity from SwitchBot Thermometer & Hygrometer (Meter).",
5
+ "main": "./lib/switchbot.js",
6
+ "files": [
7
+ "lib"
8
+ ],
9
+ "directories": {
10
+ "lib": "./lib"
11
+ },
12
+ "scripts": {
13
+ "check": "npm install && npm outdated",
14
+ "update": "ncu -u && npm update && npm install"
15
+ },
16
+ "keywords": [
17
+ "switchbot",
18
+ "bot",
19
+ "meter",
20
+ "temperature",
21
+ "humidity",
22
+ "curtain",
23
+ "BLE",
24
+ "Bluetooth Low Energy",
25
+ "Bluetooth smart",
26
+ "Bluetooth"
27
+ ],
28
+ "homepage": "https://github.com/OpenWonderLabs",
29
+ "author": "OpenWonderLabs (https://github.com/OpenWonderLabs)",
30
+ "license": "MIT",
31
+ "repository": {
32
+ "type": "git",
33
+ "url": "https://github.com/OpenWonderLabs/node-switchbot.git"
34
+ },
35
+ "readmeFilename": "README.md",
36
+ "dependencies": {
37
+ "@abandonware/noble": "^1.9.2-15"
38
+ },
39
+ "devDependencies": {
40
+ "npm-check-updates": "^12.0.2"
41
+ }
42
42
  }