node-switchbot 1.10.0 → 2.0.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.
Files changed (94) hide show
  1. package/.gitattributes +2 -0
  2. package/.github/dependabot.yml +17 -0
  3. package/.github/labeler.yml +38 -0
  4. package/.github/npm-version-script.cjs +81 -0
  5. package/.github/workflows/beta-release.yml +31 -0
  6. package/.github/workflows/build.yml +18 -0
  7. package/.github/workflows/changerelease.yml +13 -0
  8. package/.github/workflows/dependabot.yml +17 -0
  9. package/.github/workflows/labeler.yml +16 -0
  10. package/.github/workflows/release-drafter.yml +14 -0
  11. package/.github/workflows/release.yml +24 -0
  12. package/.github/workflows/stale.yml +12 -0
  13. package/CHANGELOG.md +308 -0
  14. package/dist/advertising.d.ts +172 -0
  15. package/dist/advertising.d.ts.map +1 -0
  16. package/dist/advertising.js +620 -0
  17. package/dist/advertising.js.map +1 -0
  18. package/dist/device/woblindtilt.d.ts +9 -0
  19. package/dist/device/woblindtilt.d.ts.map +1 -0
  20. package/dist/device/woblindtilt.js +108 -0
  21. package/dist/device/woblindtilt.js.map +1 -0
  22. package/dist/device/wobulb.d.ts +39 -0
  23. package/dist/device/wobulb.d.ts.map +1 -0
  24. package/dist/device/wobulb.js +156 -0
  25. package/dist/device/wobulb.js.map +1 -0
  26. package/dist/device/wocontact.d.ts +4 -0
  27. package/dist/device/wocontact.d.ts.map +1 -0
  28. package/dist/device/wocontact.js +8 -0
  29. package/dist/device/wocontact.js.map +1 -0
  30. package/dist/device/wocurtain.d.ts +9 -0
  31. package/dist/device/wocurtain.d.ts.map +1 -0
  32. package/dist/device/wocurtain.js +104 -0
  33. package/dist/device/wocurtain.js.map +1 -0
  34. package/dist/device/wohand.d.ts +10 -0
  35. package/dist/device/wohand.d.ts.map +1 -0
  36. package/dist/device/wohand.js +93 -0
  37. package/dist/device/wohand.js.map +1 -0
  38. package/dist/device/wohumi.d.ts +10 -0
  39. package/dist/device/wohumi.d.ts.map +1 -0
  40. package/dist/device/wohumi.js +93 -0
  41. package/dist/device/wohumi.js.map +1 -0
  42. package/dist/device/woiosensorth.d.ts +4 -0
  43. package/dist/device/woiosensorth.d.ts.map +1 -0
  44. package/dist/device/woiosensorth.js +4 -0
  45. package/dist/device/woiosensorth.js.map +1 -0
  46. package/dist/device/woplugmini.d.ts +31 -0
  47. package/dist/device/woplugmini.d.ts.map +1 -0
  48. package/dist/device/woplugmini.js +68 -0
  49. package/dist/device/woplugmini.js.map +1 -0
  50. package/dist/device/wopresence.d.ts +4 -0
  51. package/dist/device/wopresence.d.ts.map +1 -0
  52. package/dist/device/wopresence.js +4 -0
  53. package/dist/device/wopresence.js.map +1 -0
  54. package/dist/device/wosensorth.d.ts +4 -0
  55. package/dist/device/wosensorth.d.ts.map +1 -0
  56. package/dist/device/wosensorth.js +4 -0
  57. package/dist/device/wosensorth.js.map +1 -0
  58. package/dist/device/wostrip.d.ts +39 -0
  59. package/dist/device/wostrip.d.ts.map +1 -0
  60. package/dist/device/wostrip.js +145 -0
  61. package/dist/device/wostrip.js.map +1 -0
  62. package/dist/device.d.ts +46 -0
  63. package/dist/device.d.ts.map +1 -0
  64. package/dist/device.js +498 -0
  65. package/dist/device.js.map +1 -0
  66. package/dist/index.d.ts +2 -0
  67. package/dist/index.d.ts.map +1 -0
  68. package/dist/index.js +6 -0
  69. package/dist/index.js.map +1 -0
  70. package/dist/parameter-checker.d.ts +25 -0
  71. package/dist/parameter-checker.d.ts.map +1 -0
  72. package/dist/parameter-checker.js +488 -0
  73. package/dist/parameter-checker.js.map +1 -0
  74. package/dist/switchbot.d.ts +29 -0
  75. package/dist/switchbot.d.ts.map +1 -0
  76. package/dist/switchbot.js +461 -0
  77. package/dist/switchbot.js.map +1 -0
  78. package/errros.log +13 -0
  79. package/package.json +19 -12
  80. package/lib/parameter-checker.js +0 -524
  81. package/lib/switchbot-advertising.js +0 -713
  82. package/lib/switchbot-device-woblindtilt.js +0 -120
  83. package/lib/switchbot-device-wobulb.js +0 -188
  84. package/lib/switchbot-device-wocontact.js +0 -6
  85. package/lib/switchbot-device-wocurtain.js +0 -117
  86. package/lib/switchbot-device-wohand.js +0 -106
  87. package/lib/switchbot-device-wohumi.js +0 -106
  88. package/lib/switchbot-device-woiosensorth.js +0 -6
  89. package/lib/switchbot-device-woplugmini.js +0 -84
  90. package/lib/switchbot-device-wopresence.js +0 -6
  91. package/lib/switchbot-device-wosensorth.js +0 -6
  92. package/lib/switchbot-device-wostrip.js +0 -182
  93. package/lib/switchbot-device.js +0 -536
  94. package/lib/switchbot.js +0 -496
