@switchbot/homebridge-switchbot 2.2.0-beta.1 → 2.2.0-beta.3
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 +1 -1
- package/config.schema.json +0 -2
- package/dist/device/bot.d.ts +3 -0
- package/dist/device/bot.d.ts.map +1 -1
- package/dist/device/bot.js +13 -9
- package/dist/device/bot.js.map +1 -1
- package/dist/device/colorbulb.d.ts +11 -1
- package/dist/device/colorbulb.d.ts.map +1 -1
- package/dist/device/colorbulb.js +168 -16
- package/dist/device/colorbulb.js.map +1 -1
- package/dist/device/contact.d.ts +4 -1
- package/dist/device/contact.d.ts.map +1 -1
- package/dist/device/contact.js +16 -12
- package/dist/device/contact.js.map +1 -1
- package/dist/device/curtain.d.ts +2 -0
- package/dist/device/curtain.d.ts.map +1 -1
- package/dist/device/curtain.js +17 -11
- package/dist/device/curtain.js.map +1 -1
- package/dist/device/humidifier.d.ts +3 -0
- package/dist/device/humidifier.d.ts.map +1 -1
- package/dist/device/humidifier.js +13 -9
- package/dist/device/humidifier.js.map +1 -1
- package/dist/device/lock.d.ts +8 -1
- package/dist/device/lock.d.ts.map +1 -1
- package/dist/device/lock.js +83 -0
- package/dist/device/lock.js.map +1 -1
- package/dist/device/meter.d.ts +3 -0
- package/dist/device/meter.d.ts.map +1 -1
- package/dist/device/meter.js +13 -9
- package/dist/device/meter.js.map +1 -1
- package/dist/device/meterplus.d.ts +3 -0
- package/dist/device/meterplus.d.ts.map +1 -1
- package/dist/device/meterplus.js +13 -9
- package/dist/device/meterplus.js.map +1 -1
- package/dist/device/motion.d.ts +4 -1
- package/dist/device/motion.d.ts.map +1 -1
- package/dist/device/motion.js +20 -15
- package/dist/device/motion.js.map +1 -1
- package/dist/device/plug.d.ts +3 -0
- package/dist/device/plug.d.ts.map +1 -1
- package/dist/device/plug.js +13 -9
- package/dist/device/plug.js.map +1 -1
- package/dist/device/striplight.d.ts +3 -0
- package/dist/device/striplight.d.ts.map +1 -1
- package/dist/device/striplight.js +13 -9
- package/dist/device/striplight.js.map +1 -1
- package/dist/irdevice/airconditioner.d.ts +1 -4
- package/dist/irdevice/airconditioner.d.ts.map +1 -1
- package/dist/irdevice/airconditioner.js +16 -28
- package/dist/irdevice/airconditioner.js.map +1 -1
- package/dist/irdevice/airpurifier.d.ts.map +1 -1
- package/dist/irdevice/airpurifier.js +4 -5
- package/dist/irdevice/airpurifier.js.map +1 -1
- package/dist/irdevice/camera.d.ts.map +1 -1
- package/dist/irdevice/camera.js +2 -3
- package/dist/irdevice/camera.js.map +1 -1
- package/dist/irdevice/fan.d.ts.map +1 -1
- package/dist/irdevice/fan.js +11 -10
- package/dist/irdevice/fan.js.map +1 -1
- package/dist/irdevice/light.d.ts.map +1 -1
- package/dist/irdevice/light.js +2 -3
- package/dist/irdevice/light.js.map +1 -1
- package/dist/irdevice/other.d.ts.map +1 -1
- package/dist/irdevice/other.js +1 -1
- package/dist/irdevice/other.js.map +1 -1
- package/dist/irdevice/tv.d.ts.map +1 -1
- package/dist/irdevice/tv.js +11 -12
- package/dist/irdevice/tv.js.map +1 -1
- package/dist/irdevice/vacuumcleaner.d.ts.map +1 -1
- package/dist/irdevice/vacuumcleaner.js +2 -3
- package/dist/irdevice/vacuumcleaner.js.map +1 -1
- package/dist/irdevice/waterheater.d.ts.map +1 -1
- package/dist/irdevice/waterheater.js +2 -3
- package/dist/irdevice/waterheater.js.map +1 -1
- package/dist/settings.d.ts +7 -1
- package/dist/settings.d.ts.map +1 -1
- package/dist/settings.js.map +1 -1
- package/package.json +4 -4
- package/src/device/bot.ts +13 -8
- package/src/device/colorbulb.ts +185 -20
- package/src/device/contact.ts +17 -12
- package/src/device/curtain.ts +18 -11
- package/src/device/humidifier.ts +13 -8
- package/src/device/lock.ts +92 -1
- package/src/device/meter.ts +13 -8
- package/src/device/meterplus.ts +13 -8
- package/src/device/motion.ts +21 -15
- package/src/device/plug.ts +13 -8
- package/src/device/striplight.ts +13 -8
- package/src/irdevice/airconditioner.ts +20 -37
- package/src/irdevice/airpurifier.ts +4 -5
- package/src/irdevice/camera.ts +3 -4
- package/src/irdevice/fan.ts +11 -10
- package/src/irdevice/light.ts +2 -3
- package/src/irdevice/other.ts +1 -1
- package/src/irdevice/tv.ts +11 -12
- package/src/irdevice/vacuumcleaner.ts +2 -3
- package/src/irdevice/waterheater.ts +2 -3
- package/src/settings.ts +14 -2
|
@@ -48,7 +48,7 @@ export class AirConditioner {
|
|
|
48
48
|
// default placeholders
|
|
49
49
|
this.logs({ device });
|
|
50
50
|
this.config({ device });
|
|
51
|
-
this.context(
|
|
51
|
+
this.context();
|
|
52
52
|
this.allowPushOnChanges({ device });
|
|
53
53
|
this.allowPushOffChanges({ device });
|
|
54
54
|
|
|
@@ -202,7 +202,7 @@ export class AirConditioner {
|
|
|
202
202
|
}
|
|
203
203
|
|
|
204
204
|
async pushAirConditionerDetailsChanges(): Promise<void> {
|
|
205
|
-
this.
|
|
205
|
+
await this.context();
|
|
206
206
|
if (this.CurrentMode === undefined) {
|
|
207
207
|
this.CurrentMode = 1;
|
|
208
208
|
}
|
|
@@ -224,7 +224,7 @@ export class AirConditioner {
|
|
|
224
224
|
const parameter = `${this.CurrentTemperature},${this.CurrentMode},${this.CurrentFanSpeed},${this.state}`;
|
|
225
225
|
|
|
226
226
|
if (this.Active === this.platform.Characteristic.Active.ACTIVE) {
|
|
227
|
-
this.
|
|
227
|
+
await this.context();
|
|
228
228
|
if (this.CurrentTemperature < this.accessory.context.CurrentTemperature) {
|
|
229
229
|
this.CurrentHeaterCoolerState = this.platform.Characteristic.CurrentHeaterCoolerState.COOLING;
|
|
230
230
|
} else if (this.CurrentTemperature > this.accessory.context.CurrentTemperature) {
|
|
@@ -282,11 +282,11 @@ export class AirConditioner {
|
|
|
282
282
|
req.write(body);
|
|
283
283
|
req.end();
|
|
284
284
|
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} pushchanges: ${superStringify(req)}`);
|
|
285
|
-
this.accessory.context.CurrentTemperature = this.CurrentTemperature;
|
|
285
|
+
//this.accessory.context.CurrentTemperature = this.CurrentTemperature;
|
|
286
286
|
this.HeatingThresholdTemperature = this.CurrentTemperature;
|
|
287
287
|
this.CoolingThresholdTemperature = this.CurrentTemperature;
|
|
288
|
-
this.accessory.context.HeatingThresholdTemperature = this.HeatingThresholdTemperature;
|
|
289
|
-
this.accessory.context.CoolingThresholdTemperature = this.CoolingThresholdTemperature;
|
|
288
|
+
//this.accessory.context.HeatingThresholdTemperature = this.HeatingThresholdTemperature;
|
|
289
|
+
//this.accessory.context.CoolingThresholdTemperature = this.CoolingThresholdTemperature;
|
|
290
290
|
this.updateHomeKitCharacteristics();
|
|
291
291
|
} catch (e: any) {
|
|
292
292
|
this.apiError({ e });
|
|
@@ -332,7 +332,6 @@ export class AirConditioner {
|
|
|
332
332
|
this.CurrentFanSpeed = Number(value) + 1;
|
|
333
333
|
}
|
|
334
334
|
this.RotationSpeed = this.CurrentFanSpeed;
|
|
335
|
-
this.accessory.context.RotationSpeed = this.RotationSpeed;
|
|
336
335
|
this.pushAirConditionerStatusChanges();
|
|
337
336
|
}
|
|
338
337
|
|
|
@@ -354,7 +353,6 @@ export class AirConditioner {
|
|
|
354
353
|
* they are updated, so we are only updating the accessory state after calling the above.
|
|
355
354
|
*/
|
|
356
355
|
this.Active = value;
|
|
357
|
-
this.accessory.context.Active = this.Active;
|
|
358
356
|
}
|
|
359
357
|
|
|
360
358
|
async TargetHeaterCoolerStateGet(): Promise<CharacteristicValue> {
|
|
@@ -407,7 +405,6 @@ export class AirConditioner {
|
|
|
407
405
|
);
|
|
408
406
|
}
|
|
409
407
|
}
|
|
410
|
-
this.accessory.context.TargetHeaterCoolerState = this.TargetHeaterCoolerState;
|
|
411
408
|
this.pushAirConditionerStatusChanges();
|
|
412
409
|
}
|
|
413
410
|
|
|
@@ -434,7 +431,7 @@ export class AirConditioner {
|
|
|
434
431
|
|
|
435
432
|
async CurrentHeaterCoolerStateGet(): Promise<CharacteristicValue> {
|
|
436
433
|
if (this.Active === this.platform.Characteristic.Active.ACTIVE) {
|
|
437
|
-
this.
|
|
434
|
+
await this.context();
|
|
438
435
|
if (this.CurrentTemperature < this.accessory.context.CurrentTemperature) {
|
|
439
436
|
this.CurrentHeaterCoolerState = this.platform.Characteristic.CurrentHeaterCoolerState.COOLING;
|
|
440
437
|
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName}`
|
|
@@ -454,7 +451,7 @@ export class AirConditioner {
|
|
|
454
451
|
}
|
|
455
452
|
|
|
456
453
|
async HeatingThresholdTemperatureGet(): Promise<CharacteristicValue> {
|
|
457
|
-
this.
|
|
454
|
+
await this.context();
|
|
458
455
|
this.CurrentTemperature = this.accessory.context.CurrentTemperature;
|
|
459
456
|
this.HeatingThresholdTemperature = this.accessory.context.CurrentTemperature;
|
|
460
457
|
this.accessory.context.HeatingThresholdTemperature = this.HeatingThresholdTemperature;
|
|
@@ -463,18 +460,14 @@ export class AirConditioner {
|
|
|
463
460
|
}
|
|
464
461
|
|
|
465
462
|
async HeatingThresholdTemperatureSet(value: CharacteristicValue): Promise<void> {
|
|
466
|
-
this.accessory.context.CurrentTemperature = this.CurrentTemperature;
|
|
467
463
|
this.CurrentTemperature = value;
|
|
468
|
-
this.accessory.
|
|
469
|
-
|
|
470
|
-
`${this.device.remoteType}: ${this.accessory.displayName} Set HeatingThresholdTemperature: ${this.HeatingThresholdTemperature},` +
|
|
471
|
-
` CurrentTemperatureCached: ${this.accessory.context.CurrentTemperature}`,
|
|
472
|
-
);
|
|
464
|
+
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} Set HeatingThresholdTemperature: ${this.HeatingThresholdTemperature},` +
|
|
465
|
+
` CurrentTemperatureCached: ${this.accessory.context.CurrentTemperature}`);
|
|
473
466
|
this.pushAirConditionerStatusChanges();
|
|
474
467
|
}
|
|
475
468
|
|
|
476
469
|
async CoolingThresholdTemperatureGet(): Promise<CharacteristicValue> {
|
|
477
|
-
this.
|
|
470
|
+
await this.context();
|
|
478
471
|
this.CurrentTemperature = this.accessory.context.CurrentTemperature;
|
|
479
472
|
this.CoolingThresholdTemperature = this.accessory.context.CurrentTemperature;
|
|
480
473
|
this.accessory.context.CoolingThresholdTemperature = this.CoolingThresholdTemperature;
|
|
@@ -483,25 +476,12 @@ export class AirConditioner {
|
|
|
483
476
|
}
|
|
484
477
|
|
|
485
478
|
async CoolingThresholdTemperatureSet(value: CharacteristicValue): Promise<void> {
|
|
486
|
-
this.accessory.context.CurrentTemperature = this.CurrentTemperature;
|
|
487
479
|
this.CurrentTemperature = value;
|
|
488
|
-
this.accessory.
|
|
489
|
-
|
|
490
|
-
`${this.device.remoteType}: ${this.accessory.displayName} Set CoolingThresholdTemperature: ${this.CoolingThresholdTemperature},` +
|
|
491
|
-
` CurrentTemperatureCached: ${this.accessory.context.CurrentTemperature}`,
|
|
492
|
-
);
|
|
480
|
+
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} Set CoolingThresholdTemperature: ${this.CoolingThresholdTemperature},` +
|
|
481
|
+
` CurrentTemperatureCached: ${this.accessory.context.CurrentTemperature}`);
|
|
493
482
|
this.pushAirConditionerStatusChanges();
|
|
494
483
|
}
|
|
495
484
|
|
|
496
|
-
async CurrentTemperatureUndefined(): Promise<void> {
|
|
497
|
-
if (this.CurrentTemperature === undefined) {
|
|
498
|
-
this.CurrentTemperature = 24;
|
|
499
|
-
}
|
|
500
|
-
if (this.accessory.context.CurrentTemperature === undefined) {
|
|
501
|
-
this.CurrentTemperature = 30;
|
|
502
|
-
}
|
|
503
|
-
}
|
|
504
|
-
|
|
505
485
|
async updateHomeKitCharacteristics(): Promise<void> {
|
|
506
486
|
if (this.Active === undefined) {
|
|
507
487
|
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} Active: ${this.Active}`);
|
|
@@ -668,7 +648,7 @@ export class AirConditioner {
|
|
|
668
648
|
return FirmwareRevision;
|
|
669
649
|
}
|
|
670
650
|
|
|
671
|
-
async context(
|
|
651
|
+
async context(): Promise<void> {
|
|
672
652
|
if (this.Active === undefined) {
|
|
673
653
|
this.Active = this.platform.Characteristic.Active.INACTIVE;
|
|
674
654
|
} else {
|
|
@@ -679,11 +659,14 @@ export class AirConditioner {
|
|
|
679
659
|
} else {
|
|
680
660
|
this.CurrentTemperature = this.accessory.context.CurrentTemperature;
|
|
681
661
|
}
|
|
682
|
-
if (
|
|
683
|
-
this.
|
|
662
|
+
if (this.accessory.context.CurrentTemperature === undefined) {
|
|
663
|
+
this.CurrentTemperature = 30;
|
|
664
|
+
}
|
|
665
|
+
if (this.device.irair?.hide_automode) {
|
|
666
|
+
this.hide_automode = this.device.irair?.hide_automode;
|
|
684
667
|
this.accessory.context.hide_automode = this.hide_automode;
|
|
685
668
|
} else {
|
|
686
|
-
this.hide_automode = device.irair?.hide_automode;
|
|
669
|
+
this.hide_automode = this.device.irair?.hide_automode;
|
|
687
670
|
this.accessory.context.hide_automode = this.hide_automode;
|
|
688
671
|
}
|
|
689
672
|
}
|
|
@@ -94,7 +94,6 @@ export class AirPurifier {
|
|
|
94
94
|
* they are updated, so we are only updating the accessory state after calling the above.
|
|
95
95
|
*/
|
|
96
96
|
this.Active = value;
|
|
97
|
-
this.accessory.context.Active = this.Active;
|
|
98
97
|
}
|
|
99
98
|
|
|
100
99
|
async TargetAirPurifierStateSet(value: CharacteristicValue): Promise<void> {
|
|
@@ -134,7 +133,7 @@ export class AirPurifier {
|
|
|
134
133
|
* AirPurifier: "command" "highSpeed" "default" = fan speed to high
|
|
135
134
|
*/
|
|
136
135
|
async pushAirPurifierOnChanges(): Promise<void> {
|
|
137
|
-
if (this.Active
|
|
136
|
+
if (this.Active === this.platform.Characteristic.Active.INACTIVE || this.allowPushOn) {
|
|
138
137
|
const commandType: string = await this.commandType();
|
|
139
138
|
const command: string = await this.commandOn();
|
|
140
139
|
const body = superStringify({
|
|
@@ -147,9 +146,9 @@ export class AirPurifier {
|
|
|
147
146
|
}
|
|
148
147
|
|
|
149
148
|
async pushAirPurifierOffChanges(): Promise<void> {
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
149
|
+
if (this.Active === this.platform.Characteristic.Active.ACTIVE || this.allowPushOn) {
|
|
150
|
+
const commandType: string = await this.commandType();
|
|
151
|
+
const command: string = await this.commandOff();
|
|
153
152
|
const body = superStringify({
|
|
154
153
|
'command': command,
|
|
155
154
|
'parameter': 'default',
|
package/src/irdevice/camera.ts
CHANGED
|
@@ -70,7 +70,6 @@ export class Camera {
|
|
|
70
70
|
* they are updated, so we are only updating the accessory state after calling the above.
|
|
71
71
|
*/
|
|
72
72
|
this.On = value;
|
|
73
|
-
this.accessory.context.On = this.On;
|
|
74
73
|
}
|
|
75
74
|
|
|
76
75
|
/**
|
|
@@ -84,7 +83,7 @@ export class Camera {
|
|
|
84
83
|
* Camera - "command" "channelSub" "default" = previous channel
|
|
85
84
|
*/
|
|
86
85
|
async pushOnChanges(): Promise<void> {
|
|
87
|
-
if (this.On) {
|
|
86
|
+
if (this.On || this.allowPushOn) {
|
|
88
87
|
const commandType: string = await this.commandType();
|
|
89
88
|
const command: string = await this.commandOn();
|
|
90
89
|
const body = superStringify({
|
|
@@ -99,7 +98,7 @@ export class Camera {
|
|
|
99
98
|
async pushOffChanges(): Promise<void> {
|
|
100
99
|
const commandType: string = await this.commandType();
|
|
101
100
|
const command: string = await this.commandOff();
|
|
102
|
-
if (!this.On) {
|
|
101
|
+
if (!this.On || this.allowPushOff) {
|
|
103
102
|
const body = superStringify({
|
|
104
103
|
'command': command,
|
|
105
104
|
'parameter': 'default',
|
|
@@ -109,7 +108,7 @@ export class Camera {
|
|
|
109
108
|
}
|
|
110
109
|
}
|
|
111
110
|
|
|
112
|
-
async pushChanges(body): Promise<void> {
|
|
111
|
+
async pushChanges(body: any): Promise<void> {
|
|
113
112
|
if (this.device.connectionType === 'OpenAPI') {
|
|
114
113
|
try {
|
|
115
114
|
// Make Push On request to the API
|
package/src/irdevice/fan.ts
CHANGED
|
@@ -161,7 +161,6 @@ export class Fan {
|
|
|
161
161
|
* they are updated, so we are only updating the accessory state after calling the above.
|
|
162
162
|
*/
|
|
163
163
|
this.Active = value;
|
|
164
|
-
this.accessory.context.Active = this.Active;
|
|
165
164
|
}
|
|
166
165
|
|
|
167
166
|
/**
|
|
@@ -174,7 +173,7 @@ export class Fan {
|
|
|
174
173
|
* Fan - "command" "highSpeed" "default" = fan speed to high
|
|
175
174
|
*/
|
|
176
175
|
async pushFanOnChanges(): Promise<void> {
|
|
177
|
-
if (this.Active
|
|
176
|
+
if (this.Active === this.platform.Characteristic.Active.INACTIVE || this.allowPushOn) {
|
|
178
177
|
const commandType: string = await this.commandType();
|
|
179
178
|
const command: string = await this.commandOn();
|
|
180
179
|
const body = superStringify({
|
|
@@ -187,14 +186,16 @@ export class Fan {
|
|
|
187
186
|
}
|
|
188
187
|
|
|
189
188
|
async pushFanOffChanges(): Promise<void> {
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
189
|
+
if (this.Active === this.platform.Characteristic.Active.ACTIVE || this.allowPushOff) {
|
|
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);
|
|
198
|
+
}
|
|
198
199
|
}
|
|
199
200
|
|
|
200
201
|
async pushFanSpeedUpChanges(): Promise<void> {
|
package/src/irdevice/light.ts
CHANGED
|
@@ -70,7 +70,6 @@ export class Light {
|
|
|
70
70
|
* they are updated, so we are only updating the accessory state after calling the above.
|
|
71
71
|
*/
|
|
72
72
|
this.On = value;
|
|
73
|
-
this.accessory.context.On = this.On;
|
|
74
73
|
}
|
|
75
74
|
|
|
76
75
|
/**
|
|
@@ -84,7 +83,7 @@ export class Light {
|
|
|
84
83
|
* Light - "command" "channelSub" "default" = previous channel
|
|
85
84
|
*/
|
|
86
85
|
async pushLightOnChanges(): Promise<void> {
|
|
87
|
-
if (this.On) {
|
|
86
|
+
if (this.On || this.allowPushOn) {
|
|
88
87
|
const commandType: string = await this.commandType();
|
|
89
88
|
const command: string = await this.commandOn();
|
|
90
89
|
const body = superStringify({
|
|
@@ -97,7 +96,7 @@ export class Light {
|
|
|
97
96
|
}
|
|
98
97
|
|
|
99
98
|
async pushLightOffChanges(): Promise<void> {
|
|
100
|
-
if (!this.On) {
|
|
99
|
+
if (!this.On || this.allowPushOff) {
|
|
101
100
|
const commandType: string = await this.commandType();
|
|
102
101
|
const command: string = await this.commandOff();
|
|
103
102
|
const body = superStringify({
|
package/src/irdevice/other.ts
CHANGED
|
@@ -78,7 +78,6 @@ export class Others {
|
|
|
78
78
|
* they are updated, so we are only updating the accessory state after calling the above.
|
|
79
79
|
*/
|
|
80
80
|
this.Active = value;
|
|
81
|
-
this.accessory.context.Active = this.Active;
|
|
82
81
|
}
|
|
83
82
|
|
|
84
83
|
/**
|
|
@@ -182,6 +181,7 @@ export class Others {
|
|
|
182
181
|
if (this.Active === undefined) {
|
|
183
182
|
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} Active: ${this.Active}`);
|
|
184
183
|
} else {
|
|
184
|
+
this.accessory.context.Active = this.Active;
|
|
185
185
|
this.fanService?.updateCharacteristic(this.platform.Characteristic.Active, this.Active);
|
|
186
186
|
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} updateCharacteristic Active: ${this.Active}`);
|
|
187
187
|
}
|
package/src/irdevice/tv.ts
CHANGED
|
@@ -202,8 +202,6 @@ export class TV {
|
|
|
202
202
|
|
|
203
203
|
async ActiveSet(value: CharacteristicValue): Promise<void> {
|
|
204
204
|
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} Active: ${value}`);
|
|
205
|
-
this.Active = value;
|
|
206
|
-
this.accessory.context.Active = this.Active;
|
|
207
205
|
if (!this.device.irtv?.disable_power) {
|
|
208
206
|
if (value === this.platform.Characteristic.Active.INACTIVE) {
|
|
209
207
|
await this.pushTvOffChanges();
|
|
@@ -215,7 +213,6 @@ export class TV {
|
|
|
215
213
|
* they are updated, so we are only updating the accessory state after calling the above.
|
|
216
214
|
*/
|
|
217
215
|
this.Active = value;
|
|
218
|
-
this.accessory.context.Active = this.Active;
|
|
219
216
|
}
|
|
220
217
|
}
|
|
221
218
|
|
|
@@ -230,7 +227,7 @@ export class TV {
|
|
|
230
227
|
* TV "command" "channelSub" "default" previous channel
|
|
231
228
|
*/
|
|
232
229
|
async pushTvOnChanges(): Promise<void> {
|
|
233
|
-
if (this.Active
|
|
230
|
+
if (this.Active === this.platform.Characteristic.Active.INACTIVE || this.allowPushOn) {
|
|
234
231
|
const commandType: string = await this.commandType();
|
|
235
232
|
const command: string = await this.commandOn();
|
|
236
233
|
const body = superStringify({
|
|
@@ -243,14 +240,16 @@ export class TV {
|
|
|
243
240
|
}
|
|
244
241
|
|
|
245
242
|
async pushTvOffChanges(): Promise<void> {
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
243
|
+
if (this.Active === this.platform.Characteristic.Active.ACTIVE || this.allowPushOn) {
|
|
244
|
+
const commandType: string = await this.commandType();
|
|
245
|
+
const command: string = await this.commandOff();
|
|
246
|
+
const body = superStringify({
|
|
247
|
+
'command': command,
|
|
248
|
+
'parameter': 'default',
|
|
249
|
+
'commandType': commandType,
|
|
250
|
+
});
|
|
251
|
+
await this.pushTVChanges(body);
|
|
252
|
+
}
|
|
254
253
|
}
|
|
255
254
|
|
|
256
255
|
async pushOkChanges(): Promise<void> {
|
|
@@ -70,7 +70,6 @@ export class VacuumCleaner {
|
|
|
70
70
|
* they are updated, so we are only updating the accessory state after calling the above.
|
|
71
71
|
*/
|
|
72
72
|
this.On = value;
|
|
73
|
-
this.accessory.context.On = this.On;
|
|
74
73
|
}
|
|
75
74
|
|
|
76
75
|
/**
|
|
@@ -80,7 +79,7 @@ export class VacuumCleaner {
|
|
|
80
79
|
* Vacuum Cleaner "command" "turnOn" "default" set to ON state
|
|
81
80
|
*/
|
|
82
81
|
async pushOnChanges(): Promise<void> {
|
|
83
|
-
if (this.On) {
|
|
82
|
+
if (this.On || this.allowPushOn) {
|
|
84
83
|
const commandType: string = await this.commandType();
|
|
85
84
|
const command: string = await this.commandOn();
|
|
86
85
|
const body = superStringify({
|
|
@@ -93,7 +92,7 @@ export class VacuumCleaner {
|
|
|
93
92
|
}
|
|
94
93
|
|
|
95
94
|
async pushOffChanges(): Promise<void> {
|
|
96
|
-
if (!this.On) {
|
|
95
|
+
if (!this.On || this.allowPushOff) {
|
|
97
96
|
const commandType: string = await this.commandType();
|
|
98
97
|
const command: string = await this.commandOff();
|
|
99
98
|
const body = superStringify({
|
|
@@ -76,7 +76,6 @@ export class WaterHeater {
|
|
|
76
76
|
* they are updated, so we are only updating the accessory state after calling the above.
|
|
77
77
|
*/
|
|
78
78
|
this.Active = value;
|
|
79
|
-
this.accessory.context.Active = this.Active;
|
|
80
79
|
}
|
|
81
80
|
|
|
82
81
|
/**
|
|
@@ -86,7 +85,7 @@ export class WaterHeater {
|
|
|
86
85
|
* WaterHeater "command" "turnOn" "default" set to ON state
|
|
87
86
|
*/
|
|
88
87
|
async pushWaterHeaterOnChanges(): Promise<void> {
|
|
89
|
-
if (this.Active
|
|
88
|
+
if (this.Active === this.platform.Characteristic.Active.INACTIVE || this.allowPushOn) {
|
|
90
89
|
const commandType: string = await this.commandType();
|
|
91
90
|
const command: string = await this.commandOn();
|
|
92
91
|
const body = superStringify({
|
|
@@ -99,7 +98,7 @@ export class WaterHeater {
|
|
|
99
98
|
}
|
|
100
99
|
|
|
101
100
|
async pushWaterHeaterOffChanges(): Promise<void> {
|
|
102
|
-
if (this.Active
|
|
101
|
+
if (this.Active === this.platform.Characteristic.Active.ACTIVE || this.allowPushOff) {
|
|
103
102
|
const commandType: string = await this.commandType();
|
|
104
103
|
const command: string = await this.commandOff();
|
|
105
104
|
const body = superStringify({
|
package/src/settings.ts
CHANGED
|
@@ -314,8 +314,18 @@ export type serviceData = {
|
|
|
314
314
|
modelName: string;
|
|
315
315
|
//Mode for Bot either Press or Switch
|
|
316
316
|
mode?: boolean;
|
|
317
|
-
//Bot State
|
|
318
|
-
state?: string;
|
|
317
|
+
//Bot/ColorBulb State
|
|
318
|
+
state?: string | boolean;
|
|
319
|
+
//ColorBulb Power
|
|
320
|
+
power?: boolean;
|
|
321
|
+
//ColorBulb R
|
|
322
|
+
red?: number;
|
|
323
|
+
//ColorBulb G
|
|
324
|
+
green?: number;
|
|
325
|
+
//ColorBulb B
|
|
326
|
+
blue?: number;
|
|
327
|
+
//ColorBulb Color temperature
|
|
328
|
+
color_temperature?: number;
|
|
319
329
|
//Battery percentage left on Bot, Meter, Motion, Contact, PlugMini, and Curtain
|
|
320
330
|
battery?: number;
|
|
321
331
|
//Humidifier's humidity level percentage
|
|
@@ -343,6 +353,8 @@ export type serviceData = {
|
|
|
343
353
|
calibration?: boolean;
|
|
344
354
|
//Current Curtain Positon %
|
|
345
355
|
position?: number;
|
|
356
|
+
//Is Curtain Moving?
|
|
357
|
+
inMotion?: boolean;
|
|
346
358
|
//PlugMini - Is there a delay?
|
|
347
359
|
delay?: boolean;
|
|
348
360
|
//PlugMini - Is there a Timer?
|