@switchbot/homebridge-switchbot 2.1.4-beta.0 → 2.2.0-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/labeler.yml +2 -2
- package/CHANGELOG.md +9 -0
- package/config.schema.json +30 -11
- package/dist/device/colorbulb.d.ts +6 -0
- package/dist/device/colorbulb.d.ts.map +1 -1
- package/dist/device/colorbulb.js +12 -10
- package/dist/device/colorbulb.js.map +1 -1
- package/dist/device/contact.d.ts +6 -2
- package/dist/device/contact.d.ts.map +1 -1
- package/dist/device/contact.js +12 -9
- package/dist/device/contact.js.map +1 -1
- package/dist/device/meter.d.ts +3 -1
- package/dist/device/meter.d.ts.map +1 -1
- package/dist/device/meter.js +4 -2
- package/dist/device/meter.js.map +1 -1
- package/dist/device/meterplus.d.ts +3 -1
- package/dist/device/meterplus.d.ts.map +1 -1
- package/dist/device/meterplus.js +4 -2
- package/dist/device/meterplus.js.map +1 -1
- package/dist/device/motion.d.ts +6 -1
- package/dist/device/motion.d.ts.map +1 -1
- package/dist/device/motion.js +11 -7
- package/dist/device/motion.js.map +1 -1
- package/dist/irdevice/airconditioner.d.ts +8 -4
- package/dist/irdevice/airconditioner.d.ts.map +1 -1
- package/dist/irdevice/airconditioner.js +45 -19
- package/dist/irdevice/airconditioner.js.map +1 -1
- package/dist/irdevice/airpurifier.d.ts +8 -1
- package/dist/irdevice/airpurifier.d.ts.map +1 -1
- package/dist/irdevice/airpurifier.js +35 -2
- package/dist/irdevice/airpurifier.js.map +1 -1
- package/dist/irdevice/camera.d.ts +8 -1
- package/dist/irdevice/camera.d.ts.map +1 -1
- package/dist/irdevice/camera.js +35 -2
- package/dist/irdevice/camera.js.map +1 -1
- package/dist/irdevice/fan.d.ts +8 -1
- package/dist/irdevice/fan.d.ts.map +1 -1
- package/dist/irdevice/fan.js +42 -11
- package/dist/irdevice/fan.js.map +1 -1
- package/dist/irdevice/light.d.ts +8 -1
- package/dist/irdevice/light.d.ts.map +1 -1
- package/dist/irdevice/light.js +35 -2
- package/dist/irdevice/light.js.map +1 -1
- package/dist/irdevice/other.d.ts +8 -1
- package/dist/irdevice/other.d.ts.map +1 -1
- package/dist/irdevice/other.js +35 -2
- package/dist/irdevice/other.js.map +1 -1
- package/dist/irdevice/tv.d.ts +8 -1
- package/dist/irdevice/tv.d.ts.map +1 -1
- package/dist/irdevice/tv.js +42 -11
- package/dist/irdevice/tv.js.map +1 -1
- package/dist/irdevice/vacuumcleaner.d.ts +8 -1
- package/dist/irdevice/vacuumcleaner.d.ts.map +1 -1
- package/dist/irdevice/vacuumcleaner.js +35 -2
- package/dist/irdevice/vacuumcleaner.js.map +1 -1
- package/dist/irdevice/waterheater.d.ts +8 -1
- package/dist/irdevice/waterheater.d.ts.map +1 -1
- package/dist/irdevice/waterheater.js +35 -2
- package/dist/irdevice/waterheater.js.map +1 -1
- package/dist/settings.d.ts +7 -6
- package/dist/settings.d.ts.map +1 -1
- package/dist/settings.js.map +1 -1
- package/package.json +3 -3
- package/src/device/colorbulb.ts +16 -9
- package/src/device/contact.ts +18 -11
- package/src/device/meter.ts +7 -3
- package/src/device/meterplus.ts +7 -3
- package/src/device/motion.ts +17 -8
- package/src/irdevice/airconditioner.ts +47 -21
- package/src/irdevice/airpurifier.ts +37 -3
- package/src/irdevice/camera.ts +37 -3
- package/src/irdevice/fan.ts +44 -12
- package/src/irdevice/light.ts +37 -3
- package/src/irdevice/other.ts +37 -3
- package/src/irdevice/tv.ts +44 -12
- package/src/irdevice/vacuumcleaner.ts +37 -3
- package/src/irdevice/waterheater.ts +37 -3
- package/src/settings.ts +8 -6
|
@@ -37,14 +37,17 @@ export class AirPurifier {
|
|
|
37
37
|
static PURIFYING_AIR: number;
|
|
38
38
|
|
|
39
39
|
// Config
|
|
40
|
+
allowPushOn?: boolean;
|
|
41
|
+
allowPushOff?: boolean;
|
|
40
42
|
deviceLogging!: string;
|
|
41
|
-
allowPush?: boolean;
|
|
42
43
|
|
|
43
44
|
constructor(private readonly platform: SwitchBotPlatform, private accessory: PlatformAccessory, public device: irdevice & irDevicesConfig) {
|
|
44
45
|
// default placeholders
|
|
45
46
|
this.logs(device);
|
|
46
47
|
this.config(device);
|
|
47
48
|
this.context();
|
|
49
|
+
this.allowPushOnChanges({ device });
|
|
50
|
+
this.allowPushOffChanges({ device });
|
|
48
51
|
|
|
49
52
|
// set accessory information
|
|
50
53
|
accessory
|
|
@@ -131,7 +134,7 @@ export class AirPurifier {
|
|
|
131
134
|
* AirPurifier: "command" "highSpeed" "default" = fan speed to high
|
|
132
135
|
*/
|
|
133
136
|
async pushAirPurifierOnChanges(): Promise<void> {
|
|
134
|
-
if (this.Active !== 1
|
|
137
|
+
if (this.Active !== 1) {
|
|
135
138
|
const commandType: string = await this.commandType();
|
|
136
139
|
const command: string = await this.commandOn();
|
|
137
140
|
const body = superStringify({
|
|
@@ -146,7 +149,7 @@ export class AirPurifier {
|
|
|
146
149
|
async pushAirPurifierOffChanges(): Promise<void> {
|
|
147
150
|
const commandType: string = await this.commandType();
|
|
148
151
|
const command: string = await this.commandOff();
|
|
149
|
-
if (this.Active !== 0
|
|
152
|
+
if (this.Active !== 0) {
|
|
150
153
|
const body = superStringify({
|
|
151
154
|
'command': command,
|
|
152
155
|
'parameter': 'default',
|
|
@@ -272,6 +275,22 @@ export class AirPurifier {
|
|
|
272
275
|
}
|
|
273
276
|
}
|
|
274
277
|
|
|
278
|
+
async allowPushOnChanges({ device }: { device: irdevice & irDevicesConfig; }): Promise<void> {
|
|
279
|
+
if (device.allowPushOn) {
|
|
280
|
+
this.allowPushOn = true;
|
|
281
|
+
} else {
|
|
282
|
+
this.allowPushOn = false;
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
async allowPushOffChanges({ device }: { device: irdevice & irDevicesConfig; }): Promise<void> {
|
|
287
|
+
if (device.allowPushOff) {
|
|
288
|
+
this.allowPushOn = true;
|
|
289
|
+
} else {
|
|
290
|
+
this.allowPushOn = false;
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
|
|
275
294
|
async commandType(): Promise<string> {
|
|
276
295
|
let commandType: string;
|
|
277
296
|
if (this.device.customize) {
|
|
@@ -383,6 +402,21 @@ export class AirPurifier {
|
|
|
383
402
|
if (device.external !== undefined) {
|
|
384
403
|
config['external'] = device.external;
|
|
385
404
|
}
|
|
405
|
+
if (device.customOn !== undefined) {
|
|
406
|
+
config['customOn'] = device.customOn;
|
|
407
|
+
}
|
|
408
|
+
if (device.customOff !== undefined) {
|
|
409
|
+
config['customOff'] = device.customOff;
|
|
410
|
+
}
|
|
411
|
+
if (device.customize !== undefined) {
|
|
412
|
+
config['customize'] = device.customize;
|
|
413
|
+
}
|
|
414
|
+
if (device.allowPushOn !== undefined) {
|
|
415
|
+
config['allowPushOn'] = device.allowPushOn;
|
|
416
|
+
}
|
|
417
|
+
if (device.allowPushOff !== undefined) {
|
|
418
|
+
config['allowPushOff'] = device.allowPushOff;
|
|
419
|
+
}
|
|
386
420
|
if (Object.entries(config).length !== 0) {
|
|
387
421
|
this.infoLog(`${this.device.remoteType}: ${this.accessory.displayName} Config: ${superStringify(config)}`);
|
|
388
422
|
}
|
package/src/irdevice/camera.ts
CHANGED
|
@@ -19,14 +19,17 @@ export class Camera {
|
|
|
19
19
|
On!: CharacteristicValue;
|
|
20
20
|
|
|
21
21
|
// Config
|
|
22
|
+
allowPushOn?: boolean;
|
|
23
|
+
allowPushOff?: boolean;
|
|
22
24
|
deviceLogging!: string;
|
|
23
|
-
allowPush?: boolean;
|
|
24
25
|
|
|
25
26
|
constructor(private readonly platform: SwitchBotPlatform, private accessory: PlatformAccessory, public device: irdevice & irDevicesConfig) {
|
|
26
27
|
// default placeholders
|
|
27
28
|
this.logs(device);
|
|
28
29
|
this.config(device);
|
|
29
30
|
this.context();
|
|
31
|
+
this.allowPushOnChanges({ device });
|
|
32
|
+
this.allowPushOffChanges({ device });
|
|
30
33
|
|
|
31
34
|
// set accessory information
|
|
32
35
|
accessory
|
|
@@ -81,7 +84,7 @@ export class Camera {
|
|
|
81
84
|
* Camera - "command" "channelSub" "default" = previous channel
|
|
82
85
|
*/
|
|
83
86
|
async pushOnChanges(): Promise<void> {
|
|
84
|
-
if (this.On
|
|
87
|
+
if (this.On) {
|
|
85
88
|
const commandType: string = await this.commandType();
|
|
86
89
|
const command: string = await this.commandOn();
|
|
87
90
|
const body = superStringify({
|
|
@@ -96,7 +99,7 @@ export class Camera {
|
|
|
96
99
|
async pushOffChanges(): Promise<void> {
|
|
97
100
|
const commandType: string = await this.commandType();
|
|
98
101
|
const command: string = await this.commandOff();
|
|
99
|
-
if (!this.On
|
|
102
|
+
if (!this.On) {
|
|
100
103
|
const body = superStringify({
|
|
101
104
|
'command': command,
|
|
102
105
|
'parameter': 'default',
|
|
@@ -169,6 +172,22 @@ export class Camera {
|
|
|
169
172
|
}
|
|
170
173
|
}
|
|
171
174
|
|
|
175
|
+
async allowPushOnChanges({ device }: { device: irdevice & irDevicesConfig; }): Promise<void> {
|
|
176
|
+
if (device.allowPushOn) {
|
|
177
|
+
this.allowPushOn = true;
|
|
178
|
+
} else {
|
|
179
|
+
this.allowPushOn = false;
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
async allowPushOffChanges({ device }: { device: irdevice & irDevicesConfig; }): Promise<void> {
|
|
184
|
+
if (device.allowPushOff) {
|
|
185
|
+
this.allowPushOn = true;
|
|
186
|
+
} else {
|
|
187
|
+
this.allowPushOn = false;
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
|
|
172
191
|
async commandType(): Promise<string> {
|
|
173
192
|
let commandType: string;
|
|
174
193
|
if (this.device.customize) {
|
|
@@ -272,6 +291,21 @@ export class Camera {
|
|
|
272
291
|
if (device.external !== undefined) {
|
|
273
292
|
config['external'] = device.external;
|
|
274
293
|
}
|
|
294
|
+
if (device.customOn !== undefined) {
|
|
295
|
+
config['customOn'] = device.customOn;
|
|
296
|
+
}
|
|
297
|
+
if (device.customOff !== undefined) {
|
|
298
|
+
config['customOff'] = device.customOff;
|
|
299
|
+
}
|
|
300
|
+
if (device.customize !== undefined) {
|
|
301
|
+
config['customize'] = device.customize;
|
|
302
|
+
}
|
|
303
|
+
if (device.allowPushOn !== undefined) {
|
|
304
|
+
config['allowPushOn'] = device.allowPushOn;
|
|
305
|
+
}
|
|
306
|
+
if (device.allowPushOff !== undefined) {
|
|
307
|
+
config['allowPushOff'] = device.allowPushOff;
|
|
308
|
+
}
|
|
275
309
|
if (Object.entries(config).length !== 0) {
|
|
276
310
|
this.infoLog(`${this.device.remoteType}: ${this.accessory.displayName} Config: ${superStringify(config)}`);
|
|
277
311
|
}
|
package/src/irdevice/fan.ts
CHANGED
|
@@ -29,14 +29,17 @@ export class Fan {
|
|
|
29
29
|
minStep?: number;
|
|
30
30
|
minValue?: number;
|
|
31
31
|
maxValue?: number;
|
|
32
|
+
allowPushOn?: boolean;
|
|
33
|
+
allowPushOff?: boolean;
|
|
32
34
|
deviceLogging!: string;
|
|
33
|
-
allowPush?: boolean;
|
|
34
35
|
|
|
35
36
|
constructor(private readonly platform: SwitchBotPlatform, private accessory: PlatformAccessory, public device: irdevice & irDevicesConfig) {
|
|
36
37
|
// default placeholders
|
|
37
38
|
this.logs(device);
|
|
38
39
|
this.config(device);
|
|
39
40
|
this.context();
|
|
41
|
+
this.allowPushOnChanges({ device });
|
|
42
|
+
this.allowPushOffChanges({ device });
|
|
40
43
|
|
|
41
44
|
// set accessory information
|
|
42
45
|
accessory
|
|
@@ -171,7 +174,7 @@ export class Fan {
|
|
|
171
174
|
* Fan - "command" "highSpeed" "default" = fan speed to high
|
|
172
175
|
*/
|
|
173
176
|
async pushFanOnChanges(): Promise<void> {
|
|
174
|
-
if (this.Active !== 1
|
|
177
|
+
if (this.Active !== 1) {
|
|
175
178
|
const commandType: string = await this.commandType();
|
|
176
179
|
const command: string = await this.commandOn();
|
|
177
180
|
const body = superStringify({
|
|
@@ -184,16 +187,14 @@ export class Fan {
|
|
|
184
187
|
}
|
|
185
188
|
|
|
186
189
|
async pushFanOffChanges(): Promise<void> {
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
await this.pushTVChanges(body);
|
|
196
|
-
}
|
|
190
|
+
const commandType: string = await this.commandType();
|
|
191
|
+
const command: string = await this.commandOff();
|
|
192
|
+
const body = superStringify({
|
|
193
|
+
'command': command,
|
|
194
|
+
'parameter': 'default',
|
|
195
|
+
'commandType': commandType,
|
|
196
|
+
});
|
|
197
|
+
await this.pushTVChanges(body);
|
|
197
198
|
}
|
|
198
199
|
|
|
199
200
|
async pushFanSpeedUpChanges(): Promise<void> {
|
|
@@ -300,6 +301,22 @@ export class Fan {
|
|
|
300
301
|
}
|
|
301
302
|
}
|
|
302
303
|
|
|
304
|
+
async allowPushOnChanges({ device }: { device: irdevice & irDevicesConfig; }): Promise<void> {
|
|
305
|
+
if (device.allowPushOn) {
|
|
306
|
+
this.allowPushOn = true;
|
|
307
|
+
} else {
|
|
308
|
+
this.allowPushOn = false;
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
async allowPushOffChanges({ device }: { device: irdevice & irDevicesConfig; }): Promise<void> {
|
|
313
|
+
if (device.allowPushOff) {
|
|
314
|
+
this.allowPushOn = true;
|
|
315
|
+
} else {
|
|
316
|
+
this.allowPushOn = false;
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
|
|
303
320
|
async commandType(): Promise<string> {
|
|
304
321
|
let commandType: string;
|
|
305
322
|
if (this.device.customize) {
|
|
@@ -406,6 +423,21 @@ export class Fan {
|
|
|
406
423
|
if (device.external !== undefined) {
|
|
407
424
|
config['external'] = device.external;
|
|
408
425
|
}
|
|
426
|
+
if (device.customOn !== undefined) {
|
|
427
|
+
config['customOn'] = device.customOn;
|
|
428
|
+
}
|
|
429
|
+
if (device.customOff !== undefined) {
|
|
430
|
+
config['customOff'] = device.customOff;
|
|
431
|
+
}
|
|
432
|
+
if (device.customize !== undefined) {
|
|
433
|
+
config['customize'] = device.customize;
|
|
434
|
+
}
|
|
435
|
+
if (device.allowPushOn !== undefined) {
|
|
436
|
+
config['allowPushOn'] = device.allowPushOn;
|
|
437
|
+
}
|
|
438
|
+
if (device.allowPushOff !== undefined) {
|
|
439
|
+
config['allowPushOff'] = device.allowPushOff;
|
|
440
|
+
}
|
|
409
441
|
if (Object.entries(config).length !== 0) {
|
|
410
442
|
this.infoLog(`${this.device.remoteType}: ${this.accessory.displayName} Config: ${superStringify(config)}`);
|
|
411
443
|
}
|
package/src/irdevice/light.ts
CHANGED
|
@@ -19,14 +19,17 @@ export class Light {
|
|
|
19
19
|
On!: CharacteristicValue;
|
|
20
20
|
|
|
21
21
|
// Config
|
|
22
|
+
allowPushOn?: boolean;
|
|
23
|
+
allowPushOff?: boolean;
|
|
22
24
|
deviceLogging!: string;
|
|
23
|
-
allowPush?: boolean;
|
|
24
25
|
|
|
25
26
|
constructor(private readonly platform: SwitchBotPlatform, private accessory: PlatformAccessory, public device: irdevice & irDevicesConfig) {
|
|
26
27
|
// default placeholders
|
|
27
28
|
this.logs(device);
|
|
28
29
|
this.config(device);
|
|
29
30
|
this.context();
|
|
31
|
+
this.allowPushOnChanges({ device });
|
|
32
|
+
this.allowPushOffChanges({ device });
|
|
30
33
|
|
|
31
34
|
// set accessory information
|
|
32
35
|
accessory
|
|
@@ -81,7 +84,7 @@ export class Light {
|
|
|
81
84
|
* Light - "command" "channelSub" "default" = previous channel
|
|
82
85
|
*/
|
|
83
86
|
async pushLightOnChanges(): Promise<void> {
|
|
84
|
-
if (this.On
|
|
87
|
+
if (this.On) {
|
|
85
88
|
const commandType: string = await this.commandType();
|
|
86
89
|
const command: string = await this.commandOn();
|
|
87
90
|
const body = superStringify({
|
|
@@ -94,7 +97,7 @@ export class Light {
|
|
|
94
97
|
}
|
|
95
98
|
|
|
96
99
|
async pushLightOffChanges(): Promise<void> {
|
|
97
|
-
if (!this.On
|
|
100
|
+
if (!this.On) {
|
|
98
101
|
const commandType: string = await this.commandType();
|
|
99
102
|
const command: string = await this.commandOff();
|
|
100
103
|
const body = superStringify({
|
|
@@ -188,6 +191,22 @@ export class Light {
|
|
|
188
191
|
}
|
|
189
192
|
}
|
|
190
193
|
|
|
194
|
+
async allowPushOnChanges({ device }: { device: irdevice & irDevicesConfig; }): Promise<void> {
|
|
195
|
+
if (device.allowPushOn) {
|
|
196
|
+
this.allowPushOn = true;
|
|
197
|
+
} else {
|
|
198
|
+
this.allowPushOn = false;
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
async allowPushOffChanges({ device }: { device: irdevice & irDevicesConfig; }): Promise<void> {
|
|
203
|
+
if (device.allowPushOff) {
|
|
204
|
+
this.allowPushOn = true;
|
|
205
|
+
} else {
|
|
206
|
+
this.allowPushOn = false;
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
|
|
191
210
|
async commandType(): Promise<string> {
|
|
192
211
|
let commandType: string;
|
|
193
212
|
if (this.device.customize) {
|
|
@@ -291,6 +310,21 @@ export class Light {
|
|
|
291
310
|
if (device.external !== undefined) {
|
|
292
311
|
config['external'] = device.external;
|
|
293
312
|
}
|
|
313
|
+
if (device.customOn !== undefined) {
|
|
314
|
+
config['customOn'] = device.customOn;
|
|
315
|
+
}
|
|
316
|
+
if (device.customOff !== undefined) {
|
|
317
|
+
config['customOff'] = device.customOff;
|
|
318
|
+
}
|
|
319
|
+
if (device.customize !== undefined) {
|
|
320
|
+
config['customize'] = device.customize;
|
|
321
|
+
}
|
|
322
|
+
if (device.allowPushOn !== undefined) {
|
|
323
|
+
config['allowPushOn'] = device.allowPushOn;
|
|
324
|
+
}
|
|
325
|
+
if (device.allowPushOff !== undefined) {
|
|
326
|
+
config['allowPushOff'] = device.allowPushOff;
|
|
327
|
+
}
|
|
294
328
|
if (Object.entries(config).length !== 0) {
|
|
295
329
|
this.infoLog(`${this.device.remoteType}: ${this.accessory.displayName} Config: ${superStringify(config)}`);
|
|
296
330
|
}
|
package/src/irdevice/other.ts
CHANGED
|
@@ -19,9 +19,10 @@ export class Others {
|
|
|
19
19
|
Active!: CharacteristicValue;
|
|
20
20
|
|
|
21
21
|
// Config
|
|
22
|
+
allowPushOn?: boolean;
|
|
23
|
+
allowPushOff?: boolean;
|
|
22
24
|
deviceLogging!: string;
|
|
23
25
|
otherDeviceType?: string;
|
|
24
|
-
allowPush?: boolean;
|
|
25
26
|
|
|
26
27
|
constructor(private readonly platform: SwitchBotPlatform, private accessory: PlatformAccessory, public device: irdevice & irDevicesConfig) {
|
|
27
28
|
// default placeholders
|
|
@@ -29,6 +30,8 @@ export class Others {
|
|
|
29
30
|
this.deviceType(device);
|
|
30
31
|
this.config(device);
|
|
31
32
|
this.context();
|
|
33
|
+
this.allowPushOnChanges({ device });
|
|
34
|
+
this.allowPushOffChanges({ device });
|
|
32
35
|
|
|
33
36
|
// set accessory information
|
|
34
37
|
accessory
|
|
@@ -90,7 +93,7 @@ export class Others {
|
|
|
90
93
|
*/
|
|
91
94
|
async pushOnChanges(): Promise<void> {
|
|
92
95
|
if (this.device.customize) {
|
|
93
|
-
if (!this.Active
|
|
96
|
+
if (!this.Active) {
|
|
94
97
|
const commandType: string = await this.commandType();
|
|
95
98
|
const command: string = await this.commandOn();
|
|
96
99
|
const body = superStringify({
|
|
@@ -107,7 +110,7 @@ export class Others {
|
|
|
107
110
|
|
|
108
111
|
async pushOffChanges(): Promise<void> {
|
|
109
112
|
if (this.device.customize) {
|
|
110
|
-
if (this.Active
|
|
113
|
+
if (this.Active) {
|
|
111
114
|
const commandType: string = await this.commandType();
|
|
112
115
|
const command: string = await this.commandOff();
|
|
113
116
|
const body = superStringify({
|
|
@@ -184,6 +187,22 @@ export class Others {
|
|
|
184
187
|
}
|
|
185
188
|
}
|
|
186
189
|
|
|
190
|
+
async allowPushOnChanges({ device }: { device: irdevice & irDevicesConfig; }): Promise<void> {
|
|
191
|
+
if (device.allowPushOn) {
|
|
192
|
+
this.allowPushOn = true;
|
|
193
|
+
} else {
|
|
194
|
+
this.allowPushOn = false;
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
async allowPushOffChanges({ device }: { device: irdevice & irDevicesConfig; }): Promise<void> {
|
|
199
|
+
if (device.allowPushOff) {
|
|
200
|
+
this.allowPushOn = true;
|
|
201
|
+
} else {
|
|
202
|
+
this.allowPushOn = false;
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
|
|
187
206
|
async commandType(): Promise<string> {
|
|
188
207
|
let commandType: string;
|
|
189
208
|
if (this.device.customize) {
|
|
@@ -299,6 +318,21 @@ export class Others {
|
|
|
299
318
|
if (device.external !== undefined) {
|
|
300
319
|
config['external'] = device.external;
|
|
301
320
|
}
|
|
321
|
+
if (device.customOn !== undefined) {
|
|
322
|
+
config['customOn'] = device.customOn;
|
|
323
|
+
}
|
|
324
|
+
if (device.customOff !== undefined) {
|
|
325
|
+
config['customOff'] = device.customOff;
|
|
326
|
+
}
|
|
327
|
+
if (device.customize !== undefined) {
|
|
328
|
+
config['customize'] = device.customize;
|
|
329
|
+
}
|
|
330
|
+
if (device.allowPushOn !== undefined) {
|
|
331
|
+
config['allowPushOn'] = device.allowPushOn;
|
|
332
|
+
}
|
|
333
|
+
if (device.allowPushOff !== undefined) {
|
|
334
|
+
config['allowPushOff'] = device.allowPushOff;
|
|
335
|
+
}
|
|
302
336
|
if (Object.entries(config).length !== 0) {
|
|
303
337
|
this.infoLog(`${this.device.remoteType}: ${this.accessory.displayName} Config: ${superStringify(config)}`);
|
|
304
338
|
}
|
package/src/irdevice/tv.ts
CHANGED
|
@@ -24,14 +24,17 @@ export class TV {
|
|
|
24
24
|
deviceStatus!: any;
|
|
25
25
|
|
|
26
26
|
// Config
|
|
27
|
+
allowPushOn?: boolean;
|
|
28
|
+
allowPushOff?: boolean;
|
|
27
29
|
deviceLogging!: string;
|
|
28
|
-
allowPush?: boolean;
|
|
29
30
|
|
|
30
31
|
constructor(private readonly platform: SwitchBotPlatform, private accessory: PlatformAccessory, public device: irdevice & irDevicesConfig) {
|
|
31
32
|
// default placeholders
|
|
32
33
|
this.logs(device);
|
|
33
34
|
this.config(device);
|
|
34
35
|
this.context();
|
|
36
|
+
this.allowPushOnChanges({ device });
|
|
37
|
+
this.allowPushOffChanges({ device });
|
|
35
38
|
|
|
36
39
|
// set accessory information
|
|
37
40
|
accessory
|
|
@@ -227,7 +230,7 @@ export class TV {
|
|
|
227
230
|
* TV "command" "channelSub" "default" previous channel
|
|
228
231
|
*/
|
|
229
232
|
async pushTvOnChanges(): Promise<void> {
|
|
230
|
-
if (this.Active !== 1
|
|
233
|
+
if (this.Active !== 1) {
|
|
231
234
|
const commandType: string = await this.commandType();
|
|
232
235
|
const command: string = await this.commandOn();
|
|
233
236
|
const body = superStringify({
|
|
@@ -240,16 +243,14 @@ export class TV {
|
|
|
240
243
|
}
|
|
241
244
|
|
|
242
245
|
async pushTvOffChanges(): Promise<void> {
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
await this.pushTVChanges(body);
|
|
252
|
-
}
|
|
246
|
+
const commandType: string = await this.commandType();
|
|
247
|
+
const command: string = await this.commandOff();
|
|
248
|
+
const body = superStringify({
|
|
249
|
+
'command': command,
|
|
250
|
+
'parameter': 'default',
|
|
251
|
+
'commandType': commandType,
|
|
252
|
+
});
|
|
253
|
+
await this.pushTVChanges(body);
|
|
253
254
|
}
|
|
254
255
|
|
|
255
256
|
async pushOkChanges(): Promise<void> {
|
|
@@ -405,6 +406,22 @@ export class TV {
|
|
|
405
406
|
}
|
|
406
407
|
}
|
|
407
408
|
|
|
409
|
+
async allowPushOnChanges({ device }: { device: irdevice & irDevicesConfig; }): Promise<void> {
|
|
410
|
+
if (device.allowPushOn) {
|
|
411
|
+
this.allowPushOn = true;
|
|
412
|
+
} else {
|
|
413
|
+
this.allowPushOn = false;
|
|
414
|
+
}
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
async allowPushOffChanges({ device }: { device: irdevice & irDevicesConfig; }): Promise<void> {
|
|
418
|
+
if (device.allowPushOff) {
|
|
419
|
+
this.allowPushOn = true;
|
|
420
|
+
} else {
|
|
421
|
+
this.allowPushOn = false;
|
|
422
|
+
}
|
|
423
|
+
}
|
|
424
|
+
|
|
408
425
|
async commandType(): Promise<string> {
|
|
409
426
|
let commandType: string;
|
|
410
427
|
if (this.device.customize) {
|
|
@@ -510,6 +527,21 @@ export class TV {
|
|
|
510
527
|
if (device.external !== undefined) {
|
|
511
528
|
config['external'] = device.external;
|
|
512
529
|
}
|
|
530
|
+
if (device.customOn !== undefined) {
|
|
531
|
+
config['customOn'] = device.customOn;
|
|
532
|
+
}
|
|
533
|
+
if (device.customOff !== undefined) {
|
|
534
|
+
config['customOff'] = device.customOff;
|
|
535
|
+
}
|
|
536
|
+
if (device.customize !== undefined) {
|
|
537
|
+
config['customize'] = device.customize;
|
|
538
|
+
}
|
|
539
|
+
if (device.allowPushOn !== undefined) {
|
|
540
|
+
config['allowPushOn'] = device.allowPushOn;
|
|
541
|
+
}
|
|
542
|
+
if (device.allowPushOff !== undefined) {
|
|
543
|
+
config['allowPushOff'] = device.allowPushOff;
|
|
544
|
+
}
|
|
513
545
|
if (Object.entries(config).length !== 0) {
|
|
514
546
|
this.infoLog(`${this.device.remoteType}: ${this.accessory.displayName} Config: ${superStringify(config)}`);
|
|
515
547
|
}
|
|
@@ -19,14 +19,17 @@ export class VacuumCleaner {
|
|
|
19
19
|
On!: CharacteristicValue;
|
|
20
20
|
|
|
21
21
|
// Config
|
|
22
|
+
allowPushOn?: boolean;
|
|
23
|
+
allowPushOff?: boolean;
|
|
22
24
|
deviceLogging!: string;
|
|
23
|
-
allowPush?: boolean;
|
|
24
25
|
|
|
25
26
|
constructor(private readonly platform: SwitchBotPlatform, private accessory: PlatformAccessory, public device: irdevice & irDevicesConfig) {
|
|
26
27
|
// default placeholders
|
|
27
28
|
this.logs(device);
|
|
28
29
|
this.config(device);
|
|
29
30
|
this.context();
|
|
31
|
+
this.allowPushOnChanges({ device });
|
|
32
|
+
this.allowPushOffChanges({ device });
|
|
30
33
|
|
|
31
34
|
// set accessory information
|
|
32
35
|
accessory
|
|
@@ -77,7 +80,7 @@ export class VacuumCleaner {
|
|
|
77
80
|
* Vacuum Cleaner "command" "turnOn" "default" set to ON state
|
|
78
81
|
*/
|
|
79
82
|
async pushOnChanges(): Promise<void> {
|
|
80
|
-
if (this.On
|
|
83
|
+
if (this.On) {
|
|
81
84
|
const commandType: string = await this.commandType();
|
|
82
85
|
const command: string = await this.commandOn();
|
|
83
86
|
const body = superStringify({
|
|
@@ -90,7 +93,7 @@ export class VacuumCleaner {
|
|
|
90
93
|
}
|
|
91
94
|
|
|
92
95
|
async pushOffChanges(): Promise<void> {
|
|
93
|
-
if (!this.On
|
|
96
|
+
if (!this.On) {
|
|
94
97
|
const commandType: string = await this.commandType();
|
|
95
98
|
const command: string = await this.commandOff();
|
|
96
99
|
const body = superStringify({
|
|
@@ -166,6 +169,22 @@ export class VacuumCleaner {
|
|
|
166
169
|
}
|
|
167
170
|
}
|
|
168
171
|
|
|
172
|
+
async allowPushOnChanges({ device }: { device: irdevice & irDevicesConfig; }): Promise<void> {
|
|
173
|
+
if (device.allowPushOn) {
|
|
174
|
+
this.allowPushOn = true;
|
|
175
|
+
} else {
|
|
176
|
+
this.allowPushOn = false;
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
async allowPushOffChanges({ device }: { device: irdevice & irDevicesConfig; }): Promise<void> {
|
|
181
|
+
if (device.allowPushOff) {
|
|
182
|
+
this.allowPushOn = true;
|
|
183
|
+
} else {
|
|
184
|
+
this.allowPushOn = false;
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
|
|
169
188
|
async commandType(): Promise<string> {
|
|
170
189
|
let commandType: string;
|
|
171
190
|
if (this.device.customize) {
|
|
@@ -269,6 +288,21 @@ export class VacuumCleaner {
|
|
|
269
288
|
if (device.external !== undefined) {
|
|
270
289
|
config['external'] = device.external;
|
|
271
290
|
}
|
|
291
|
+
if (device.customOn !== undefined) {
|
|
292
|
+
config['customOn'] = device.customOn;
|
|
293
|
+
}
|
|
294
|
+
if (device.customOff !== undefined) {
|
|
295
|
+
config['customOff'] = device.customOff;
|
|
296
|
+
}
|
|
297
|
+
if (device.customize !== undefined) {
|
|
298
|
+
config['customize'] = device.customize;
|
|
299
|
+
}
|
|
300
|
+
if (device.allowPushOn !== undefined) {
|
|
301
|
+
config['allowPushOn'] = device.allowPushOn;
|
|
302
|
+
}
|
|
303
|
+
if (device.allowPushOff !== undefined) {
|
|
304
|
+
config['allowPushOff'] = device.allowPushOff;
|
|
305
|
+
}
|
|
272
306
|
if (Object.entries(config).length !== 0) {
|
|
273
307
|
this.infoLog(`${this.device.remoteType}: ${this.accessory.displayName} Config: ${superStringify(config)}`);
|
|
274
308
|
}
|
|
@@ -20,14 +20,17 @@ export class WaterHeater {
|
|
|
20
20
|
Active!: CharacteristicValue;
|
|
21
21
|
|
|
22
22
|
// Config
|
|
23
|
+
allowPushOn?: boolean;
|
|
24
|
+
allowPushOff?: boolean;
|
|
23
25
|
deviceLogging!: string;
|
|
24
|
-
allowPush?: boolean;
|
|
25
26
|
|
|
26
27
|
constructor(private readonly platform: SwitchBotPlatform, private accessory: PlatformAccessory, public device: irdevice & irDevicesConfig) {
|
|
27
28
|
// default placeholders
|
|
28
29
|
this.logs({ device });
|
|
29
30
|
this.config({ device });
|
|
30
31
|
this.context();
|
|
32
|
+
this.allowPushOnChanges({ device });
|
|
33
|
+
this.allowPushOffChanges({ device });
|
|
31
34
|
|
|
32
35
|
// set accessory information
|
|
33
36
|
accessory
|
|
@@ -83,7 +86,7 @@ export class WaterHeater {
|
|
|
83
86
|
* WaterHeater "command" "turnOn" "default" set to ON state
|
|
84
87
|
*/
|
|
85
88
|
async pushWaterHeaterOnChanges(): Promise<void> {
|
|
86
|
-
if (this.Active !== 1
|
|
89
|
+
if (this.Active !== 1) {
|
|
87
90
|
const commandType: string = await this.commandType();
|
|
88
91
|
const command: string = await this.commandOn();
|
|
89
92
|
const body = superStringify({
|
|
@@ -96,7 +99,7 @@ export class WaterHeater {
|
|
|
96
99
|
}
|
|
97
100
|
|
|
98
101
|
async pushWaterHeaterOffChanges(): Promise<void> {
|
|
99
|
-
if (this.Active !== 0
|
|
102
|
+
if (this.Active !== 0) {
|
|
100
103
|
const commandType: string = await this.commandType();
|
|
101
104
|
const command: string = await this.commandOff();
|
|
102
105
|
const body = superStringify({
|
|
@@ -174,6 +177,22 @@ export class WaterHeater {
|
|
|
174
177
|
}
|
|
175
178
|
}
|
|
176
179
|
|
|
180
|
+
async allowPushOnChanges({ device }: { device: irdevice & irDevicesConfig; }): Promise<void> {
|
|
181
|
+
if (device.allowPushOn) {
|
|
182
|
+
this.allowPushOn = true;
|
|
183
|
+
} else {
|
|
184
|
+
this.allowPushOn = false;
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
async allowPushOffChanges({ device }: { device: irdevice & irDevicesConfig; }): Promise<void> {
|
|
189
|
+
if (device.allowPushOff) {
|
|
190
|
+
this.allowPushOn = true;
|
|
191
|
+
} else {
|
|
192
|
+
this.allowPushOn = false;
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
|
|
177
196
|
async commandType(): Promise<string> {
|
|
178
197
|
let commandType: string;
|
|
179
198
|
if (this.device.customize) {
|
|
@@ -279,6 +298,21 @@ export class WaterHeater {
|
|
|
279
298
|
if (device.external !== undefined) {
|
|
280
299
|
config['external'] = device.external;
|
|
281
300
|
}
|
|
301
|
+
if (device.customOn !== undefined) {
|
|
302
|
+
config['customOn'] = device.customOn;
|
|
303
|
+
}
|
|
304
|
+
if (device.customOff !== undefined) {
|
|
305
|
+
config['customOff'] = device.customOff;
|
|
306
|
+
}
|
|
307
|
+
if (device.customize !== undefined) {
|
|
308
|
+
config['customize'] = device.customize;
|
|
309
|
+
}
|
|
310
|
+
if (device.allowPushOn !== undefined) {
|
|
311
|
+
config['allowPushOn'] = device.allowPushOn;
|
|
312
|
+
}
|
|
313
|
+
if (device.allowPushOff !== undefined) {
|
|
314
|
+
config['allowPushOff'] = device.allowPushOff;
|
|
315
|
+
}
|
|
282
316
|
if (Object.entries(config).length !== 0) {
|
|
283
317
|
this.infoLog({ log: [`${this.device.remoteType}: ${this.accessory.displayName} Config: ${superStringify(config)}`] });
|
|
284
318
|
}
|