@@ -0,0 +1,108 @@
1
+ /* Copyright(C) 2024, donavanbecker (https://github.com/donavanbecker). All rights reserved.
2
+ *
3
+ * woblindtilt.ts: Switchbot BLE API registration.
4
+ */
5
+ import { Buffer } from 'buffer';
6
+ import { SwitchbotDevice } from '../switchbot.js';
7
+ export class WoBlindTilt extends SwitchbotDevice {
8
+ /* ------------------------------------------------------------------
9
+ * open()
10
+ * - Open the blindtilt
11
+ *
12
+ * [Arguments]
13
+ * - none
14
+ *
15
+ * [Return value]
16
+ * - Promise object
17
+ * Nothing will be passed to the `resolve()`.
18
+ * ---------------------------------------------------------------- */
19
+ open() {
20
+ return this._operateBlindTilt([0x57, 0x0f, 0x45, 0x01, 0x05, 0xff, 0x00]);
21
+ }
22
+ /* ------------------------------------------------------------------
23
+ * close()
24
+ * - close the blindtilt
25
+ *
26
+ * [Arguments]
27
+ * - none
28
+ *
29
+ * [Return value]
30
+ * - Promise object
31
+ * Nothing will be passed to the `resolve()`.
32
+ * ---------------------------------------------------------------- */
33
+ close() {
34
+ return this._operateBlindTilt([0x57, 0x0f, 0x45, 0x01, 0x05, 0xff, 0x64]);
35
+ }
36
+ /* ------------------------------------------------------------------
37
+ * pause()
38
+ * - pause the blindtilt
39
+ *
40
+ * [Arguments]
41
+ * - none
42
+ *
43
+ * [Return value]
44
+ * - Promise object
45
+ * Nothing will be passed to the `resolve()`.
46
+ * ---------------------------------------------------------------- */
47
+ pause() {
48
+ return this._operateBlindTilt([0x57, 0x0f, 0x45, 0x01, 0x00, 0xff]);
49
+ }
50
+ /* ------------------------------------------------------------------
51
+ * runToPos()
52
+ * - run to the targe position
53
+ *
54
+ * [Arguments]
55
+ * - percent | number | Required | the percentage of target position
56
+ *
57
+ * [Return value]
58
+ * - Promise object
59
+ * Nothing will be passed to the `resolve()`.
60
+ * ---------------------------------------------------------------- */
61
+ runToPos(percent, mode) {
62
+ if (typeof percent !== 'number') {
63
+ return new Promise((resolve, reject) => {
64
+ reject(new Error('The type of target position percentage is incorrent: ' +
65
+ typeof percent));
66
+ });
67
+ }
68
+ if (mode === null) {
69
+ mode = 0xff;
70
+ }
71
+ else {
72
+ if (typeof mode !== 'number') {
73
+ return new Promise((resolve, reject) => {
74
+ reject(new Error('The type of running mode is incorrent: ' + typeof mode));
75
+ });
76
+ }
77
+ if (mode > 1) {
78
+ mode = 0xff;
79
+ }
80
+ }
81
+ if (percent > 100) {
82
+ percent = 100;
83
+ }
84
+ else if (percent < 0) {
85
+ percent = 0;
86
+ }
87
+ return this._operateBlindTilt([0x57, 0x0f, 0x45, 0x01, 0x05, mode, percent]);
88
+ }
89
+ _operateBlindTilt(bytes) {
90
+ return new Promise((resolve, reject) => {
91
+ const req_buf = Buffer.from(bytes);
92
+ this._command(req_buf)
93
+ .then((res_buf) => {
94
+ const code = res_buf.readUInt8(0);
95
+ if (res_buf.length === 3 && code === 0x01) {
96
+ resolve();
97
+ }
98
+ else {
99
+ reject(new Error('The device returned an error: 0x' + res_buf.toString('hex')));
100
+ }
101
+ })
102
+ .catch((error) => {
103
+ reject(error);
104
+ });
105
+ });
106
+ }
107
+ }
108
+ //# sourceMappingURL=woblindtilt.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"woblindtilt.js","sourceRoot":"","sources":["../../src/device/woblindtilt.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAE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* @see https://github.com/OpenWonderLabs/SwitchBotAPI-BLE/blob/latest/devicetypes/colorbulb.md
4
+ */
5
+ export declare class WoBulb extends SwitchbotDevice {
6
+ /**
7
+ * @returns {Promise<boolean>} resolves with a boolean that tells whether the plug in ON(true) or OFF(false)
8
+ */
9
+ readState(): Promise<unknown>;
10
+ /**
11
+ * @private
12
+ */
13
+ _setState(reqByteArray: any): Promise<unknown>;
14
+ /**
15
+ * @returns {Promise<boolean>} resolves with a boolean that tells whether the plug in ON(true) or OFF(false)
16
+ */
17
+ turnOn(): Promise<unknown>;
18
+ /**
19
+ * @returns {Promise<boolean>} resolves with a boolean that tells whether the plug in ON(true) or OFF(false)
20
+ */
21
+ turnOff(): Promise<unknown>;
22
+ /**
23
+ * @returns {Promise<number>} resolves with brightness percent
24
+ */
25
+ setBrightness(brightness: any): Promise<unknown>;
26
+ /**
27
+ * @returns {Promise<number>} resolves with color_temperature percent
28
+ */
29
+ setColorTemperature(color_temperature: any): Promise<unknown>;
30
+ /**
31
+ * @returns {Promise<number>} resolves with brightness percent
32
+ */
33
+ setRGB(brightness: any, red: any, green: any, blue: any): Promise<unknown>;
34
+ /**
35
+ * @private
36
+ */
37
+ _operateBot(bytes: any): Promise<unknown>;
38
+ }
39
+ //# sourceMappingURL=wobulb.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wobulb.d.ts","sourceRoot":"","sources":["../../src/device/wobulb.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAElD;;GAEG;AACH,qBAAa,MAAO,SAAQ,eAAe;IACzC;;OAEG;IACH,SAAS;IAIT;;OAEG;IACH,SAAS,CAAC,YAAY,KAAA;IAKtB;;OAEG;IACH,MAAM;IAIN;;OAEG;IACH,OAAO;IAIP;;OAEG;IACH,aAAa,CAAC,UAAU,KAAA;IAmBxB;;OAEG;IACH,mBAAmB,CAAC,iBAAiB,KAAA;IAmBrC;;OAEG;IACH,MAAM,CAAC,UAAU,KAAA,EAAE,GAAG,KAAA,EAAE,KAAK,KAAA,EAAE,IAAI,KAAA;IAgEnC;;OAEG;IACH,WAAW,CAAC,KAAK,KAAA;CAgClB"}
@@ -0,0 +1,156 @@
1
+ /* Copyright(C) 2024, donavanbecker (https://github.com/donavanbecker). All rights reserved.
2
+ *
3
+ * wobulb.ts: Switchbot BLE API registration.
4
+ */
5
+ import { Buffer } from 'buffer';
6
+ import { SwitchbotDevice } from '../switchbot.js';
7
+ /**
8
+ * @see https://github.com/OpenWonderLabs/SwitchBotAPI-BLE/blob/latest/devicetypes/colorbulb.md
9
+ */
10
+ export class WoBulb extends SwitchbotDevice {
11
+ /**
12
+ * @returns {Promise<boolean>} resolves with a boolean that tells whether the plug in ON(true) or OFF(false)
13
+ */
14
+ readState() {
15
+ return this._operateBot([0x57, 0x0f, 0x48, 0x01]);
16
+ }
17
+ /**
18
+ * @private
19
+ */
20
+ _setState(reqByteArray) {
21
+ const base = [0x57, 0x0f, 0x47, 0x01];
22
+ return this._operateBot(base.concat(reqByteArray));
23
+ }
24
+ /**
25
+ * @returns {Promise<boolean>} resolves with a boolean that tells whether the plug in ON(true) or OFF(false)
26
+ */
27
+ turnOn() {
28
+ return this._setState([0x01, 0x01]);
29
+ }
30
+ /**
31
+ * @returns {Promise<boolean>} resolves with a boolean that tells whether the plug in ON(true) or OFF(false)
32
+ */
33
+ turnOff() {
34
+ return this._setState([0x01, 0x02]);
35
+ }
36
+ /**
37
+ * @returns {Promise<number>} resolves with brightness percent
38
+ */
39
+ setBrightness(brightness) {
40
+ if (typeof brightness !== 'number') {
41
+ return new Promise((resolve, reject) => {
42
+ reject(new Error('The type of target brightness percentage is incorrent: ' +
43
+ typeof brightness));
44
+ });
45
+ }
46
+ if (brightness > 100) {
47
+ brightness = 100;
48
+ }
49
+ else if (brightness < 0) {
50
+ brightness = 0;
51
+ }
52
+ return this._setState([0x02, 0x14]);
53
+ }
54
+ /**
55
+ * @returns {Promise<number>} resolves with color_temperature percent
56
+ */
57
+ setColorTemperature(color_temperature) {
58
+ if (typeof color_temperature !== 'number') {
59
+ return new Promise((resolve, reject) => {
60
+ reject(new Error('The type of target color_temperature percentage is incorrent: ' +
61
+ typeof color_temperature));
62
+ });
63
+ }
64
+ if (color_temperature > 100) {
65
+ color_temperature = 100;
66
+ }
67
+ else if (color_temperature < 0) {
68
+ color_temperature = 0;
69
+ }
70
+ return this._setState([0x02, 0x17, color_temperature]);
71
+ }
72
+ /**
73
+ * @returns {Promise<number>} resolves with brightness percent
74
+ */
75
+ setRGB(brightness, red, green, blue) {
76
+ if (typeof brightness !== 'number') {
77
+ return new Promise((resolve, reject) => {
78
+ reject(new Error('The type of target brightness percentage is incorrent: ' +
79
+ typeof brightness));
80
+ });
81
+ }
82
+ if (typeof red !== 'number') {
83
+ return new Promise((resolve, reject) => {
84
+ reject(new Error('The type of target red is incorrent: ' +
85
+ typeof red));
86
+ });
87
+ }
88
+ if (typeof green !== 'number') {
89
+ return new Promise((resolve, reject) => {
90
+ reject(new Error('The type of target green is incorrent: ' +
91
+ typeof green));
92
+ });
93
+ }
94
+ if (typeof blue !== 'number') {
95
+ return new Promise((resolve, reject) => {
96
+ reject(new Error('The type of target blue is incorrent: ' +
97
+ typeof blue));
98
+ });
99
+ }
100
+ if (brightness > 100) {
101
+ brightness = 100;
102
+ }
103
+ else if (brightness < 0) {
104
+ brightness = 0;
105
+ }
106
+ if (red > 255) {
107
+ red = 255;
108
+ }
109
+ else if (red < 0) {
110
+ red = 0;
111
+ }
112
+ if (green > 255) {
113
+ green = 255;
114
+ }
115
+ else if (green < 0) {
116
+ green = 0;
117
+ }
118
+ if (blue > 255) {
119
+ blue = 255;
120
+ }
121
+ else if (blue < 0) {
122
+ blue = 0;
123
+ }
124
+ return this._setState([0x02, 0x12, brightness, red, green, blue]);
125
+ }
126
+ /**
127
+ * @private
128
+ */
129
+ _operateBot(bytes) {
130
+ const req_buf = Buffer.from(bytes);
131
+ return new Promise((resolve, reject) => {
132
+ this._command(req_buf)
133
+ .then((res_bytes) => {
134
+ const res_buf = Buffer.from(res_bytes);
135
+ if (res_buf.length === 2) {
136
+ const code = res_buf.readUInt8(1);
137
+ if (code === 0x00 || code === 0x80) {
138
+ const is_on = code === 0x80;
139
+ resolve(is_on);
140
+ }
141
+ else {
142
+ reject(new Error('The device returned an error: 0x' + res_buf.toString('hex')));
143
+ }
144
+ }
145
+ else {
146
+ reject(new Error('Expecting a 2-byte response, got instead: 0x' +
147
+ res_buf.toString('hex')));
148
+ }
149
+ })
150
+ .catch((error) => {
151
+ reject(error);
152
+ });
153
+ });
154
+ }
155
+ }
156
+ //# sourceMappingURL=wobulb.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wobulb.js","sourceRoot":"","sources":["../../src/device/wobulb.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAEhC,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAElD;;GAEG;AACH,MAAM,OAAO,MAAO,SAAQ,eAAe;IACzC;;OAEG;IACH,SAAS;QACP,OAAO,IAAI,CAAC,WAAW,CAAC,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC;IACpD,CAAC;IAED;;OAEG;IACH,SAAS,CAAC,YAAY;QACpB,MAAM,IAAI,GAAG,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;QACtC,OAAO,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC,CAAC;IACrD,CAAC;IAED;;OAEG;IACH,MAAM;QACJ,OAAO,IAAI,CAAC,SAAS,CAAC,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC;IACtC,CAAC;IAED;;OAEG;IACH,OAAO;QACL,OAAO,IAAI,CAAC,SAAS,CAAC,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC;IACtC,C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BAC5C,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,CAC1B,CACF,CAAC;gBACJ,CAAC;YACH,CAAC,CAAC;iBACD,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;gBACf,MAAM,CAAC,KAAK,CAAC,CAAC;YAChB,CAAC,CAAC,CAAC;QACP,CAAC,CAAC,CAAC;IACL,CAAC;CACF"}
@@ -0,0 +1,4 @@
1
+ import { SwitchbotDevice } from '../switchbot.js';
2
+ export declare class WoContact extends SwitchbotDevice {
3
+ }
4
+ //# sourceMappingURL=wocontact.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wocontact.d.ts","sourceRoot":"","sources":["../../src/device/wocontact.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAElD,qBAAa,SAAU,SAAQ,eAAe;CAAG"}
@@ -0,0 +1,8 @@
1
+ /* Copyright(C) 2024, donavanbecker (https://github.com/donavanbecker). All rights reserved.
2
+ *
3
+ * wocontact.ts: Switchbot BLE API registration.
4
+ */
5
+ import { SwitchbotDevice } from '../switchbot.js';
6
+ export class WoContact extends SwitchbotDevice {
7
+ }
8
+ //# sourceMappingURL=wocontact.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wocontact.js","sourceRoot":"","sources":["../../src/device/wocontact.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAElD,MAAM,OAAO,SAAU,SAAQ,eAAe;CAAG"}
@@ -0,0 +1,9 @@
1
+ import { SwitchbotDevice } from '../switchbot.js';
2
+ export declare class WoCurtain extends SwitchbotDevice {
3
+ open(mode: any): Promise<unknown>;
4
+ close(mode: any): Promise<unknown>;
5
+ pause(): Promise<void>;
6
+ runToPos(percent: any, mode?: number): Promise<unknown>;
7
+ _operateCurtain(bytes: any): Promise<void>;
8
+ }
9
+ //# sourceMappingURL=wocurtain.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wocurtain.d.ts","sourceRoot":"","sources":["../../src/device/wocurtain.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAElD,qBAAa,SAAU,SAAQ,eAAe;IAY5C,IAAI,CAAC,IAAI,KAAA;IAeT,KAAK,CAAC,IAAI,KAAA;IAeV,KAAK;IAgBL,QAAQ,CAAC,OAAO,KAAA,EAAE,IAAI,SAAO;IA6B7B,eAAe,CAAC,KAAK,KAAA;CAqBtB"}
@@ -0,0 +1,104 @@
1
+ /* Copyright(C) 2024, donavanbecker (https://github.com/donavanbecker). All rights reserved.
2
+ *
3
+ * wocurtain.ts: Switchbot BLE API registration.
4
+ */
5
+ import { Buffer } from 'buffer';
6
+ import { SwitchbotDevice } from '../switchbot.js';
7
+ export class WoCurtain extends SwitchbotDevice {
8
+ /* ------------------------------------------------------------------
9
+ * open()
10
+ * - Open the curtain
11
+ *
12
+ * [Arguments]
13
+ * - mode | number | Opetional | runing mode (0x01 = QuietDrift, 0xff = Default)
14
+ *
15
+ * [Return value]
16
+ * - Promise object
17
+ * Nothing will be passed to the `resolve()`.
18
+ * ---------------------------------------------------------------- */
19
+ open(mode) {
20
+ return this.runToPos(0, mode);
21
+ }
22
+ /* ------------------------------------------------------------------
23
+ * close()
24
+ * - close the curtain
25
+ *
26
+ * [Arguments]
27
+ * - mode | number | Opetional | runing mode (0x01 = QuietDrift, 0xff = Default)
28
+ *
29
+ * [Return value]
30
+ * - Promise object
31
+ * Nothing will be passed to the `resolve()`.
32
+ * ---------------------------------------------------------------- */
33
+ close(mode) {
34
+ return this.runToPos(100, mode);
35
+ }
36
+ /* ------------------------------------------------------------------
37
+ * pause()
38
+ * - pause the curtain
39
+ *
40
+ * [Arguments]
41
+ * - none
42
+ *
43
+ * [Return value]
44
+ * - Promise object
45
+ * Nothing will be passed to the `resolve()`.
46
+ * ---------------------------------------------------------------- */
47
+ pause() {
48
+ return this._operateCurtain([0x57, 0x0f, 0x45, 0x01, 0x00, 0xff]);
49
+ }
50
+ /* ------------------------------------------------------------------
51
+ * runToPos()
52
+ * - run to the target position
53
+ *
54
+ * [Arguments]
55
+ * - percent | number | Required | the percentage of target position
56
+ * - mode | number | Opetional | runing mode (0x01 = QuietDrift, 0xff = Default)
57
+ *
58
+ * [Return value]
59
+ * - Promise object
60
+ * Nothing will be passed to the `resolve()`.
61
+ * ---------------------------------------------------------------- */
62
+ runToPos(percent, mode = 0xff) {
63
+ if (typeof percent !== 'number') {
64
+ return new Promise((resolve, reject) => {
65
+ reject(new Error('The type of target position percentage is incorrect: ' +
66
+ typeof percent));
67
+ });
68
+ }
69
+ if (typeof mode !== 'number') {
70
+ return new Promise((resolve, reject) => {
71
+ reject(new Error('The type of running mode is incorrect: ' + typeof mode));
72
+ });
73
+ }
74
+ if (mode > 1) {
75
+ mode = 0xff;
76
+ }
77
+ if (percent > 100) {
78
+ percent = 100;
79
+ }
80
+ else if (percent < 0) {
81
+ percent = 0;
82
+ }
83
+ return this._operateCurtain([0x57, 0x0f, 0x45, 0x01, 0x05, mode, percent]);
84
+ }
85
+ _operateCurtain(bytes) {
86
+ return new Promise((resolve, reject) => {
87
+ const req_buf = Buffer.from(bytes);
88
+ this._command(req_buf)
89
+ .then((res_buf) => {
90
+ const code = res_buf.readUInt8(0);
91
+ if (res_buf.length === 3 && code === 0x01) {
92
+ resolve();
93
+ }
94
+ else {
95
+ reject(new Error('The device returned an error: 0x' + res_buf.toString('hex')));
96
+ }
97
+ })
98
+ .catch((error) => {
99
+ reject(error);
100
+ });
101
+ });
102
+ }
103
+ }
104
+ //# sourceMappingURL=wocurtain.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wocurtain.js","sourceRoot":"","sources":["../../src/device/wocurtain.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAEhC,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AA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CAAC;QACd,CAAC;QACD,OAAO,IAAI,CAAC,eAAe,CAAC,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC,CAAC;IAC7E,CAAC;IAED,eAAe,CAAC,KAAK;QACnB,OAAO,IAAI,OAAO,CAAO,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YAC3C,MAAM,OAAO,GAAG,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;YACnC,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC;iBACnB,IAAI,CAAC,CAAC,OAAgB,EAAE,EAAE;gBACzB,MAAM,IAAI,GAAI,OAAkB,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;gBAC9C,IAAK,OAAkB,CAAC,MAAM,KAAK,CAAC,IAAI,IAAI,KAAK,IAAI,EAAE,CAAC;oBACtD,OAAO,EAAE,CAAC;gBACZ,CAAC;qBAAM,CAAC;oBACN,MAAM,CACJ,IAAI,KAAK,CACP,kCAAkC,GAAI,OAAkB,CAAC,QAAQ,CAAC,KAAK,CAAC,CACzE,CACF,CAAC;gBACJ,CAAC;YACH,CAAC,CAAC;iBACD,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;gBACf,MAAM,CAAC,KAAK,CAAC,CAAC;YAChB,CAAC,CAAC,CAAC;QACP,CAAC,CAAC,CAAC;IACL,CAAC;CACF"}
@@ -0,0 +1,10 @@
1
+ import { SwitchbotDevice } from '../switchbot.js';
2
+ export declare class WoHand extends SwitchbotDevice {
3
+ press(): Promise<void>;
4
+ turnOn(): Promise<void>;
5
+ turnOff(): Promise<void>;
6
+ down(): Promise<void>;
7
+ up(): Promise<void>;
8
+ _operateBot(bytes: any): Promise<void>;
9
+ }
10
+ //# sourceMappingURL=wohand.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wohand.d.ts","sourceRoot":"","sources":["../../src/device/wohand.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAElD,qBAAa,MAAO,SAAQ,eAAe;IAYzC,KAAK;IAeL,MAAM;IAeN,OAAO;IAeP,IAAI;IAeJ,EAAE;IAIF,WAAW,CAAC,KAAK,KAAA;CAqBlB"}
@@ -0,0 +1,93 @@
1
+ import { Buffer } from 'buffer';
2
+ import { SwitchbotDevice } from '../switchbot.js';
3
+ export class WoHand extends SwitchbotDevice {
4
+ /* ------------------------------------------------------------------
5
+ * press()
6
+ * - Press
7
+ *
8
+ * [Arguments]
9
+ * - none
10
+ *
11
+ * [Return value]
12
+ * - Promise object
13
+ * Nothing will be passed to the `resolve()`.
14
+ * ---------------------------------------------------------------- */
15
+ press() {
16
+ return this._operateBot([0x57, 0x01, 0x00]);
17
+ }
18
+ /* ------------------------------------------------------------------
19
+ * turnOn()
20
+ * - Turn on
21
+ *
22
+ * [Arguments]
23
+ * - none
24
+ *
25
+ * [Return value]
26
+ * - Promise object
27
+ * Nothing will be passed to the `resolve()`.
28
+ * ---------------------------------------------------------------- */
29
+ turnOn() {
30
+ return this._operateBot([0x57, 0x01, 0x01]);
31
+ }
32
+ /* ------------------------------------------------------------------
33
+ * turnOff()
34
+ * - Turn off
35
+ *
36
+ * [Arguments]
37
+ * - none
38
+ *
39
+ * [Return value]
40
+ * - Promise object
41
+ * Nothing will be passed to the `resolve()`.
42
+ * ---------------------------------------------------------------- */
43
+ turnOff() {
44
+ return this._operateBot([0x57, 0x01, 0x02]);
45
+ }
46
+ /* ------------------------------------------------------------------
47
+ * down()
48
+ * - Down
49
+ *
50
+ * [Arguments]
51
+ * - none
52
+ *
53
+ * [Return value]
54
+ * - Promise object
55
+ * Nothing will be passed to the `resolve()`.
56
+ * ---------------------------------------------------------------- */
57
+ down() {
58
+ return this._operateBot([0x57, 0x01, 0x03]);
59
+ }
60
+ /* ------------------------------------------------------------------
61
+ * up()
62
+ * - Up
63
+ *
64
+ * [Arguments]
65
+ * - none
66
+ *
67
+ * [Return value]
68
+ * - Promise object
69
+ * Nothing will be passed to the `resolve()`.
70
+ * ---------------------------------------------------------------- */
71
+ up() {
72
+ return this._operateBot([0x57, 0x01, 0x04]);
73
+ }
74
+ _operateBot(bytes) {
75
+ return new Promise((resolve, reject) => {
76
+ const req_buf = Buffer.from(bytes);
77
+ this._command(req_buf)
78
+ .then((res_buf) => {
79
+ const code = res_buf.readUInt8(0);
80
+ if (res_buf.length === 3 && (code === 0x01 || code === 0x05)) {
81
+ resolve();
82
+ }
83
+ else {
84
+ reject(new Error('The device returned an error: 0x' + res_buf.toString('hex')));
85
+ }
86
+ })
87
+ .catch((error) => {
88
+ reject(error);
89
+ });
90
+ });
91
+ }
92
+ }
93
+ //# sourceMappingURL=wohand.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wohand.js","sourceRoot":"","sources":["../../src/device/wohand.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAEhC,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAElD,MAAM,OAAO,MAAO,SAAQ,eAAe;IACzC;;;;;;;;;;0EAUsE;IACtE,KAAK;QACH,OAAO,IAAI,CAAC,WAAW,CAAC,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC;IAC9C,CAAC;IAED;;;;;;;;;;0EAUsE;IACtE,MAAM;QACJ,OAAO,IAAI,CAAC,WAAW,CAAC,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC;IAC9C,CAAC;IAED;;;;;;;;;;0EAUsE;IACtE,OAAO;QACL,OAAO,IAAI,CAAC,WAAW,CAAC,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC;IAC9C,CAAC;IAED;;;;;;;;;;0EAUsE;IACtE,IAAI;QACF,OAAO,IAAI,CAAC,WAAW,CAAC,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC;IAC9C,CAAC;IAED;;;;;;;;;;0EAUsE;IACtE,EAAE;QACA,OAAO,IAAI,CAAC,WAAW,CAAC,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC;IAC9C,CAAC;IAED,WAAW,CAAC,KAAK;QACf,OAAO,IAAI,OAAO,CAAO,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YAC3C,MAAM,OAAO,GAAG,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;YACnC,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC;iBACnB,IAAI,CAAC,CAAC,OAAgB,EAAE,EAAE;gBACzB,MAAM,IAAI,GAAI,OAAkB,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;gBAC9C,IAAK,OAAkB,CAAC,MAAM,KAAK,CAAC,IAAI,CAAC,IAAI,KAAK,IAAI,IAAI,IAAI,KAAK,IAAI,CAAC,EAAE,CAAC;oBACzE,OAAO,EAAE,CAAC;gBACZ,CAAC;qBAAM,CAAC;oBACN,MAAM,CACJ,IAAI,KAAK,CACP,kCAAkC,GAAI,OAAkB,CAAC,QAAQ,CAAC,KAAK,CAAC,CACzE,CACF,CAAC;gBACJ,CAAC;YACH,CAAC,CAAC;iBACD,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;gBACf,MAAM,CAAC,KAAK,CAAC,CAAC;YAChB,CAAC,CAAC,CAAC;QACP,CAAC,CAAC,CAAC;IACL,CAAC;CACF"}
@@ -0,0 +1,10 @@
1
+ import { SwitchbotDevice } from '../switchbot.js';
2
+ export declare class WoHumi extends SwitchbotDevice {
3
+ press(): Promise<void>;
4
+ turnOn(): Promise<void>;
5
+ turnOff(): Promise<void>;
6
+ down(): Promise<void>;
7
+ up(): Promise<void>;
8
+ _operateBot(bytes: any): Promise<void>;
9
+ }
10
+ //# sourceMappingURL=wohumi.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wohumi.d.ts","sourceRoot":"","sources":["../../src/device/wohumi.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAElD,qBAAa,MAAO,SAAQ,eAAe;IAYzC,KAAK;IAeL,MAAM;IAeN,OAAO;IAeP,IAAI;IAeJ,EAAE;IAIF,WAAW,CAAC,KAAK,KAAA;CAqBlB"}