@switchbot/homebridge-switchbot 2.0.1-beta.0 → 2.1.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 +11 -0
- package/config.schema.json +2 -2
- package/dist/irdevice/airconditioner.d.ts.map +1 -1
- package/dist/irdevice/airconditioner.js.map +1 -1
- package/dist/irdevice/airpurifier.d.ts +3 -0
- package/dist/irdevice/airpurifier.d.ts.map +1 -1
- package/dist/irdevice/airpurifier.js +38 -4
- package/dist/irdevice/airpurifier.js.map +1 -1
- package/dist/irdevice/camera.d.ts +3 -0
- package/dist/irdevice/camera.d.ts.map +1 -1
- package/dist/irdevice/camera.js +38 -4
- package/dist/irdevice/camera.js.map +1 -1
- package/dist/irdevice/fan.d.ts +3 -0
- package/dist/irdevice/fan.d.ts.map +1 -1
- package/dist/irdevice/fan.js +38 -4
- package/dist/irdevice/fan.js.map +1 -1
- package/dist/irdevice/light.d.ts +3 -0
- package/dist/irdevice/light.d.ts.map +1 -1
- package/dist/irdevice/light.js +38 -4
- package/dist/irdevice/light.js.map +1 -1
- package/dist/irdevice/other.d.ts +3 -0
- package/dist/irdevice/other.d.ts.map +1 -1
- package/dist/irdevice/other.js +50 -36
- package/dist/irdevice/other.js.map +1 -1
- package/dist/irdevice/tv.d.ts +3 -0
- package/dist/irdevice/tv.d.ts.map +1 -1
- package/dist/irdevice/tv.js +38 -4
- package/dist/irdevice/tv.js.map +1 -1
- package/dist/irdevice/vacuumcleaner.d.ts +3 -0
- package/dist/irdevice/vacuumcleaner.d.ts.map +1 -1
- package/dist/irdevice/vacuumcleaner.js +38 -4
- package/dist/irdevice/vacuumcleaner.js.map +1 -1
- package/dist/irdevice/waterheater.d.ts +3 -0
- package/dist/irdevice/waterheater.d.ts.map +1 -1
- package/dist/irdevice/waterheater.js +38 -4
- package/dist/irdevice/waterheater.js.map +1 -1
- package/dist/settings.d.ts +0 -2
- package/dist/settings.d.ts.map +1 -1
- package/dist/settings.js.map +1 -1
- package/package.json +1 -1
- package/src/irdevice/airconditioner.ts +0 -2
- package/src/irdevice/airpurifier.ts +38 -4
- package/src/irdevice/camera.ts +38 -4
- package/src/irdevice/fan.ts +38 -4
- package/src/irdevice/light.ts +38 -4
- package/src/irdevice/other.ts +50 -32
- package/src/irdevice/tv.ts +38 -4
- package/src/irdevice/vacuumcleaner.ts +38 -4
- package/src/irdevice/waterheater.ts +38 -4
- package/src/settings.ts +0 -2
package/src/irdevice/fan.ts
CHANGED
|
@@ -167,20 +167,24 @@ export class Fan {
|
|
|
167
167
|
*/
|
|
168
168
|
async pushFanOnChanges(): Promise<void> {
|
|
169
169
|
if (this.Active !== 1) {
|
|
170
|
+
const commandType: string = await this.commandType();
|
|
171
|
+
const command: string = await this.commandOn();
|
|
170
172
|
const body = superStringify({
|
|
171
|
-
'command':
|
|
173
|
+
'command': command,
|
|
172
174
|
'parameter': 'default',
|
|
173
|
-
'commandType':
|
|
175
|
+
'commandType': commandType,
|
|
174
176
|
});
|
|
175
177
|
await this.pushTVChanges(body);
|
|
176
178
|
}
|
|
177
179
|
}
|
|
178
180
|
|
|
179
181
|
async pushFanOffChanges(): Promise<void> {
|
|
182
|
+
const commandType: string = await this.commandType();
|
|
183
|
+
const command: string = await this.commandOff();
|
|
180
184
|
const body = superStringify({
|
|
181
|
-
'command':
|
|
185
|
+
'command': command,
|
|
182
186
|
'parameter': 'default',
|
|
183
|
-
'commandType':
|
|
187
|
+
'commandType': commandType,
|
|
184
188
|
});
|
|
185
189
|
await this.pushTVChanges(body);
|
|
186
190
|
}
|
|
@@ -289,6 +293,36 @@ export class Fan {
|
|
|
289
293
|
}
|
|
290
294
|
}
|
|
291
295
|
|
|
296
|
+
async commandType() {
|
|
297
|
+
let commandType: string;
|
|
298
|
+
if (this.device.customize) {
|
|
299
|
+
commandType = 'customize';
|
|
300
|
+
} else {
|
|
301
|
+
commandType = 'command';
|
|
302
|
+
}
|
|
303
|
+
return commandType;
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
async commandOn() {
|
|
307
|
+
let command: string;
|
|
308
|
+
if (this.device.customize && this.device.customOn) {
|
|
309
|
+
command = this.device.customOn;
|
|
310
|
+
} else {
|
|
311
|
+
command = 'turnOn';
|
|
312
|
+
}
|
|
313
|
+
return command;
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
async commandOff() {
|
|
317
|
+
let command: string;
|
|
318
|
+
if (this.device.customize && this.device.customOn) {
|
|
319
|
+
command = this.device.customOn;
|
|
320
|
+
} else {
|
|
321
|
+
command = 'turnOff';
|
|
322
|
+
}
|
|
323
|
+
return command;
|
|
324
|
+
}
|
|
325
|
+
|
|
292
326
|
async statusCode({ res }: { res: IncomingMessage }): Promise<void> {
|
|
293
327
|
switch (res.statusCode) {
|
|
294
328
|
case 151:
|
package/src/irdevice/light.ts
CHANGED
|
@@ -77,10 +77,12 @@ export class Light {
|
|
|
77
77
|
*/
|
|
78
78
|
async pushLightOnChanges(): Promise<void> {
|
|
79
79
|
if (this.On) {
|
|
80
|
+
const commandType: string = await this.commandType();
|
|
81
|
+
const command: string = await this.commandOn();
|
|
80
82
|
const body = superStringify({
|
|
81
|
-
'command':
|
|
83
|
+
'command': command,
|
|
82
84
|
'parameter': 'default',
|
|
83
|
-
'commandType':
|
|
85
|
+
'commandType': commandType,
|
|
84
86
|
});
|
|
85
87
|
await this.pushChanges(body);
|
|
86
88
|
}
|
|
@@ -88,10 +90,12 @@ export class Light {
|
|
|
88
90
|
|
|
89
91
|
async pushLightOffChanges(): Promise<void> {
|
|
90
92
|
if (!this.On) {
|
|
93
|
+
const commandType: string = await this.commandType();
|
|
94
|
+
const command: string = await this.commandOff();
|
|
91
95
|
const body = superStringify({
|
|
92
|
-
'command':
|
|
96
|
+
'command': command,
|
|
93
97
|
'parameter': 'default',
|
|
94
|
-
'commandType':
|
|
98
|
+
'commandType': commandType,
|
|
95
99
|
});
|
|
96
100
|
await this.pushChanges(body);
|
|
97
101
|
}
|
|
@@ -179,6 +183,36 @@ export class Light {
|
|
|
179
183
|
}
|
|
180
184
|
}
|
|
181
185
|
|
|
186
|
+
async commandType() {
|
|
187
|
+
let commandType: string;
|
|
188
|
+
if (this.device.customize) {
|
|
189
|
+
commandType = 'customize';
|
|
190
|
+
} else {
|
|
191
|
+
commandType = 'command';
|
|
192
|
+
}
|
|
193
|
+
return commandType;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
async commandOn() {
|
|
197
|
+
let command: string;
|
|
198
|
+
if (this.device.customize && this.device.customOn) {
|
|
199
|
+
command = this.device.customOn;
|
|
200
|
+
} else {
|
|
201
|
+
command = 'turnOn';
|
|
202
|
+
}
|
|
203
|
+
return command;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
async commandOff() {
|
|
207
|
+
let command: string;
|
|
208
|
+
if (this.device.customize && this.device.customOn) {
|
|
209
|
+
command = this.device.customOn;
|
|
210
|
+
} else {
|
|
211
|
+
command = 'turnOff';
|
|
212
|
+
}
|
|
213
|
+
return command;
|
|
214
|
+
}
|
|
215
|
+
|
|
182
216
|
async statusCode({ res }: { res: IncomingMessage }): Promise<void> {
|
|
183
217
|
switch (res.statusCode) {
|
|
184
218
|
case 151:
|
package/src/irdevice/other.ts
CHANGED
|
@@ -84,22 +84,16 @@ export class Others {
|
|
|
84
84
|
* Other - "command" "channelSub" "default" = previous channel
|
|
85
85
|
*/
|
|
86
86
|
async pushOnChanges(): Promise<void> {
|
|
87
|
-
if (this.
|
|
88
|
-
if (this.
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
}
|
|
98
|
-
} else {
|
|
99
|
-
this.errorLog(`${this.device.remoteType}: ${this.accessory.displayName} On Command not set, commandOn: ${this.device.other.commandOn}`);
|
|
100
|
-
}
|
|
101
|
-
} else {
|
|
102
|
-
this.errorLog(`${this.device.remoteType}: ${this.accessory.displayName} On Command not set, other: ${this.device.other}`);
|
|
87
|
+
if (this.device.customize) {
|
|
88
|
+
if (!this.Active) {
|
|
89
|
+
const commandType: string = await this.commandType();
|
|
90
|
+
const command: string = await this.commandOn();
|
|
91
|
+
const body = superStringify({
|
|
92
|
+
'command': command,
|
|
93
|
+
'parameter': 'default',
|
|
94
|
+
'commandType': commandType,
|
|
95
|
+
});
|
|
96
|
+
await this.pushChanges(body);
|
|
103
97
|
}
|
|
104
98
|
} else {
|
|
105
99
|
this.errorLog(`${this.device.remoteType}: ${this.accessory.displayName} On Command not set`);
|
|
@@ -107,22 +101,16 @@ export class Others {
|
|
|
107
101
|
}
|
|
108
102
|
|
|
109
103
|
async pushOffChanges(): Promise<void> {
|
|
110
|
-
if (this.
|
|
111
|
-
if (this.
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
}
|
|
121
|
-
} else {
|
|
122
|
-
this.errorLog(`${this.device.remoteType}: ${this.accessory.displayName} Off Command not set, commandOff: ${this.device.other.commandOff}`);
|
|
123
|
-
}
|
|
124
|
-
} else {
|
|
125
|
-
this.errorLog(`${this.device.remoteType}: ${this.accessory.displayName} Off Command not set, other: ${this.device.other}`);
|
|
104
|
+
if (this.device.customize) {
|
|
105
|
+
if (this.Active) {
|
|
106
|
+
const commandType: string = await this.commandType();
|
|
107
|
+
const command: string = await this.commandOff();
|
|
108
|
+
const body = superStringify({
|
|
109
|
+
'command': command,
|
|
110
|
+
'parameter': 'default',
|
|
111
|
+
'commandType': commandType,
|
|
112
|
+
});
|
|
113
|
+
await this.pushChanges(body);
|
|
126
114
|
}
|
|
127
115
|
} else {
|
|
128
116
|
this.errorLog(`${this.device.remoteType}: ${this.accessory.displayName} Off Command not set.`);
|
|
@@ -191,6 +179,36 @@ export class Others {
|
|
|
191
179
|
}
|
|
192
180
|
}
|
|
193
181
|
|
|
182
|
+
async commandType() {
|
|
183
|
+
let commandType: string;
|
|
184
|
+
if (this.device.customize) {
|
|
185
|
+
commandType = 'customize';
|
|
186
|
+
} else {
|
|
187
|
+
commandType = 'command';
|
|
188
|
+
}
|
|
189
|
+
return commandType;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
async commandOn() {
|
|
193
|
+
let command: string;
|
|
194
|
+
if (this.device.customize && this.device.customOn) {
|
|
195
|
+
command = this.device.customOn;
|
|
196
|
+
} else {
|
|
197
|
+
command = 'turnOn';
|
|
198
|
+
}
|
|
199
|
+
return command;
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
async commandOff() {
|
|
203
|
+
let command: string;
|
|
204
|
+
if (this.device.customize && this.device.customOn) {
|
|
205
|
+
command = this.device.customOn;
|
|
206
|
+
} else {
|
|
207
|
+
command = 'turnOff';
|
|
208
|
+
}
|
|
209
|
+
return command;
|
|
210
|
+
}
|
|
211
|
+
|
|
194
212
|
async statusCode({ res }: { res: IncomingMessage }): Promise<void> {
|
|
195
213
|
switch (res.statusCode) {
|
|
196
214
|
case 151:
|
package/src/irdevice/tv.ts
CHANGED
|
@@ -221,20 +221,24 @@ export class TV {
|
|
|
221
221
|
*/
|
|
222
222
|
async pushTvOnChanges(): Promise<void> {
|
|
223
223
|
if (this.Active !== 1) {
|
|
224
|
+
const commandType: string = await this.commandType();
|
|
225
|
+
const command: string = await this.commandOn();
|
|
224
226
|
const body = superStringify({
|
|
225
|
-
'command':
|
|
227
|
+
'command': command,
|
|
226
228
|
'parameter': 'default',
|
|
227
|
-
'commandType':
|
|
229
|
+
'commandType': commandType,
|
|
228
230
|
});
|
|
229
231
|
await this.pushTVChanges(body);
|
|
230
232
|
}
|
|
231
233
|
}
|
|
232
234
|
|
|
233
235
|
async pushTvOffChanges(): Promise<void> {
|
|
236
|
+
const commandType: string = await this.commandType();
|
|
237
|
+
const command: string = await this.commandOff();
|
|
234
238
|
const body = superStringify({
|
|
235
|
-
'command':
|
|
239
|
+
'command': command,
|
|
236
240
|
'parameter': 'default',
|
|
237
|
-
'commandType':
|
|
241
|
+
'commandType': commandType,
|
|
238
242
|
});
|
|
239
243
|
await this.pushTVChanges(body);
|
|
240
244
|
}
|
|
@@ -392,6 +396,36 @@ export class TV {
|
|
|
392
396
|
}
|
|
393
397
|
}
|
|
394
398
|
|
|
399
|
+
async commandType() {
|
|
400
|
+
let commandType: string;
|
|
401
|
+
if (this.device.customize) {
|
|
402
|
+
commandType = 'customize';
|
|
403
|
+
} else {
|
|
404
|
+
commandType = 'command';
|
|
405
|
+
}
|
|
406
|
+
return commandType;
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
async commandOn() {
|
|
410
|
+
let command: string;
|
|
411
|
+
if (this.device.customize && this.device.customOn) {
|
|
412
|
+
command = this.device.customOn;
|
|
413
|
+
} else {
|
|
414
|
+
command = 'turnOn';
|
|
415
|
+
}
|
|
416
|
+
return command;
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
async commandOff() {
|
|
420
|
+
let command: string;
|
|
421
|
+
if (this.device.customize && this.device.customOn) {
|
|
422
|
+
command = this.device.customOn;
|
|
423
|
+
} else {
|
|
424
|
+
command = 'turnOff';
|
|
425
|
+
}
|
|
426
|
+
return command;
|
|
427
|
+
}
|
|
428
|
+
|
|
395
429
|
async statusCode({ res }: { res: IncomingMessage }): Promise<void> {
|
|
396
430
|
switch (res.statusCode) {
|
|
397
431
|
case 151:
|
|
@@ -73,10 +73,12 @@ export class VacuumCleaner {
|
|
|
73
73
|
*/
|
|
74
74
|
async pushOnChanges(): Promise<void> {
|
|
75
75
|
if (this.On) {
|
|
76
|
+
const commandType: string = await this.commandType();
|
|
77
|
+
const command: string = await this.commandOn();
|
|
76
78
|
const body = superStringify({
|
|
77
|
-
'command':
|
|
79
|
+
'command': command,
|
|
78
80
|
'parameter': 'default',
|
|
79
|
-
'commandType':
|
|
81
|
+
'commandType': commandType,
|
|
80
82
|
});
|
|
81
83
|
await this.pushChanges(body);
|
|
82
84
|
}
|
|
@@ -84,10 +86,12 @@ export class VacuumCleaner {
|
|
|
84
86
|
|
|
85
87
|
async pushOffChanges(): Promise<void> {
|
|
86
88
|
if (!this.On) {
|
|
89
|
+
const commandType: string = await this.commandType();
|
|
90
|
+
const command: string = await this.commandOff();
|
|
87
91
|
const body = superStringify({
|
|
88
|
-
'command':
|
|
92
|
+
'command': command,
|
|
89
93
|
'parameter': 'default',
|
|
90
|
-
'commandType':
|
|
94
|
+
'commandType': commandType,
|
|
91
95
|
});
|
|
92
96
|
await this.pushChanges(body);
|
|
93
97
|
}
|
|
@@ -157,6 +161,36 @@ export class VacuumCleaner {
|
|
|
157
161
|
}
|
|
158
162
|
}
|
|
159
163
|
|
|
164
|
+
async commandType() {
|
|
165
|
+
let commandType: string;
|
|
166
|
+
if (this.device.customize) {
|
|
167
|
+
commandType = 'customize';
|
|
168
|
+
} else {
|
|
169
|
+
commandType = 'command';
|
|
170
|
+
}
|
|
171
|
+
return commandType;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
async commandOn() {
|
|
175
|
+
let command: string;
|
|
176
|
+
if (this.device.customize && this.device.customOn) {
|
|
177
|
+
command = this.device.customOn;
|
|
178
|
+
} else {
|
|
179
|
+
command = 'turnOn';
|
|
180
|
+
}
|
|
181
|
+
return command;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
async commandOff() {
|
|
185
|
+
let command: string;
|
|
186
|
+
if (this.device.customize && this.device.customOn) {
|
|
187
|
+
command = this.device.customOn;
|
|
188
|
+
} else {
|
|
189
|
+
command = 'turnOff';
|
|
190
|
+
}
|
|
191
|
+
return command;
|
|
192
|
+
}
|
|
193
|
+
|
|
160
194
|
async statusCode({ res }: { res: IncomingMessage }): Promise<void> {
|
|
161
195
|
switch (res.statusCode) {
|
|
162
196
|
case 151:
|
|
@@ -78,10 +78,12 @@ export class WaterHeater {
|
|
|
78
78
|
*/
|
|
79
79
|
async pushWaterHeaterOnChanges(): Promise<void> {
|
|
80
80
|
if (this.Active !== 1) {
|
|
81
|
+
const commandType: string = await this.commandType();
|
|
82
|
+
const command: string = await this.commandOn();
|
|
81
83
|
const body = superStringify({
|
|
82
|
-
'command':
|
|
84
|
+
'command': command,
|
|
83
85
|
'parameter': 'default',
|
|
84
|
-
'commandType':
|
|
86
|
+
'commandType': commandType,
|
|
85
87
|
});
|
|
86
88
|
await this.pushChanges(body);
|
|
87
89
|
}
|
|
@@ -89,10 +91,12 @@ export class WaterHeater {
|
|
|
89
91
|
|
|
90
92
|
async pushWaterHeaterOffChanges(): Promise<void> {
|
|
91
93
|
if (this.Active !== 0) {
|
|
94
|
+
const commandType: string = await this.commandType();
|
|
95
|
+
const command: string = await this.commandOff();
|
|
92
96
|
const body = superStringify({
|
|
93
|
-
'command':
|
|
97
|
+
'command': command,
|
|
94
98
|
'parameter': 'default',
|
|
95
|
-
'commandType':
|
|
99
|
+
'commandType': commandType,
|
|
96
100
|
});
|
|
97
101
|
await this.pushChanges(body);
|
|
98
102
|
}
|
|
@@ -160,6 +164,36 @@ export class WaterHeater {
|
|
|
160
164
|
}
|
|
161
165
|
}
|
|
162
166
|
|
|
167
|
+
async commandType() {
|
|
168
|
+
let commandType: string;
|
|
169
|
+
if (this.device.customize) {
|
|
170
|
+
commandType = 'customize';
|
|
171
|
+
} else {
|
|
172
|
+
commandType = 'command';
|
|
173
|
+
}
|
|
174
|
+
return commandType;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
async commandOn() {
|
|
178
|
+
let command: string;
|
|
179
|
+
if (this.device.customize && this.device.customOn) {
|
|
180
|
+
command = this.device.customOn;
|
|
181
|
+
} else {
|
|
182
|
+
command = 'turnOn';
|
|
183
|
+
}
|
|
184
|
+
return command;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
async commandOff() {
|
|
188
|
+
let command: string;
|
|
189
|
+
if (this.device.customize && this.device.customOn) {
|
|
190
|
+
command = this.device.customOn;
|
|
191
|
+
} else {
|
|
192
|
+
command = 'turnOff';
|
|
193
|
+
}
|
|
194
|
+
return command;
|
|
195
|
+
}
|
|
196
|
+
|
|
163
197
|
async statusCode({ res }: { res: IncomingMessage }): Promise<void> {
|
|
164
198
|
switch (res.statusCode) {
|
|
165
199
|
case 151:
|