@switchbot/homebridge-switchbot 3.5.1-beta.10 → 3.5.1-beta.11
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/dist/device/ceilinglight.d.ts.map +1 -1
- package/dist/device/ceilinglight.js +3 -4
- package/dist/device/ceilinglight.js.map +1 -1
- package/dist/device/colorbulb.js +1 -1
- package/dist/device/colorbulb.js.map +1 -1
- package/dist/irdevice/airconditioner.d.ts.map +1 -1
- package/dist/irdevice/airconditioner.js +45 -51
- package/dist/irdevice/airconditioner.js.map +1 -1
- package/dist/irdevice/airpurifier.d.ts.map +1 -1
- package/dist/irdevice/airpurifier.js +17 -17
- package/dist/irdevice/airpurifier.js.map +1 -1
- package/dist/irdevice/camera.d.ts.map +1 -1
- package/dist/irdevice/camera.js +9 -9
- package/dist/irdevice/camera.js.map +1 -1
- package/dist/irdevice/fan.d.ts.map +1 -1
- package/dist/irdevice/fan.js +19 -19
- package/dist/irdevice/fan.js.map +1 -1
- package/dist/irdevice/irdevice.d.ts +22 -10
- package/dist/irdevice/irdevice.d.ts.map +1 -1
- package/dist/irdevice/irdevice.js +89 -67
- package/dist/irdevice/irdevice.js.map +1 -1
- package/dist/irdevice/light.d.ts.map +1 -1
- package/dist/irdevice/light.js +15 -17
- package/dist/irdevice/light.js.map +1 -1
- package/dist/irdevice/other.d.ts.map +1 -1
- package/dist/irdevice/other.js +76 -76
- package/dist/irdevice/other.js.map +1 -1
- package/dist/irdevice/tv.d.ts.map +1 -1
- package/dist/irdevice/tv.js +35 -35
- package/dist/irdevice/tv.js.map +1 -1
- package/dist/irdevice/vacuumcleaner.d.ts.map +1 -1
- package/dist/irdevice/vacuumcleaner.js +9 -9
- package/dist/irdevice/vacuumcleaner.js.map +1 -1
- package/dist/irdevice/waterheater.d.ts.map +1 -1
- package/dist/irdevice/waterheater.js +9 -9
- package/dist/irdevice/waterheater.js.map +1 -1
- package/dist/platform.d.ts +1 -1
- package/dist/platform.d.ts.map +1 -1
- package/dist/platform.js +202 -201
- package/dist/platform.js.map +1 -1
- package/package.json +1 -1
- package/src/device/ceilinglight.ts +3 -6
- package/src/device/colorbulb.ts +1 -1
- package/src/irdevice/airconditioner.ts +45 -51
- package/src/irdevice/airpurifier.ts +17 -17
- package/src/irdevice/camera.ts +9 -9
- package/src/irdevice/fan.ts +19 -19
- package/src/irdevice/irdevice.ts +92 -68
- package/src/irdevice/light.ts +15 -17
- package/src/irdevice/other.ts +76 -76
- package/src/irdevice/tv.ts +35 -35
- package/src/irdevice/vacuumcleaner.ts +9 -9
- package/src/irdevice/waterheater.ts +9 -9
- package/src/platform.ts +202 -201
|
@@ -181,7 +181,7 @@ export class AirConditioner extends irdeviceBase {
|
|
|
181
181
|
* AirConditioner: "command" "highSpeed" "default" = fan speed to high
|
|
182
182
|
*/
|
|
183
183
|
async pushAirConditionerOnChanges(): Promise<void> {
|
|
184
|
-
this.debugLog(
|
|
184
|
+
await this.debugLog(`pushAirConditionerOnChanges Active: ${this.HeaterCooler.Active},`
|
|
185
185
|
+ ` disablePushOn: ${this.disablePushOn}`);
|
|
186
186
|
if (this.HeaterCooler.Active === this.hap.Characteristic.Active.ACTIVE && !this.disablePushOn) {
|
|
187
187
|
const commandType: string = await this.commandType();
|
|
@@ -196,7 +196,7 @@ export class AirConditioner extends irdeviceBase {
|
|
|
196
196
|
}
|
|
197
197
|
|
|
198
198
|
async pushAirConditionerOffChanges(): Promise<void> {
|
|
199
|
-
this.debugLog(
|
|
199
|
+
await this.debugLog(`pushAirConditionerOffChanges Active: ${this.HeaterCooler.Active},`
|
|
200
200
|
+ ` disablePushOff: ${this.disablePushOff}`);
|
|
201
201
|
if (this.HeaterCooler.Active === this.hap.Characteristic.Active.INACTIVE && !this.disablePushOff) {
|
|
202
202
|
const commandType: string = await this.commandType();
|
|
@@ -211,7 +211,7 @@ export class AirConditioner extends irdeviceBase {
|
|
|
211
211
|
}
|
|
212
212
|
|
|
213
213
|
async pushAirConditionerStatusChanges(): Promise<void> {
|
|
214
|
-
this.debugLog(
|
|
214
|
+
await this.debugLog(`pushAirConditionerStatusChanges Active: ${this.HeaterCooler.Active},`
|
|
215
215
|
+ ` disablePushOff: ${this.disablePushOff}, disablePushOn: ${this.disablePushOn}`);
|
|
216
216
|
if (!this.Busy) {
|
|
217
217
|
this.Busy = true;
|
|
@@ -224,7 +224,7 @@ export class AirConditioner extends irdeviceBase {
|
|
|
224
224
|
}
|
|
225
225
|
|
|
226
226
|
async pushAirConditionerDetailsChanges(): Promise<void> {
|
|
227
|
-
this.debugLog(
|
|
227
|
+
await this.debugLog(`pushAirConditionerDetailsChanges Active: ${this.HeaterCooler.Active},`
|
|
228
228
|
+ ` disablePushOff: ${this.disablePushOff}, disablePushOn: ${this.disablePushOn}`);
|
|
229
229
|
//await this.deviceContext();
|
|
230
230
|
if (this.CurrentMode === undefined) {
|
|
@@ -241,7 +241,7 @@ export class AirConditioner extends irdeviceBase {
|
|
|
241
241
|
if (this.CurrentMode === 1) {
|
|
242
242
|
// Remove or make configurable?
|
|
243
243
|
this.HeaterCooler.ThresholdTemperature = 25;
|
|
244
|
-
this.debugLog(
|
|
244
|
+
await this.debugLog(`CurrentMode: ${this.CurrentMode},`
|
|
245
245
|
+ ` ThresholdTemperature: ${this.HeaterCooler.ThresholdTemperature}`);
|
|
246
246
|
}
|
|
247
247
|
const parameter = `${this.HeaterCooler.ThresholdTemperature},${this.CurrentMode},${this.CurrentFanSpeed},${this.state}`;
|
|
@@ -344,9 +344,9 @@ export class AirConditioner extends irdeviceBase {
|
|
|
344
344
|
}
|
|
345
345
|
|
|
346
346
|
async pushChanges(bodyChange: any): Promise<void> {
|
|
347
|
-
this.debugLog(
|
|
347
|
+
await this.debugLog('pushChanges');
|
|
348
348
|
if (this.device.connectionType === 'OpenAPI' && !this.disablePushDetail) {
|
|
349
|
-
this.infoLog(
|
|
349
|
+
await this.infoLog(`Sending request to SwitchBot API, body: ${bodyChange},`);
|
|
350
350
|
try {
|
|
351
351
|
const { body, statusCode } = await this.pushChangeRequest(bodyChange);
|
|
352
352
|
const deviceStatus: any = await body.json();
|
|
@@ -363,35 +363,33 @@ export class AirConditioner extends irdeviceBase {
|
|
|
363
363
|
await this.pushChangeError(e);
|
|
364
364
|
}
|
|
365
365
|
} else {
|
|
366
|
-
this.warnLog(
|
|
367
|
-
|
|
368
|
-
this.
|
|
369
|
-
+ ` Connection Type: ${this.device.connectionType}, disablePushDetails: ${this.disablePushDetail}`);
|
|
370
|
-
this.updateHomeKitCharacteristics();
|
|
366
|
+
await this.warnLog(`Connection Type: ${this.device.connectionType}, commands will not be sent to OpenAPI`);
|
|
367
|
+
await this.debugLog(`Connection Type: ${this.device.connectionType}, disablePushDetails: ${this.disablePushDetail}`);
|
|
368
|
+
await this.updateHomeKitCharacteristics();
|
|
371
369
|
}
|
|
372
370
|
}
|
|
373
371
|
|
|
374
372
|
async CurrentTemperatureGet(): Promise<CharacteristicValue> {
|
|
375
373
|
if (this.meter?.context?.CurrentTemperature) {
|
|
376
374
|
this.accessory.context.CurrentTemperature = this.meter.context.CurrentTemperature;
|
|
377
|
-
this.debugLog(
|
|
375
|
+
await this.debugLog(''
|
|
378
376
|
+ `Using CurrentTemperature from ${this.meter.context.deviceType} (${this.meter.context.deviceID})`);
|
|
379
377
|
}
|
|
380
378
|
|
|
381
379
|
this.HeaterCooler.CurrentTemperature = this.accessory.context.CurrentTemperature || 24;
|
|
382
|
-
this.debugLog(
|
|
380
|
+
await this.debugLog(`Get CurrentTemperature: ${this.HeaterCooler.CurrentTemperature}`);
|
|
383
381
|
return this.HeaterCooler.CurrentTemperature;
|
|
384
382
|
}
|
|
385
383
|
|
|
386
384
|
async CurrentRelativeHumidityGet(): Promise<CharacteristicValue> {
|
|
387
385
|
if (this.meter?.context?.CurrentRelativeHumidity) {
|
|
388
386
|
this.accessory.context.CurrentRelativeHumidity = this.meter.context.CurrentRelativeHumidity;
|
|
389
|
-
this.debugLog(
|
|
387
|
+
await this.debugLog(''
|
|
390
388
|
+ `Using CurrentRelativeHumidity from ${this.meter.context.deviceType} (${this.meter.context.deviceID})`);
|
|
391
389
|
}
|
|
392
390
|
|
|
393
391
|
this.HumiditySensor!.CurrentRelativeHumidity = this.accessory.context.CurrentRelativeHumidity || 0;
|
|
394
|
-
this.debugLog(
|
|
392
|
+
await this.debugLog('Get'
|
|
395
393
|
+ ` CurrentRelativeHumidity: ${this.HumiditySensor!.CurrentRelativeHumidity}`);
|
|
396
394
|
return this.HumiditySensor!.CurrentRelativeHumidity as CharacteristicValue;
|
|
397
395
|
}
|
|
@@ -402,7 +400,7 @@ export class AirConditioner extends irdeviceBase {
|
|
|
402
400
|
} else {
|
|
403
401
|
this.HeaterCooler.RotationSpeed = this.CurrentFanSpeed - 1;
|
|
404
402
|
}
|
|
405
|
-
this.debugLog(
|
|
403
|
+
await this.debugLog(`Get RotationSpeed: ${this.HeaterCooler.RotationSpeed}`);
|
|
406
404
|
return this.HeaterCooler.RotationSpeed;
|
|
407
405
|
}
|
|
408
406
|
|
|
@@ -413,24 +411,23 @@ export class AirConditioner extends irdeviceBase {
|
|
|
413
411
|
this.CurrentFanSpeed = Number(value) + 1;
|
|
414
412
|
}
|
|
415
413
|
this.HeaterCooler.RotationSpeed = value;
|
|
416
|
-
this.debugLog(
|
|
417
|
-
+ `Set RotationSpeed: ${this.HeaterCooler.RotationSpeed}, CurrentFanSpeed: ${this.CurrentFanSpeed}`);
|
|
414
|
+
await this.debugLog(`Set RotationSpeed: ${this.HeaterCooler.RotationSpeed}, CurrentFanSpeed: ${this.CurrentFanSpeed}`);
|
|
418
415
|
this.pushAirConditionerStatusChanges();
|
|
419
416
|
}
|
|
420
417
|
|
|
421
418
|
async ActiveSet(value: CharacteristicValue): Promise<void> {
|
|
422
|
-
this.debugLog(
|
|
419
|
+
await this.debugLog(`Set Active: ${value}`);
|
|
423
420
|
|
|
424
421
|
this.HeaterCooler.Active = value;
|
|
425
422
|
if (this.HeaterCooler.Active === this.hap.Characteristic.Active.ACTIVE) {
|
|
426
|
-
this.debugLog(
|
|
423
|
+
await this.debugLog(`pushAirConditionerOnChanges, Active: ${this.HeaterCooler.Active}`);
|
|
427
424
|
if (this.disablePushOn) {
|
|
428
425
|
this.pushAirConditionerStatusChanges();
|
|
429
426
|
} else {
|
|
430
427
|
this.pushAirConditionerOnChanges();
|
|
431
428
|
}
|
|
432
429
|
} else {
|
|
433
|
-
this.debugLog(
|
|
430
|
+
await this.debugLog(`pushAirConditionerOffChanges, Active: ${this.HeaterCooler.Active}`);
|
|
434
431
|
this.pushAirConditionerOffChanges();
|
|
435
432
|
}
|
|
436
433
|
}
|
|
@@ -438,7 +435,7 @@ export class AirConditioner extends irdeviceBase {
|
|
|
438
435
|
async TargetHeaterCoolerStateGet(): Promise<CharacteristicValue> {
|
|
439
436
|
const targetState = this.HeaterCooler.TargetHeaterCoolerState || this.accessory.context.TargetHeaterCoolerState;
|
|
440
437
|
this.HeaterCooler.TargetHeaterCoolerState = this.ValidValues.includes(targetState) ? targetState : this.ValidValues[0];
|
|
441
|
-
this.debugLog(
|
|
438
|
+
await this.debugLog(`Get (${this.getTargetHeaterCoolerStateName()}) TargetHeaterCoolerState:`
|
|
442
439
|
+ ` ${this.HeaterCooler.TargetHeaterCoolerState}, ValidValues: ${this.ValidValues}, hide_automode: ${this.hide_automode}`);
|
|
443
440
|
return this.HeaterCooler.TargetHeaterCoolerState;
|
|
444
441
|
}
|
|
@@ -451,7 +448,7 @@ export class AirConditioner extends irdeviceBase {
|
|
|
451
448
|
} else if (value === this.hap.Characteristic.TargetHeaterCoolerState.COOL) {
|
|
452
449
|
this.TargetHeaterCoolerStateCOOL();
|
|
453
450
|
} else {
|
|
454
|
-
this.errorLog(
|
|
451
|
+
this.errorLog('Set TargetHeaterCoolerState: '
|
|
455
452
|
+ `${this.HeaterCooler.TargetHeaterCoolerState}, hide_automode: ${this.hide_automode} `);
|
|
456
453
|
}
|
|
457
454
|
this.pushAirConditionerStatusChanges();
|
|
@@ -460,31 +457,30 @@ export class AirConditioner extends irdeviceBase {
|
|
|
460
457
|
async TargetHeaterCoolerStateAUTO(): Promise<void> {
|
|
461
458
|
this.HeaterCooler.TargetHeaterCoolerState = this.hap.Characteristic.TargetHeaterCoolerState.AUTO;
|
|
462
459
|
this.CurrentMode = 1;
|
|
463
|
-
this.debugLog(
|
|
460
|
+
await this.debugLog('Set (AUTO)'
|
|
464
461
|
+ ` TargetHeaterCoolerState: ${this.HeaterCooler.TargetHeaterCoolerState}`);
|
|
465
|
-
this.debugLog(
|
|
462
|
+
await this.debugLog(`Switchbot CurrentMode: ${this.CurrentMode}`);
|
|
466
463
|
}
|
|
467
464
|
|
|
468
465
|
async TargetHeaterCoolerStateCOOL(): Promise<void> {
|
|
469
466
|
this.HeaterCooler.TargetHeaterCoolerState = this.hap.Characteristic.TargetHeaterCoolerState.COOL;
|
|
470
467
|
this.CurrentMode = 2;
|
|
471
|
-
this.debugLog(
|
|
468
|
+
await this.debugLog('Set (COOL)'
|
|
472
469
|
+ ` TargetHeaterCoolerState: ${this.HeaterCooler.TargetHeaterCoolerState}`);
|
|
473
|
-
this.debugLog(
|
|
470
|
+
await this.debugLog(`Switchbot CurrentMode: ${this.CurrentMode}`);
|
|
474
471
|
}
|
|
475
472
|
|
|
476
473
|
async TargetHeaterCoolerStateHEAT(): Promise<void> {
|
|
477
474
|
this.HeaterCooler.TargetHeaterCoolerState = this.hap.Characteristic.TargetHeaterCoolerState.HEAT;
|
|
478
475
|
this.CurrentMode = 5;
|
|
479
|
-
this.debugLog(
|
|
476
|
+
await this.debugLog('Set (HEAT)'
|
|
480
477
|
+ ` TargetHeaterCoolerState: ${this.HeaterCooler.TargetHeaterCoolerState}`);
|
|
481
|
-
this.debugLog(
|
|
478
|
+
await this.debugLog(`Switchbot CurrentMode: ${this.CurrentMode}`);
|
|
482
479
|
}
|
|
483
480
|
|
|
484
481
|
async CurrentHeaterCoolerStateGet(): Promise<CharacteristicValue> {
|
|
485
482
|
await this.UpdateCurrentHeaterCoolerState();
|
|
486
|
-
this.debugLog(
|
|
487
|
-
+ ` Get (${this.getTargetHeaterCoolerStateName()}) CurrentHeaterCoolerState: ${this.HeaterCooler.CurrentHeaterCoolerState}`);
|
|
483
|
+
await this.debugLog(`Get (${this.getTargetHeaterCoolerStateName()}) CurrentHeaterCoolerState: ${this.HeaterCooler.CurrentHeaterCoolerState}`);
|
|
488
484
|
|
|
489
485
|
return this.HeaterCooler.CurrentHeaterCoolerState;
|
|
490
486
|
}
|
|
@@ -538,84 +534,82 @@ export class AirConditioner extends irdeviceBase {
|
|
|
538
534
|
this.HumiditySensor!.CurrentRelativeHumidity = this.HumiditySensor!.CurrentRelativeHumidity || this.accessory.context.CurrentRelativeHumidity;
|
|
539
535
|
}
|
|
540
536
|
}
|
|
541
|
-
this.debugLog(
|
|
537
|
+
await this.debugLog(`Get ThresholdTemperature: ${this.HeaterCooler.ThresholdTemperature}`);
|
|
542
538
|
return this.HeaterCooler.ThresholdTemperature;
|
|
543
539
|
}
|
|
544
540
|
|
|
545
541
|
async ThresholdTemperatureSet(value: CharacteristicValue): Promise<void> {
|
|
546
542
|
this.HeaterCooler.ThresholdTemperature = value;
|
|
547
|
-
this.debugLog(
|
|
543
|
+
await this.debugLog(`Set ThresholdTemperature: ${this.HeaterCooler.ThresholdTemperature},`
|
|
548
544
|
+ ` ThresholdTemperatureCached: ${this.accessory.context.ThresholdTemperature}`);
|
|
549
545
|
this.pushAirConditionerStatusChanges();
|
|
550
546
|
}
|
|
551
547
|
|
|
552
548
|
async updateHomeKitCharacteristics(): Promise<void> {
|
|
549
|
+
await this.debugLog('updateHomeKitCharacteristics');
|
|
553
550
|
// Active
|
|
554
551
|
if (this.HeaterCooler.Active === undefined) {
|
|
555
|
-
this.debugLog(
|
|
552
|
+
await this.debugLog(`Active: ${this.HeaterCooler.Active}`);
|
|
556
553
|
} else {
|
|
557
554
|
this.accessory.context.Active = this.HeaterCooler.Active;
|
|
558
555
|
this.HeaterCooler.Service.updateCharacteristic(this.hap.Characteristic.Active, this.HeaterCooler.Active);
|
|
559
|
-
this.debugLog(
|
|
556
|
+
await this.debugLog(`updateCharacteristic Active: ${this.HeaterCooler.Active}`);
|
|
560
557
|
}
|
|
561
558
|
// RotationSpeed
|
|
562
559
|
if (this.HeaterCooler.RotationSpeed === undefined) {
|
|
563
|
-
this.debugLog(
|
|
560
|
+
await this.debugLog(`RotationSpeed: ${this.HeaterCooler.RotationSpeed}`);
|
|
564
561
|
} else {
|
|
565
562
|
this.accessory.context.RotationSpeed = this.HeaterCooler.RotationSpeed;
|
|
566
563
|
this.HeaterCooler.Service.updateCharacteristic(this.hap.Characteristic.RotationSpeed, this.HeaterCooler.RotationSpeed);
|
|
567
|
-
this.debugLog(
|
|
564
|
+
await this.debugLog('updateCharacteristic'
|
|
568
565
|
+ ` RotationSpeed: ${this.HeaterCooler.RotationSpeed}`);
|
|
569
566
|
}
|
|
570
567
|
// CurrentTemperature
|
|
571
568
|
if (this.HeaterCooler.CurrentTemperature === undefined) {
|
|
572
|
-
this.debugLog(
|
|
569
|
+
await this.debugLog(`CurrentTemperature: ${this.HeaterCooler.CurrentTemperature}`);
|
|
573
570
|
} else {
|
|
574
571
|
this.accessory.context.CurrentTemperature = this.HeaterCooler.CurrentTemperature;
|
|
575
572
|
this.HeaterCooler.Service.updateCharacteristic(this.hap.Characteristic.CurrentTemperature, this.HeaterCooler.CurrentTemperature);
|
|
576
|
-
this.debugLog(
|
|
573
|
+
await this.debugLog('updateCharacteristic'
|
|
577
574
|
+ ` CurrentTemperature: ${this.HeaterCooler.CurrentTemperature}`);
|
|
578
575
|
}
|
|
579
576
|
// CurrentRelativeHumidity
|
|
580
577
|
if (this.meter) {
|
|
581
578
|
if (this.HumiditySensor!.CurrentRelativeHumidity === undefined) {
|
|
582
|
-
this.debugLog(
|
|
583
|
-
+ ` CurrentRelativeHumidity: ${this.HumiditySensor!.CurrentRelativeHumidity}`);
|
|
579
|
+
await this.debugLog(`CurrentRelativeHumidity: ${this.HumiditySensor!.CurrentRelativeHumidity}`);
|
|
584
580
|
} else {
|
|
585
581
|
this.accessory.context.CurrentRelativeHumidity = this.HumiditySensor!.CurrentRelativeHumidity;
|
|
586
582
|
this.HeaterCooler.Service.updateCharacteristic(this.hap.Characteristic.CurrentRelativeHumidity,
|
|
587
583
|
this.HumiditySensor!.CurrentRelativeHumidity);
|
|
588
|
-
this.debugLog(
|
|
584
|
+
await this.debugLog('updateCharacteristic'
|
|
589
585
|
+ ` CurrentRelativeHumidity: ${this.HumiditySensor!.CurrentRelativeHumidity}`);
|
|
590
586
|
}
|
|
591
587
|
}
|
|
592
588
|
// TargetHeaterCoolerState
|
|
593
589
|
if (this.HeaterCooler.TargetHeaterCoolerState === undefined) {
|
|
594
|
-
this.debugLog(
|
|
590
|
+
await this.debugLog(`TargetHeaterCoolerState: ${this.HeaterCooler.TargetHeaterCoolerState}`);
|
|
595
591
|
} else {
|
|
596
592
|
this.accessory.context.TargetHeaterCoolerState = this.HeaterCooler.TargetHeaterCoolerState;
|
|
597
593
|
this.HeaterCooler.Service.updateCharacteristic(this.hap.Characteristic.TargetHeaterCoolerState, this.HeaterCooler.TargetHeaterCoolerState);
|
|
598
|
-
this.debugLog(
|
|
594
|
+
await this.debugLog('updateCharacteristic'
|
|
599
595
|
+ ` TargetHeaterCoolerState: ${this.HeaterCooler.TargetHeaterCoolerState}`);
|
|
600
596
|
}
|
|
601
597
|
// CurrentHeaterCoolerState
|
|
602
598
|
if (this.HeaterCooler.CurrentHeaterCoolerState === undefined) {
|
|
603
|
-
this.debugLog(
|
|
604
|
-
+ ` CurrentHeaterCoolerState: ${this.HeaterCooler.CurrentHeaterCoolerState}`);
|
|
599
|
+
await this.debugLog(`CurrentHeaterCoolerState: ${this.HeaterCooler.CurrentHeaterCoolerState}`);
|
|
605
600
|
} else {
|
|
606
601
|
this.accessory.context.CurrentHeaterCoolerState = this.HeaterCooler.CurrentHeaterCoolerState;
|
|
607
602
|
this.HeaterCooler.Service.updateCharacteristic(this.hap.Characteristic.CurrentHeaterCoolerState, this.HeaterCooler.CurrentHeaterCoolerState);
|
|
608
|
-
this.debugLog(
|
|
609
|
-
+ ` updateCharacteristic CurrentHeaterCoolerState: ${this.HeaterCooler.CurrentHeaterCoolerState}`);
|
|
603
|
+
await this.debugLog(`updateCharacteristic CurrentHeaterCoolerState: ${this.HeaterCooler.CurrentHeaterCoolerState}`);
|
|
610
604
|
}
|
|
611
605
|
// ThresholdTemperature
|
|
612
606
|
if (this.HeaterCooler.ThresholdTemperature === undefined) {
|
|
613
|
-
this.debugLog(
|
|
607
|
+
await this.debugLog(`ThresholdTemperature: ${this.HeaterCooler.ThresholdTemperature}`);
|
|
614
608
|
} else {
|
|
615
609
|
this.accessory.context.ThresholdTemperature = this.HeaterCooler.ThresholdTemperature;
|
|
616
610
|
this.HeaterCooler.Service.updateCharacteristic(this.hap.Characteristic.HeatingThresholdTemperature, this.HeaterCooler.ThresholdTemperature);
|
|
617
611
|
this.HeaterCooler.Service.updateCharacteristic(this.hap.Characteristic.CoolingThresholdTemperature, this.HeaterCooler.ThresholdTemperature);
|
|
618
|
-
this.debugLog(
|
|
612
|
+
await this.debugLog('updateCharacteristic'
|
|
619
613
|
+ ` ThresholdTemperature: ${this.HeaterCooler.ThresholdTemperature}`);
|
|
620
614
|
}
|
|
621
615
|
}
|
|
@@ -106,7 +106,7 @@ export class AirPurifier extends irdeviceBase {
|
|
|
106
106
|
}
|
|
107
107
|
|
|
108
108
|
async ActiveSet(value: CharacteristicValue): Promise<void> {
|
|
109
|
-
this.debugLog(
|
|
109
|
+
await this.debugLog(`Set Active: ${value}`);
|
|
110
110
|
|
|
111
111
|
this.AirPurifier.Active = value;
|
|
112
112
|
if (this.AirPurifier.Active === this.hap.Characteristic.Active.ACTIVE) {
|
|
@@ -153,7 +153,7 @@ export class AirPurifier extends irdeviceBase {
|
|
|
153
153
|
* AirPurifier: "command" "highSpeed" "default" = fan speed to high
|
|
154
154
|
*/
|
|
155
155
|
async pushAirPurifierOnChanges(): Promise<void> {
|
|
156
|
-
this.debugLog(
|
|
156
|
+
await this.debugLog(`pushAirPurifierOnChanges Active: ${this.AirPurifier.Active},`
|
|
157
157
|
+ ` disablePushOn: ${this.disablePushOn}`);
|
|
158
158
|
if (this.AirPurifier.Active === this.hap.Characteristic.Active.ACTIVE && !this.disablePushOn) {
|
|
159
159
|
const commandType: string = await this.commandType();
|
|
@@ -168,7 +168,7 @@ export class AirPurifier extends irdeviceBase {
|
|
|
168
168
|
}
|
|
169
169
|
|
|
170
170
|
async pushAirPurifierOffChanges(): Promise<void> {
|
|
171
|
-
this.debugLog(
|
|
171
|
+
await this.debugLog(`pushAirPurifierOffChanges Active: ${this.AirPurifier.Active},`
|
|
172
172
|
+ ` disablePushOff: ${this.disablePushOff}`);
|
|
173
173
|
if (this.AirPurifier.Active === this.hap.Characteristic.Active.INACTIVE && !this.disablePushOn) {
|
|
174
174
|
const commandType: string = await this.commandType();
|
|
@@ -183,7 +183,7 @@ export class AirPurifier extends irdeviceBase {
|
|
|
183
183
|
}
|
|
184
184
|
|
|
185
185
|
async pushAirPurifierStatusChanges(): Promise<void> {
|
|
186
|
-
this.debugLog(
|
|
186
|
+
await this.debugLog(`pushAirPurifierStatusChanges Active: ${this.AirPurifier.Active},`
|
|
187
187
|
+ ` disablePushOff: ${this.disablePushOff}, disablePushOn: ${this.disablePushOn}`);
|
|
188
188
|
if (!this.Busy) {
|
|
189
189
|
this.Busy = true;
|
|
@@ -196,7 +196,7 @@ export class AirPurifier extends irdeviceBase {
|
|
|
196
196
|
}
|
|
197
197
|
|
|
198
198
|
async pushAirPurifierDetailsChanges(): Promise<void> {
|
|
199
|
-
this.debugLog(
|
|
199
|
+
await this.debugLog(`pushAirPurifierDetailsChanges Active: ${this.AirPurifier.Active},`
|
|
200
200
|
+ ` disablePushOff: ${this.disablePushOff}, disablePushOn: ${this.disablePushOn}`);
|
|
201
201
|
this.CurrentAPTemp = this.TemperatureSensor!.CurrentTemperature ?? 24;
|
|
202
202
|
this.CurrentAPMode = this.CurrentMode ?? 1;
|
|
@@ -221,9 +221,9 @@ export class AirPurifier extends irdeviceBase {
|
|
|
221
221
|
}
|
|
222
222
|
|
|
223
223
|
async pushChanges(bodyChange: any): Promise<void> {
|
|
224
|
-
this.debugLog(
|
|
224
|
+
await this.debugLog('pushChanges');
|
|
225
225
|
if (this.device.connectionType === 'OpenAPI') {
|
|
226
|
-
this.infoLog(
|
|
226
|
+
this.infoLog(`Sending request to SwitchBot API, body: ${bodyChange},`);
|
|
227
227
|
try {
|
|
228
228
|
const { body, statusCode } = await this.pushChangeRequest(bodyChange);
|
|
229
229
|
const deviceStatus: any = await body.json();
|
|
@@ -240,45 +240,45 @@ export class AirPurifier extends irdeviceBase {
|
|
|
240
240
|
await this.pushChangeError(e);
|
|
241
241
|
}
|
|
242
242
|
} else {
|
|
243
|
-
this.warnLog(
|
|
244
|
-
+ ` Connection Type: ${this.device.connectionType}, commands will not be sent to OpenAPI`);
|
|
243
|
+
this.warnLog(`Connection Type: ${this.device.connectionType}, commands will not be sent to OpenAPI`);
|
|
245
244
|
}
|
|
246
245
|
}
|
|
247
246
|
|
|
248
247
|
async updateHomeKitCharacteristics(): Promise<void> {
|
|
248
|
+
await this.debugLog('updateHomeKitCharacteristics');
|
|
249
249
|
// Active
|
|
250
250
|
if (this.AirPurifier.Active === undefined) {
|
|
251
|
-
this.debugLog(
|
|
251
|
+
await this.debugLog(`Active: ${this.AirPurifier.Active}`);
|
|
252
252
|
} else {
|
|
253
253
|
this.accessory.context.Active = this.AirPurifier.Active;
|
|
254
254
|
this.AirPurifier.Service.updateCharacteristic(this.hap.Characteristic.Active, this.AirPurifier.Active);
|
|
255
|
-
this.debugLog(
|
|
255
|
+
await this.debugLog(`updateCharacteristic Active: ${this.AirPurifier.Active}`);
|
|
256
256
|
}
|
|
257
257
|
// CurrentAirPurifierState
|
|
258
258
|
if (this.AirPurifier.CurrentAirPurifierState === undefined) {
|
|
259
|
-
this.debugLog(
|
|
259
|
+
await this.debugLog(`CurrentAirPurifierState: ${this.AirPurifier.CurrentAirPurifierState}`);
|
|
260
260
|
} else {
|
|
261
261
|
this.accessory.context.CurrentAirPurifierState = this.AirPurifier.CurrentAirPurifierState;
|
|
262
262
|
this.AirPurifier.Service.updateCharacteristic(this.hap.Characteristic.CurrentAirPurifierState, this.AirPurifier.CurrentAirPurifierState);
|
|
263
|
-
this.debugLog(
|
|
263
|
+
await this.debugLog('updateCharacteristic'
|
|
264
264
|
+ ` CurrentAirPurifierState: ${this.AirPurifier.CurrentAirPurifierState}`);
|
|
265
265
|
}
|
|
266
266
|
// CurrentHeaterCoolerState
|
|
267
267
|
if (this.CurrentHeaterCoolerState === undefined) {
|
|
268
|
-
this.debugLog(
|
|
268
|
+
await this.debugLog(`CurrentHeaterCoolerState: ${this.CurrentHeaterCoolerState}`);
|
|
269
269
|
} else {
|
|
270
270
|
this.accessory.context.CurrentHeaterCoolerState = this.CurrentHeaterCoolerState;
|
|
271
271
|
this.AirPurifier.Service.updateCharacteristic(this.hap.Characteristic.CurrentHeaterCoolerState, this.CurrentHeaterCoolerState);
|
|
272
|
-
this.debugLog(
|
|
272
|
+
await this.debugLog('updateCharacteristic'
|
|
273
273
|
+ ` CurrentHeaterCoolerState: ${this.CurrentHeaterCoolerState}`);
|
|
274
274
|
}
|
|
275
275
|
// CurrentTemperature
|
|
276
276
|
if (this.TemperatureSensor.CurrentTemperature === undefined) {
|
|
277
|
-
this.debugLog(
|
|
277
|
+
await this.debugLog(`CurrentTemperature: ${this.TemperatureSensor.CurrentTemperature}`);
|
|
278
278
|
} else {
|
|
279
279
|
this.accessory.context.CurrentTemperature = this.TemperatureSensor.CurrentTemperature;
|
|
280
280
|
this.TemperatureSensor.Service.updateCharacteristic(this.hap.Characteristic.CurrentTemperature, this.TemperatureSensor.CurrentTemperature);
|
|
281
|
-
this.debugLog(
|
|
281
|
+
await this.debugLog('updateCharacteristic'
|
|
282
282
|
+ ` CurrentTemperature: ${this.TemperatureSensor.CurrentTemperature}`);
|
|
283
283
|
}
|
|
284
284
|
}
|
package/src/irdevice/camera.ts
CHANGED
|
@@ -48,7 +48,7 @@ export class Camera extends irdeviceBase {
|
|
|
48
48
|
}
|
|
49
49
|
|
|
50
50
|
async OnSet(value: CharacteristicValue): Promise<void> {
|
|
51
|
-
this.debugLog(
|
|
51
|
+
await this.debugLog(`On: ${value}`);
|
|
52
52
|
|
|
53
53
|
this.Switch.On = value;
|
|
54
54
|
if (this.Switch.On) {
|
|
@@ -69,7 +69,7 @@ export class Camera extends irdeviceBase {
|
|
|
69
69
|
* Camera - "command" "channelSub" "default" = previous channel
|
|
70
70
|
*/
|
|
71
71
|
async pushOnChanges(): Promise<void> {
|
|
72
|
-
this.debugLog(
|
|
72
|
+
await this.debugLog(`pushOnChanges On: ${this.Switch.On},`
|
|
73
73
|
+ ` disablePushOn: ${this.disablePushOn}`);
|
|
74
74
|
if (this.Switch.On && !this.disablePushOn) {
|
|
75
75
|
const commandType: string = await this.commandType();
|
|
@@ -84,7 +84,7 @@ export class Camera extends irdeviceBase {
|
|
|
84
84
|
}
|
|
85
85
|
|
|
86
86
|
async pushOffChanges(): Promise<void> {
|
|
87
|
-
this.debugLog(
|
|
87
|
+
await this.debugLog(`pushOffChanges On: ${this.Switch.On},`
|
|
88
88
|
+ ` disablePushOff: ${this.disablePushOff}`);
|
|
89
89
|
if (!this.Switch.On && !this.disablePushOff) {
|
|
90
90
|
const commandType: string = await this.commandType();
|
|
@@ -99,9 +99,9 @@ export class Camera extends irdeviceBase {
|
|
|
99
99
|
}
|
|
100
100
|
|
|
101
101
|
async pushChanges(bodyChange: any): Promise<void> {
|
|
102
|
-
this.debugLog(
|
|
102
|
+
await this.debugLog('pushChanges');
|
|
103
103
|
if (this.device.connectionType === 'OpenAPI') {
|
|
104
|
-
this.infoLog(
|
|
104
|
+
this.infoLog(`Sending request to SwitchBot API, body: ${bodyChange},`);
|
|
105
105
|
try {
|
|
106
106
|
const { body, statusCode } = await this.pushChangeRequest(bodyChange);
|
|
107
107
|
const deviceStatus: any = await body.json();
|
|
@@ -118,19 +118,19 @@ export class Camera extends irdeviceBase {
|
|
|
118
118
|
await this.pushChangeError(e);
|
|
119
119
|
}
|
|
120
120
|
} else {
|
|
121
|
-
this.warnLog(
|
|
122
|
-
+ ` Connection Type: ${this.device.connectionType}, commands will not be sent to OpenAPI`);
|
|
121
|
+
await this.warnLog(`Connection Type: ${this.device.connectionType}, commands will not be sent to OpenAPI`);
|
|
123
122
|
}
|
|
124
123
|
}
|
|
125
124
|
|
|
126
125
|
async updateHomeKitCharacteristics(): Promise<void> {
|
|
126
|
+
await this.debugLog('updateHomeKitCharacteristics');
|
|
127
127
|
// On
|
|
128
128
|
if (this.Switch.On === undefined) {
|
|
129
|
-
this.debugLog(
|
|
129
|
+
await this.debugLog(`On: ${this.Switch.On}`);
|
|
130
130
|
} else {
|
|
131
131
|
this.accessory.context.On = this.Switch.On;
|
|
132
132
|
this.Switch.Service.updateCharacteristic(this.hap.Characteristic.On, this.Switch.On);
|
|
133
|
-
this.debugLog(
|
|
133
|
+
await this.debugLog(`updateCharacteristic On: ${this.Switch.On}`);
|
|
134
134
|
}
|
|
135
135
|
}
|
|
136
136
|
|
package/src/irdevice/fan.ts
CHANGED
|
@@ -68,9 +68,9 @@ export class IRFan extends irdeviceBase {
|
|
|
68
68
|
} else if (this.Fan.Service.testCharacteristic(this.hap.Characteristic.RotationSpeed) && !device.irfan?.swing_mode) {
|
|
69
69
|
const characteristic = this.Fan.Service.getCharacteristic(this.hap.Characteristic.RotationSpeed);
|
|
70
70
|
this.Fan.Service.removeCharacteristic(characteristic);
|
|
71
|
-
this.debugLog(
|
|
71
|
+
this.debugLog('Rotation Speed Characteristic was removed.');
|
|
72
72
|
} else {
|
|
73
|
-
this.debugLog(
|
|
73
|
+
this.debugLog('RotationSpeed Characteristic was not removed/added, '
|
|
74
74
|
+ `Clear Cache on ${this.accessory.displayName} to remove Chracteristic`);
|
|
75
75
|
}
|
|
76
76
|
|
|
@@ -85,15 +85,15 @@ export class IRFan extends irdeviceBase {
|
|
|
85
85
|
} else if (this.Fan.Service.testCharacteristic(this.hap.Characteristic.SwingMode) && !device.irfan?.swing_mode) {
|
|
86
86
|
const characteristic = this.Fan.Service.getCharacteristic(this.hap.Characteristic.SwingMode);
|
|
87
87
|
this.Fan.Service.removeCharacteristic(characteristic);
|
|
88
|
-
this.debugLog(
|
|
88
|
+
this.debugLog('Swing Mode Characteristic was removed.');
|
|
89
89
|
} else {
|
|
90
|
-
this.debugLog(
|
|
90
|
+
this.debugLog('Swing Mode Characteristic was not removed/added, '
|
|
91
91
|
+ `Clear Cache on ${this.accessory.displayName} To Remove Chracteristic`);
|
|
92
92
|
}
|
|
93
93
|
}
|
|
94
94
|
|
|
95
95
|
async SwingModeSet(value: CharacteristicValue): Promise<void> {
|
|
96
|
-
this.debugLog(
|
|
96
|
+
await this.debugLog(`SwingMode: ${value}`);
|
|
97
97
|
if (value > this.Fan.SwingMode) {
|
|
98
98
|
this.Fan.SwingMode = 1;
|
|
99
99
|
await this.pushFanOnChanges();
|
|
@@ -108,7 +108,7 @@ export class IRFan extends irdeviceBase {
|
|
|
108
108
|
}
|
|
109
109
|
|
|
110
110
|
async RotationSpeedSet(value: CharacteristicValue): Promise<void> {
|
|
111
|
-
this.debugLog(
|
|
111
|
+
await this.debugLog(`RotationSpeed: ${value}`);
|
|
112
112
|
if (value > this.Fan.RotationSpeed) {
|
|
113
113
|
this.Fan.RotationSpeed = 1;
|
|
114
114
|
this.pushFanSpeedUpChanges();
|
|
@@ -122,7 +122,7 @@ export class IRFan extends irdeviceBase {
|
|
|
122
122
|
}
|
|
123
123
|
|
|
124
124
|
async ActiveSet(value: CharacteristicValue): Promise<void> {
|
|
125
|
-
this.debugLog(
|
|
125
|
+
await this.debugLog(`Active: ${value}`);
|
|
126
126
|
|
|
127
127
|
this.Fan.Active = value;
|
|
128
128
|
if (this.Fan.Active === this.hap.Characteristic.Active.ACTIVE) {
|
|
@@ -142,7 +142,7 @@ export class IRFan extends irdeviceBase {
|
|
|
142
142
|
* Fan - "command" "highSpeed" "default" = fan speed to high
|
|
143
143
|
*/
|
|
144
144
|
async pushFanOnChanges(): Promise<void> {
|
|
145
|
-
this.debugLog(
|
|
145
|
+
await this.debugLog(`pushFanOnChanges Active: ${this.Fan.Active},`
|
|
146
146
|
+ ` disablePushOn: ${this.disablePushOn}`);
|
|
147
147
|
if (this.Fan.Active === this.hap.Characteristic.Active.ACTIVE && !this.disablePushOn) {
|
|
148
148
|
const commandType: string = await this.commandType();
|
|
@@ -157,7 +157,7 @@ export class IRFan extends irdeviceBase {
|
|
|
157
157
|
}
|
|
158
158
|
|
|
159
159
|
async pushFanOffChanges(): Promise<void> {
|
|
160
|
-
this.debugLog(
|
|
160
|
+
await this.debugLog(`pushLightOffChanges Active: ${this.Fan.Active},`
|
|
161
161
|
+ ` disablePushOff: ${this.disablePushOff}`);
|
|
162
162
|
if (this.Fan.Active === this.hap.Characteristic.Active.INACTIVE && !this.disablePushOff) {
|
|
163
163
|
const commandType: string = await this.commandType();
|
|
@@ -199,9 +199,9 @@ export class IRFan extends irdeviceBase {
|
|
|
199
199
|
}
|
|
200
200
|
|
|
201
201
|
async pushChanges(bodyChange: any): Promise<void> {
|
|
202
|
-
this.debugLog(
|
|
202
|
+
await this.debugLog('pushChanges');
|
|
203
203
|
if (this.device.connectionType === 'OpenAPI') {
|
|
204
|
-
this.infoLog(
|
|
204
|
+
this.infoLog(`Sending request to SwitchBot API, body: ${bodyChange},`);
|
|
205
205
|
try {
|
|
206
206
|
const { body, statusCode } = await this.pushChangeRequest(bodyChange);
|
|
207
207
|
const deviceStatus: any = await body.json();
|
|
@@ -218,32 +218,32 @@ export class IRFan extends irdeviceBase {
|
|
|
218
218
|
await this.pushChangeError(e);
|
|
219
219
|
}
|
|
220
220
|
} else {
|
|
221
|
-
this.warnLog(
|
|
222
|
-
+ ` Connection Type: ${this.device.connectionType}, commands will not be sent to OpenAPI`);
|
|
221
|
+
await this.warnLog(`Connection Type: ${this.device.connectionType}, commands will not be sent to OpenAPI`);
|
|
223
222
|
}
|
|
224
223
|
}
|
|
225
224
|
|
|
226
225
|
async updateHomeKitCharacteristics(): Promise<void> {
|
|
226
|
+
await this.debugLog('updateHomeKitCharacteristics');
|
|
227
227
|
if (this.Fan.Active === undefined) {
|
|
228
|
-
this.debugLog(
|
|
228
|
+
await this.debugLog(`Active: ${this.Fan.Active}`);
|
|
229
229
|
} else {
|
|
230
230
|
this.accessory.context.Active = this.Fan.Active;
|
|
231
231
|
this.Fan.Service.updateCharacteristic(this.hap.Characteristic.Active, this.Fan.Active);
|
|
232
|
-
this.debugLog(
|
|
232
|
+
await this.debugLog(`updateCharacteristic Active: ${this.Fan.Active}`);
|
|
233
233
|
}
|
|
234
234
|
if (this.Fan.SwingMode === undefined) {
|
|
235
|
-
this.debugLog(
|
|
235
|
+
await this.debugLog(`SwingMode: ${this.Fan.SwingMode}`);
|
|
236
236
|
} else {
|
|
237
237
|
this.accessory.context.SwingMode = this.Fan.SwingMode;
|
|
238
238
|
this.Fan.Service.updateCharacteristic(this.hap.Characteristic.SwingMode, this.Fan.SwingMode);
|
|
239
|
-
this.debugLog(
|
|
239
|
+
await this.debugLog(`updateCharacteristic SwingMode: ${this.Fan.SwingMode}`);
|
|
240
240
|
}
|
|
241
241
|
if (this.Fan.RotationSpeed === undefined) {
|
|
242
|
-
this.debugLog(
|
|
242
|
+
await this.debugLog(`RotationSpeed: ${this.Fan.RotationSpeed}`);
|
|
243
243
|
} else {
|
|
244
244
|
this.accessory.context.RotationSpeed = this.Fan.RotationSpeed;
|
|
245
245
|
this.Fan.Service.updateCharacteristic(this.hap.Characteristic.RotationSpeed, this.Fan.RotationSpeed);
|
|
246
|
-
this.debugLog(
|
|
246
|
+
await this.debugLog(`updateCharacteristic RotationSpeed: ${this.Fan.RotationSpeed}`);
|
|
247
247
|
}
|
|
248
248
|
}
|
|
249
249
|
|