@switchbot/homebridge-switchbot 2.1.3-beta.2 → 2.2.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 +9 -0
- package/config.schema.json +12 -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/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 -0
- package/dist/irdevice/airpurifier.d.ts.map +1 -1
- package/dist/irdevice/airpurifier.js +33 -0
- package/dist/irdevice/airpurifier.js.map +1 -1
- package/dist/irdevice/camera.d.ts +8 -0
- package/dist/irdevice/camera.d.ts.map +1 -1
- package/dist/irdevice/camera.js +33 -0
- package/dist/irdevice/camera.js.map +1 -1
- package/dist/irdevice/fan.d.ts +8 -0
- package/dist/irdevice/fan.d.ts.map +1 -1
- package/dist/irdevice/fan.js +33 -0
- package/dist/irdevice/fan.js.map +1 -1
- package/dist/irdevice/light.d.ts +8 -0
- package/dist/irdevice/light.d.ts.map +1 -1
- package/dist/irdevice/light.js +33 -0
- package/dist/irdevice/light.js.map +1 -1
- package/dist/irdevice/other.d.ts +8 -0
- package/dist/irdevice/other.d.ts.map +1 -1
- package/dist/irdevice/other.js +33 -0
- package/dist/irdevice/other.js.map +1 -1
- package/dist/irdevice/tv.d.ts +8 -0
- package/dist/irdevice/tv.d.ts.map +1 -1
- package/dist/irdevice/tv.js +33 -0
- package/dist/irdevice/tv.js.map +1 -1
- package/dist/irdevice/vacuumcleaner.d.ts +8 -0
- package/dist/irdevice/vacuumcleaner.d.ts.map +1 -1
- package/dist/irdevice/vacuumcleaner.js +33 -0
- package/dist/irdevice/vacuumcleaner.js.map +1 -1
- package/dist/irdevice/waterheater.d.ts +8 -0
- package/dist/irdevice/waterheater.d.ts.map +1 -1
- package/dist/irdevice/waterheater.js +33 -0
- 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/irdevice/airconditioner.ts +47 -21
- package/src/irdevice/airpurifier.ts +35 -0
- package/src/irdevice/camera.ts +35 -0
- package/src/irdevice/fan.ts +35 -0
- package/src/irdevice/light.ts +35 -0
- package/src/irdevice/other.ts +35 -0
- package/src/irdevice/tv.ts +35 -0
- package/src/irdevice/vacuumcleaner.ts +35 -0
- package/src/irdevice/waterheater.ts +35 -0
- package/src/settings.ts +8 -6
|
@@ -36,9 +36,10 @@ export class AirConditioner {
|
|
|
36
36
|
static MODE_HEAT: number;
|
|
37
37
|
|
|
38
38
|
// Config
|
|
39
|
+
allowPushOn?: boolean;
|
|
40
|
+
allowPushOff?: boolean;
|
|
39
41
|
deviceLogging!: string;
|
|
40
42
|
hide_automode?: boolean;
|
|
41
|
-
pushOn?: boolean;
|
|
42
43
|
|
|
43
44
|
private readonly valid12 = [1, 2];
|
|
44
45
|
private readonly valid012 = [0, 1, 2];
|
|
@@ -47,8 +48,9 @@ export class AirConditioner {
|
|
|
47
48
|
// default placeholders
|
|
48
49
|
this.logs({ device });
|
|
49
50
|
this.config({ device });
|
|
50
|
-
this.pushOnChanges({ device });
|
|
51
51
|
this.context({ device });
|
|
52
|
+
this.allowPushOnChanges({ device });
|
|
53
|
+
this.allowPushOffChanges({ device });
|
|
52
54
|
|
|
53
55
|
// set accessory information
|
|
54
56
|
accessory
|
|
@@ -163,7 +165,7 @@ export class AirConditioner {
|
|
|
163
165
|
* AirConditioner: "command" "highSpeed" "default" = fan speed to high
|
|
164
166
|
*/
|
|
165
167
|
async pushAirConditionerOnChanges(): Promise<void> {
|
|
166
|
-
if (this.Active
|
|
168
|
+
if (this.Active === this.platform.Characteristic.Active.INACTIVE || this.allowPushOn) {
|
|
167
169
|
const commandType: string = await this.commandType();
|
|
168
170
|
const command: string = await this.commandOn();
|
|
169
171
|
const body = superStringify({
|
|
@@ -176,14 +178,16 @@ export class AirConditioner {
|
|
|
176
178
|
}
|
|
177
179
|
|
|
178
180
|
async pushAirConditionerOffChanges(): Promise<void> {
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
181
|
+
if (this.Active === this.platform.Characteristic.Active.ACTIVE || this.allowPushOff) {
|
|
182
|
+
const commandType: string = await this.commandType();
|
|
183
|
+
const command: string = await this.commandOff();
|
|
184
|
+
const body = superStringify({
|
|
185
|
+
'command': command,
|
|
186
|
+
'parameter': 'default',
|
|
187
|
+
'commandType': commandType,
|
|
188
|
+
});
|
|
189
|
+
await this.pushChanges(body);
|
|
190
|
+
}
|
|
187
191
|
}
|
|
188
192
|
|
|
189
193
|
async pushAirConditionerStatusChanges(): Promise<void> {
|
|
@@ -339,7 +343,7 @@ export class AirConditioner {
|
|
|
339
343
|
this.pushAirConditionerOffChanges();
|
|
340
344
|
} else {
|
|
341
345
|
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} pushAirConditionerOnChanges, Active: ${this.Active}`);
|
|
342
|
-
if (this.
|
|
346
|
+
if (this.allowPushOn) {
|
|
343
347
|
this.pushAirConditionerOnChanges();
|
|
344
348
|
} else {
|
|
345
349
|
this.pushAirConditionerStatusChanges();
|
|
@@ -561,6 +565,22 @@ export class AirConditioner {
|
|
|
561
565
|
}
|
|
562
566
|
}
|
|
563
567
|
|
|
568
|
+
async allowPushOnChanges({ device }: { device: irdevice & irDevicesConfig; }): Promise<void> {
|
|
569
|
+
if (device.allowPushOn) {
|
|
570
|
+
this.allowPushOn = true;
|
|
571
|
+
} else {
|
|
572
|
+
this.allowPushOn = false;
|
|
573
|
+
}
|
|
574
|
+
}
|
|
575
|
+
|
|
576
|
+
async allowPushOffChanges({ device }: { device: irdevice & irDevicesConfig; }): Promise<void> {
|
|
577
|
+
if (device.allowPushOff) {
|
|
578
|
+
this.allowPushOn = true;
|
|
579
|
+
} else {
|
|
580
|
+
this.allowPushOn = false;
|
|
581
|
+
}
|
|
582
|
+
}
|
|
583
|
+
|
|
564
584
|
async commandType(): Promise<string> {
|
|
565
585
|
let commandType: string;
|
|
566
586
|
if (this.device.customize) {
|
|
@@ -682,6 +702,21 @@ export class AirConditioner {
|
|
|
682
702
|
if (device.external !== undefined) {
|
|
683
703
|
config['external'] = device.external;
|
|
684
704
|
}
|
|
705
|
+
if (device.customOn !== undefined) {
|
|
706
|
+
config['customOn'] = device.customOn;
|
|
707
|
+
}
|
|
708
|
+
if (device.customOff !== undefined) {
|
|
709
|
+
config['customOff'] = device.customOff;
|
|
710
|
+
}
|
|
711
|
+
if (device.customize !== undefined) {
|
|
712
|
+
config['customize'] = device.customize;
|
|
713
|
+
}
|
|
714
|
+
if (device.allowPushOn !== undefined) {
|
|
715
|
+
config['allowPushOn'] = device.allowPushOn;
|
|
716
|
+
}
|
|
717
|
+
if (device.allowPushOff !== undefined) {
|
|
718
|
+
config['allowPushOff'] = device.allowPushOff;
|
|
719
|
+
}
|
|
685
720
|
if (Object.entries(config).length !== 0) {
|
|
686
721
|
this.infoLog(`${this.device.remoteType}: ${this.accessory.displayName} Config: ${superStringify(config)}`);
|
|
687
722
|
}
|
|
@@ -703,15 +738,6 @@ export class AirConditioner {
|
|
|
703
738
|
}
|
|
704
739
|
}
|
|
705
740
|
|
|
706
|
-
|
|
707
|
-
async pushOnChanges({ device }: { device: irdevice & irDevicesConfig; }): Promise<void> {
|
|
708
|
-
if (device.irair?.pushOn) {
|
|
709
|
-
this.pushOn = true;
|
|
710
|
-
} else {
|
|
711
|
-
this.pushOn = false;
|
|
712
|
-
}
|
|
713
|
-
}
|
|
714
|
-
|
|
715
741
|
/**
|
|
716
742
|
* Logging for Device
|
|
717
743
|
*/
|
|
@@ -37,6 +37,8 @@ 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
43
|
|
|
42
44
|
constructor(private readonly platform: SwitchBotPlatform, private accessory: PlatformAccessory, public device: irdevice & irDevicesConfig) {
|
|
@@ -44,6 +46,8 @@ export class AirPurifier {
|
|
|
44
46
|
this.logs(device);
|
|
45
47
|
this.config(device);
|
|
46
48
|
this.context();
|
|
49
|
+
this.allowPushOnChanges({ device });
|
|
50
|
+
this.allowPushOffChanges({ device });
|
|
47
51
|
|
|
48
52
|
// set accessory information
|
|
49
53
|
accessory
|
|
@@ -271,6 +275,22 @@ export class AirPurifier {
|
|
|
271
275
|
}
|
|
272
276
|
}
|
|
273
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
|
+
|
|
274
294
|
async commandType(): Promise<string> {
|
|
275
295
|
let commandType: string;
|
|
276
296
|
if (this.device.customize) {
|
|
@@ -382,6 +402,21 @@ export class AirPurifier {
|
|
|
382
402
|
if (device.external !== undefined) {
|
|
383
403
|
config['external'] = device.external;
|
|
384
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
|
+
}
|
|
385
420
|
if (Object.entries(config).length !== 0) {
|
|
386
421
|
this.infoLog(`${this.device.remoteType}: ${this.accessory.displayName} Config: ${superStringify(config)}`);
|
|
387
422
|
}
|
package/src/irdevice/camera.ts
CHANGED
|
@@ -19,6 +19,8 @@ export class Camera {
|
|
|
19
19
|
On!: CharacteristicValue;
|
|
20
20
|
|
|
21
21
|
// Config
|
|
22
|
+
allowPushOn?: boolean;
|
|
23
|
+
allowPushOff?: boolean;
|
|
22
24
|
deviceLogging!: string;
|
|
23
25
|
|
|
24
26
|
constructor(private readonly platform: SwitchBotPlatform, private accessory: PlatformAccessory, public device: irdevice & irDevicesConfig) {
|
|
@@ -26,6 +28,8 @@ export class Camera {
|
|
|
26
28
|
this.logs(device);
|
|
27
29
|
this.config(device);
|
|
28
30
|
this.context();
|
|
31
|
+
this.allowPushOnChanges({ device });
|
|
32
|
+
this.allowPushOffChanges({ device });
|
|
29
33
|
|
|
30
34
|
// set accessory information
|
|
31
35
|
accessory
|
|
@@ -168,6 +172,22 @@ export class Camera {
|
|
|
168
172
|
}
|
|
169
173
|
}
|
|
170
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
|
+
|
|
171
191
|
async commandType(): Promise<string> {
|
|
172
192
|
let commandType: string;
|
|
173
193
|
if (this.device.customize) {
|
|
@@ -271,6 +291,21 @@ export class Camera {
|
|
|
271
291
|
if (device.external !== undefined) {
|
|
272
292
|
config['external'] = device.external;
|
|
273
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
|
+
}
|
|
274
309
|
if (Object.entries(config).length !== 0) {
|
|
275
310
|
this.infoLog(`${this.device.remoteType}: ${this.accessory.displayName} Config: ${superStringify(config)}`);
|
|
276
311
|
}
|
package/src/irdevice/fan.ts
CHANGED
|
@@ -29,6 +29,8 @@ 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
35
|
|
|
34
36
|
constructor(private readonly platform: SwitchBotPlatform, private accessory: PlatformAccessory, public device: irdevice & irDevicesConfig) {
|
|
@@ -36,6 +38,8 @@ export class Fan {
|
|
|
36
38
|
this.logs(device);
|
|
37
39
|
this.config(device);
|
|
38
40
|
this.context();
|
|
41
|
+
this.allowPushOnChanges({ device });
|
|
42
|
+
this.allowPushOffChanges({ device });
|
|
39
43
|
|
|
40
44
|
// set accessory information
|
|
41
45
|
accessory
|
|
@@ -297,6 +301,22 @@ export class Fan {
|
|
|
297
301
|
}
|
|
298
302
|
}
|
|
299
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
|
+
|
|
300
320
|
async commandType(): Promise<string> {
|
|
301
321
|
let commandType: string;
|
|
302
322
|
if (this.device.customize) {
|
|
@@ -403,6 +423,21 @@ export class Fan {
|
|
|
403
423
|
if (device.external !== undefined) {
|
|
404
424
|
config['external'] = device.external;
|
|
405
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
|
+
}
|
|
406
441
|
if (Object.entries(config).length !== 0) {
|
|
407
442
|
this.infoLog(`${this.device.remoteType}: ${this.accessory.displayName} Config: ${superStringify(config)}`);
|
|
408
443
|
}
|
package/src/irdevice/light.ts
CHANGED
|
@@ -19,6 +19,8 @@ export class Light {
|
|
|
19
19
|
On!: CharacteristicValue;
|
|
20
20
|
|
|
21
21
|
// Config
|
|
22
|
+
allowPushOn?: boolean;
|
|
23
|
+
allowPushOff?: boolean;
|
|
22
24
|
deviceLogging!: string;
|
|
23
25
|
|
|
24
26
|
constructor(private readonly platform: SwitchBotPlatform, private accessory: PlatformAccessory, public device: irdevice & irDevicesConfig) {
|
|
@@ -26,6 +28,8 @@ export class Light {
|
|
|
26
28
|
this.logs(device);
|
|
27
29
|
this.config(device);
|
|
28
30
|
this.context();
|
|
31
|
+
this.allowPushOnChanges({ device });
|
|
32
|
+
this.allowPushOffChanges({ device });
|
|
29
33
|
|
|
30
34
|
// set accessory information
|
|
31
35
|
accessory
|
|
@@ -187,6 +191,22 @@ export class Light {
|
|
|
187
191
|
}
|
|
188
192
|
}
|
|
189
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
|
+
|
|
190
210
|
async commandType(): Promise<string> {
|
|
191
211
|
let commandType: string;
|
|
192
212
|
if (this.device.customize) {
|
|
@@ -290,6 +310,21 @@ export class Light {
|
|
|
290
310
|
if (device.external !== undefined) {
|
|
291
311
|
config['external'] = device.external;
|
|
292
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
|
+
}
|
|
293
328
|
if (Object.entries(config).length !== 0) {
|
|
294
329
|
this.infoLog(`${this.device.remoteType}: ${this.accessory.displayName} Config: ${superStringify(config)}`);
|
|
295
330
|
}
|
package/src/irdevice/other.ts
CHANGED
|
@@ -19,6 +19,8 @@ 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
26
|
|
|
@@ -28,6 +30,8 @@ export class Others {
|
|
|
28
30
|
this.deviceType(device);
|
|
29
31
|
this.config(device);
|
|
30
32
|
this.context();
|
|
33
|
+
this.allowPushOnChanges({ device });
|
|
34
|
+
this.allowPushOffChanges({ device });
|
|
31
35
|
|
|
32
36
|
// set accessory information
|
|
33
37
|
accessory
|
|
@@ -183,6 +187,22 @@ export class Others {
|
|
|
183
187
|
}
|
|
184
188
|
}
|
|
185
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
|
+
|
|
186
206
|
async commandType(): Promise<string> {
|
|
187
207
|
let commandType: string;
|
|
188
208
|
if (this.device.customize) {
|
|
@@ -298,6 +318,21 @@ export class Others {
|
|
|
298
318
|
if (device.external !== undefined) {
|
|
299
319
|
config['external'] = device.external;
|
|
300
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
|
+
}
|
|
301
336
|
if (Object.entries(config).length !== 0) {
|
|
302
337
|
this.infoLog(`${this.device.remoteType}: ${this.accessory.displayName} Config: ${superStringify(config)}`);
|
|
303
338
|
}
|
package/src/irdevice/tv.ts
CHANGED
|
@@ -24,6 +24,8 @@ export class TV {
|
|
|
24
24
|
deviceStatus!: any;
|
|
25
25
|
|
|
26
26
|
// Config
|
|
27
|
+
allowPushOn?: boolean;
|
|
28
|
+
allowPushOff?: boolean;
|
|
27
29
|
deviceLogging!: string;
|
|
28
30
|
|
|
29
31
|
constructor(private readonly platform: SwitchBotPlatform, private accessory: PlatformAccessory, public device: irdevice & irDevicesConfig) {
|
|
@@ -31,6 +33,8 @@ export class TV {
|
|
|
31
33
|
this.logs(device);
|
|
32
34
|
this.config(device);
|
|
33
35
|
this.context();
|
|
36
|
+
this.allowPushOnChanges({ device });
|
|
37
|
+
this.allowPushOffChanges({ device });
|
|
34
38
|
|
|
35
39
|
// set accessory information
|
|
36
40
|
accessory
|
|
@@ -402,6 +406,22 @@ export class TV {
|
|
|
402
406
|
}
|
|
403
407
|
}
|
|
404
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
|
+
|
|
405
425
|
async commandType(): Promise<string> {
|
|
406
426
|
let commandType: string;
|
|
407
427
|
if (this.device.customize) {
|
|
@@ -507,6 +527,21 @@ export class TV {
|
|
|
507
527
|
if (device.external !== undefined) {
|
|
508
528
|
config['external'] = device.external;
|
|
509
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
|
+
}
|
|
510
545
|
if (Object.entries(config).length !== 0) {
|
|
511
546
|
this.infoLog(`${this.device.remoteType}: ${this.accessory.displayName} Config: ${superStringify(config)}`);
|
|
512
547
|
}
|
|
@@ -19,6 +19,8 @@ export class VacuumCleaner {
|
|
|
19
19
|
On!: CharacteristicValue;
|
|
20
20
|
|
|
21
21
|
// Config
|
|
22
|
+
allowPushOn?: boolean;
|
|
23
|
+
allowPushOff?: boolean;
|
|
22
24
|
deviceLogging!: string;
|
|
23
25
|
|
|
24
26
|
constructor(private readonly platform: SwitchBotPlatform, private accessory: PlatformAccessory, public device: irdevice & irDevicesConfig) {
|
|
@@ -26,6 +28,8 @@ export class VacuumCleaner {
|
|
|
26
28
|
this.logs(device);
|
|
27
29
|
this.config(device);
|
|
28
30
|
this.context();
|
|
31
|
+
this.allowPushOnChanges({ device });
|
|
32
|
+
this.allowPushOffChanges({ device });
|
|
29
33
|
|
|
30
34
|
// set accessory information
|
|
31
35
|
accessory
|
|
@@ -165,6 +169,22 @@ export class VacuumCleaner {
|
|
|
165
169
|
}
|
|
166
170
|
}
|
|
167
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
|
+
|
|
168
188
|
async commandType(): Promise<string> {
|
|
169
189
|
let commandType: string;
|
|
170
190
|
if (this.device.customize) {
|
|
@@ -268,6 +288,21 @@ export class VacuumCleaner {
|
|
|
268
288
|
if (device.external !== undefined) {
|
|
269
289
|
config['external'] = device.external;
|
|
270
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
|
+
}
|
|
271
306
|
if (Object.entries(config).length !== 0) {
|
|
272
307
|
this.infoLog(`${this.device.remoteType}: ${this.accessory.displayName} Config: ${superStringify(config)}`);
|
|
273
308
|
}
|
|
@@ -20,6 +20,8 @@ export class WaterHeater {
|
|
|
20
20
|
Active!: CharacteristicValue;
|
|
21
21
|
|
|
22
22
|
// Config
|
|
23
|
+
allowPushOn?: boolean;
|
|
24
|
+
allowPushOff?: boolean;
|
|
23
25
|
deviceLogging!: string;
|
|
24
26
|
|
|
25
27
|
constructor(private readonly platform: SwitchBotPlatform, private accessory: PlatformAccessory, public device: irdevice & irDevicesConfig) {
|
|
@@ -27,6 +29,8 @@ export class WaterHeater {
|
|
|
27
29
|
this.logs({ device });
|
|
28
30
|
this.config({ device });
|
|
29
31
|
this.context();
|
|
32
|
+
this.allowPushOnChanges({ device });
|
|
33
|
+
this.allowPushOffChanges({ device });
|
|
30
34
|
|
|
31
35
|
// set accessory information
|
|
32
36
|
accessory
|
|
@@ -173,6 +177,22 @@ export class WaterHeater {
|
|
|
173
177
|
}
|
|
174
178
|
}
|
|
175
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
|
+
|
|
176
196
|
async commandType(): Promise<string> {
|
|
177
197
|
let commandType: string;
|
|
178
198
|
if (this.device.customize) {
|
|
@@ -278,6 +298,21 @@ export class WaterHeater {
|
|
|
278
298
|
if (device.external !== undefined) {
|
|
279
299
|
config['external'] = device.external;
|
|
280
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
|
+
}
|
|
281
316
|
if (Object.entries(config).length !== 0) {
|
|
282
317
|
this.infoLog({ log: [`${this.device.remoteType}: ${this.accessory.displayName} Config: ${superStringify(config)}`] });
|
|
283
318
|
}
|
package/src/settings.ts
CHANGED
|
@@ -131,16 +131,17 @@ export type lock = {
|
|
|
131
131
|
|
|
132
132
|
export interface irDevicesConfig extends irdevice {
|
|
133
133
|
configRemoteType?: string;
|
|
134
|
-
|
|
134
|
+
connectionType?: string;
|
|
135
|
+
hide_device?: boolean;
|
|
135
136
|
external?: boolean;
|
|
136
137
|
firmware?: string;
|
|
138
|
+
deviceId: string;
|
|
137
139
|
logging?: string;
|
|
138
|
-
connectionType?: string;
|
|
139
|
-
hide_device?: boolean;
|
|
140
|
-
customize?: boolean;
|
|
141
140
|
customOn?: string;
|
|
142
141
|
customOff?: string;
|
|
143
|
-
|
|
142
|
+
customize?: boolean;
|
|
143
|
+
allowPushOn?: boolean;
|
|
144
|
+
allowPushOff?: boolean;
|
|
144
145
|
irfan?: irfan;
|
|
145
146
|
irair?: irair;
|
|
146
147
|
irpur?: Record<any, any>;
|
|
@@ -180,7 +181,6 @@ export type set_min = {
|
|
|
180
181
|
|
|
181
182
|
export type irair = {
|
|
182
183
|
hide_automode?: boolean;
|
|
183
|
-
pushOn?: boolean;
|
|
184
184
|
};
|
|
185
185
|
|
|
186
186
|
export type irtv = {
|
|
@@ -355,6 +355,8 @@ export type serviceData = {
|
|
|
355
355
|
overload?: boolean;
|
|
356
356
|
//PlugMini - Plug Mini current power value of the load
|
|
357
357
|
currentPower?: number;
|
|
358
|
+
//Color Bulb's brightness level
|
|
359
|
+
brightness?: boolean | string;
|
|
358
360
|
};
|
|
359
361
|
|
|
360
362
|
export type temperature = {
|