@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.
Files changed (54) hide show
  1. package/dist/device/ceilinglight.d.ts.map +1 -1
  2. package/dist/device/ceilinglight.js +3 -4
  3. package/dist/device/ceilinglight.js.map +1 -1
  4. package/dist/device/colorbulb.js +1 -1
  5. package/dist/device/colorbulb.js.map +1 -1
  6. package/dist/irdevice/airconditioner.d.ts.map +1 -1
  7. package/dist/irdevice/airconditioner.js +45 -51
  8. package/dist/irdevice/airconditioner.js.map +1 -1
  9. package/dist/irdevice/airpurifier.d.ts.map +1 -1
  10. package/dist/irdevice/airpurifier.js +17 -17
  11. package/dist/irdevice/airpurifier.js.map +1 -1
  12. package/dist/irdevice/camera.d.ts.map +1 -1
  13. package/dist/irdevice/camera.js +9 -9
  14. package/dist/irdevice/camera.js.map +1 -1
  15. package/dist/irdevice/fan.d.ts.map +1 -1
  16. package/dist/irdevice/fan.js +19 -19
  17. package/dist/irdevice/fan.js.map +1 -1
  18. package/dist/irdevice/irdevice.d.ts +22 -10
  19. package/dist/irdevice/irdevice.d.ts.map +1 -1
  20. package/dist/irdevice/irdevice.js +89 -67
  21. package/dist/irdevice/irdevice.js.map +1 -1
  22. package/dist/irdevice/light.d.ts.map +1 -1
  23. package/dist/irdevice/light.js +15 -17
  24. package/dist/irdevice/light.js.map +1 -1
  25. package/dist/irdevice/other.d.ts.map +1 -1
  26. package/dist/irdevice/other.js +76 -76
  27. package/dist/irdevice/other.js.map +1 -1
  28. package/dist/irdevice/tv.d.ts.map +1 -1
  29. package/dist/irdevice/tv.js +35 -35
  30. package/dist/irdevice/tv.js.map +1 -1
  31. package/dist/irdevice/vacuumcleaner.d.ts.map +1 -1
  32. package/dist/irdevice/vacuumcleaner.js +9 -9
  33. package/dist/irdevice/vacuumcleaner.js.map +1 -1
  34. package/dist/irdevice/waterheater.d.ts.map +1 -1
  35. package/dist/irdevice/waterheater.js +9 -9
  36. package/dist/irdevice/waterheater.js.map +1 -1
  37. package/dist/platform.d.ts +1 -1
  38. package/dist/platform.d.ts.map +1 -1
  39. package/dist/platform.js +202 -201
  40. package/dist/platform.js.map +1 -1
  41. package/package.json +1 -1
  42. package/src/device/ceilinglight.ts +3 -6
  43. package/src/device/colorbulb.ts +1 -1
  44. package/src/irdevice/airconditioner.ts +45 -51
  45. package/src/irdevice/airpurifier.ts +17 -17
  46. package/src/irdevice/camera.ts +9 -9
  47. package/src/irdevice/fan.ts +19 -19
  48. package/src/irdevice/irdevice.ts +92 -68
  49. package/src/irdevice/light.ts +15 -17
  50. package/src/irdevice/other.ts +76 -76
  51. package/src/irdevice/tv.ts +35 -35
  52. package/src/irdevice/vacuumcleaner.ts +9 -9
  53. package/src/irdevice/waterheater.ts +9 -9
  54. 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(`${this.device.remoteType}: ${this.accessory.displayName} pushAirConditionerOnChanges Active: ${this.HeaterCooler.Active},`
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(`${this.device.remoteType}: ${this.accessory.displayName} pushAirConditionerOffChanges Active: ${this.HeaterCooler.Active},`
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(`${this.device.remoteType}: ${this.accessory.displayName} pushAirConditionerStatusChanges Active: ${this.HeaterCooler.Active},`
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(`${this.device.remoteType}: ${this.accessory.displayName} pushAirConditionerDetailsChanges Active: ${this.HeaterCooler.Active},`
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(`${this.device.remoteType}: ${this.accessory.displayName} CurrentMode: ${this.CurrentMode},`
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(`${this.device.remoteType}: ${this.accessory.displayName} pushChanges`);
347
+ await this.debugLog('pushChanges');
348
348
  if (this.device.connectionType === 'OpenAPI' && !this.disablePushDetail) {
349
- this.infoLog(`${this.device.remoteType}: ${this.accessory.displayName} Sending request to SwitchBot API, body: ${bodyChange},`);
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(`${this.device.remoteType}: ${this.accessory.displayName}`
367
- + ` Connection Type: ${this.device.connectionType}, commands will not be sent to OpenAPI`);
368
- this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName}`
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(`${this.device.remoteType}: ${this.accessory.displayName} `
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(`${this.device.remoteType}: ${this.accessory.displayName} Get CurrentTemperature: ${this.HeaterCooler.CurrentTemperature}`);
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(`${this.device.remoteType}: ${this.accessory.displayName} `
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(`${this.device.remoteType}: ${this.accessory.displayName} Get`
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(`${this.device.remoteType}: ${this.accessory.displayName} Get RotationSpeed: ${this.HeaterCooler.RotationSpeed}`);
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(`${this.device.remoteType}: ${this.accessory.displayName}`
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(`${this.device.remoteType}: ${this.accessory.displayName} Set Active: ${value}`);
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(`${this.device.remoteType}: ${this.accessory.displayName} pushAirConditionerOnChanges, Active: ${this.HeaterCooler.Active}`);
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(`${this.device.remoteType}: ${this.accessory.displayName} pushAirConditionerOffChanges, Active: ${this.HeaterCooler.Active}`);
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(`${this.device.remoteType}: ${this.accessory.displayName} Get (${this.getTargetHeaterCoolerStateName()}) TargetHeaterCoolerState:`
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(`${this.device.remoteType}: ${this.accessory.displayName} Set TargetHeaterCoolerState: `
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(`${this.device.remoteType}: ${this.accessory.displayName} Set (AUTO)`
460
+ await this.debugLog('Set (AUTO)'
464
461
  + ` TargetHeaterCoolerState: ${this.HeaterCooler.TargetHeaterCoolerState}`);
465
- this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} Switchbot CurrentMode: ${this.CurrentMode}`);
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(`${this.device.remoteType}: ${this.accessory.displayName} Set (COOL)`
468
+ await this.debugLog('Set (COOL)'
472
469
  + ` TargetHeaterCoolerState: ${this.HeaterCooler.TargetHeaterCoolerState}`);
473
- this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} Switchbot CurrentMode: ${this.CurrentMode}`);
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(`${this.device.remoteType}: ${this.accessory.displayName} Set (HEAT)`
476
+ await this.debugLog('Set (HEAT)'
480
477
  + ` TargetHeaterCoolerState: ${this.HeaterCooler.TargetHeaterCoolerState}`);
481
- this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} Switchbot CurrentMode: ${this.CurrentMode}`);
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(`${this.device.remoteType}: ${this.accessory.displayName}`
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(`${this.device.remoteType}: ${this.accessory.displayName} Get ThresholdTemperature: ${this.HeaterCooler.ThresholdTemperature}`);
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(`${this.device.remoteType}: ${this.accessory.displayName} Set ThresholdTemperature: ${this.HeaterCooler.ThresholdTemperature},`
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(`${this.device.remoteType}: ${this.accessory.displayName} Active: ${this.HeaterCooler.Active}`);
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(`${this.device.remoteType}: ${this.accessory.displayName} updateCharacteristic Active: ${this.HeaterCooler.Active}`);
556
+ await this.debugLog(`updateCharacteristic Active: ${this.HeaterCooler.Active}`);
560
557
  }
561
558
  // RotationSpeed
562
559
  if (this.HeaterCooler.RotationSpeed === undefined) {
563
- this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} RotationSpeed: ${this.HeaterCooler.RotationSpeed}`);
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(`${this.device.remoteType}: ${this.accessory.displayName} updateCharacteristic`
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(`${this.device.remoteType}: ${this.accessory.displayName} CurrentTemperature: ${this.HeaterCooler.CurrentTemperature}`);
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(`${this.device.remoteType}: ${this.accessory.displayName} updateCharacteristic`
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(`${this.device.remoteType}: ${this.accessory.displayName}`
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(`${this.device.remoteType}: ${this.accessory.displayName} updateCharacteristic`
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(`${this.device.remoteType}: ${this.accessory.displayName} TargetHeaterCoolerState: ${this.HeaterCooler.TargetHeaterCoolerState}`);
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(`${this.device.remoteType}: ${this.accessory.displayName} updateCharacteristic`
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(`${this.device.remoteType}: ${this.accessory.displayName}`
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(`${this.device.remoteType}: ${this.accessory.displayName}`
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(`${this.device.remoteType}: ${this.accessory.displayName} ThresholdTemperature: ${this.HeaterCooler.ThresholdTemperature}`);
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(`${this.device.remoteType}: ${this.accessory.displayName} updateCharacteristic`
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(`${this.device.remoteType}: ${this.accessory.displayName} Set Active: ${value}`);
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(`${this.device.remoteType}: ${this.accessory.displayName} pushAirPurifierOnChanges Active: ${this.AirPurifier.Active},`
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(`${this.device.remoteType}: ${this.accessory.displayName} pushAirPurifierOffChanges Active: ${this.AirPurifier.Active},`
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(`${this.device.remoteType}: ${this.accessory.displayName} pushAirPurifierStatusChanges Active: ${this.AirPurifier.Active},`
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(`${this.device.remoteType}: ${this.accessory.displayName} pushAirPurifierDetailsChanges Active: ${this.AirPurifier.Active},`
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(`${this.device.remoteType}: ${this.accessory.displayName} pushChanges`);
224
+ await this.debugLog('pushChanges');
225
225
  if (this.device.connectionType === 'OpenAPI') {
226
- this.infoLog(`${this.device.remoteType}: ${this.accessory.displayName} Sending request to SwitchBot API, body: ${bodyChange},`);
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(`${this.device.remoteType}: ${this.accessory.displayName}`
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(`${this.device.remoteType}: ${this.accessory.displayName} Active: ${this.AirPurifier.Active}`);
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(`${this.device.remoteType}: ${this.accessory.displayName} updateCharacteristic Active: ${this.AirPurifier.Active}`);
255
+ await this.debugLog(`updateCharacteristic Active: ${this.AirPurifier.Active}`);
256
256
  }
257
257
  // CurrentAirPurifierState
258
258
  if (this.AirPurifier.CurrentAirPurifierState === undefined) {
259
- this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} CurrentAirPurifierState: ${this.AirPurifier.CurrentAirPurifierState}`);
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(`${this.device.remoteType}: ${this.accessory.displayName} updateCharacteristic`
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(`${this.device.remoteType}: ${this.accessory.displayName} CurrentHeaterCoolerState: ${this.CurrentHeaterCoolerState}`);
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(`${this.device.remoteType}: ${this.accessory.displayName} updateCharacteristic`
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(`${this.device.remoteType}: ${this.accessory.displayName} CurrentTemperature: ${this.TemperatureSensor.CurrentTemperature}`);
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(`${this.device.remoteType}: ${this.accessory.displayName} updateCharacteristic`
281
+ await this.debugLog('updateCharacteristic'
282
282
  + ` CurrentTemperature: ${this.TemperatureSensor.CurrentTemperature}`);
283
283
  }
284
284
  }
@@ -48,7 +48,7 @@ export class Camera extends irdeviceBase {
48
48
  }
49
49
 
50
50
  async OnSet(value: CharacteristicValue): Promise<void> {
51
- this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} On: ${value}`);
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(`${this.device.remoteType}: ${this.accessory.displayName} pushOnChanges On: ${this.Switch.On},`
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(`${this.device.remoteType}: ${this.accessory.displayName} pushOffChanges On: ${this.Switch.On},`
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(`${this.device.remoteType}: ${this.accessory.displayName} pushChanges`);
102
+ await this.debugLog('pushChanges');
103
103
  if (this.device.connectionType === 'OpenAPI') {
104
- this.infoLog(`${this.device.remoteType}: ${this.accessory.displayName} Sending request to SwitchBot API, body: ${bodyChange},`);
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(`${this.device.remoteType}: ${this.accessory.displayName}`
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(`${this.device.remoteType}: ${this.accessory.displayName} On: ${this.Switch.On}`);
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(`${this.device.remoteType}: ${this.accessory.displayName} updateCharacteristic On: ${this.Switch.On}`);
133
+ await this.debugLog(`updateCharacteristic On: ${this.Switch.On}`);
134
134
  }
135
135
  }
136
136
 
@@ -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(`${this.device.remoteType}: ${this.accessory.displayName} Rotation Speed Characteristic was removed.`);
71
+ this.debugLog('Rotation Speed Characteristic was removed.');
72
72
  } else {
73
- this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} RotationSpeed Characteristic was not removed/added, `
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(`${this.device.remoteType}: ${this.accessory.displayName} Swing Mode Characteristic was removed.`);
88
+ this.debugLog('Swing Mode Characteristic was removed.');
89
89
  } else {
90
- this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} Swing Mode Characteristic was not removed/added, `
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(`${this.device.remoteType}: ${this.accessory.displayName} SwingMode: ${value}`);
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(`${this.device.remoteType}: ${this.accessory.displayName} RotationSpeed: ${value}`);
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(`${this.device.remoteType}: ${this.accessory.displayName} Active: ${value}`);
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(`${this.device.remoteType}: ${this.accessory.displayName} pushFanOnChanges Active: ${this.Fan.Active},`
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(`${this.device.remoteType}: ${this.accessory.displayName} pushLightOffChanges Active: ${this.Fan.Active},`
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(`${this.device.remoteType}: ${this.accessory.displayName} pushChanges`);
202
+ await this.debugLog('pushChanges');
203
203
  if (this.device.connectionType === 'OpenAPI') {
204
- this.infoLog(`${this.device.remoteType}: ${this.accessory.displayName} Sending request to SwitchBot API, body: ${bodyChange},`);
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(`${this.device.remoteType}: ${this.accessory.displayName}`
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(`${this.device.remoteType}: ${this.accessory.displayName} Active: ${this.Fan.Active}`);
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(`${this.device.remoteType}: ${this.accessory.displayName} updateCharacteristic Active: ${this.Fan.Active}`);
232
+ await this.debugLog(`updateCharacteristic Active: ${this.Fan.Active}`);
233
233
  }
234
234
  if (this.Fan.SwingMode === undefined) {
235
- this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} SwingMode: ${this.Fan.SwingMode}`);
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(`${this.device.remoteType}: ${this.accessory.displayName} updateCharacteristic SwingMode: ${this.Fan.SwingMode}`);
239
+ await this.debugLog(`updateCharacteristic SwingMode: ${this.Fan.SwingMode}`);
240
240
  }
241
241
  if (this.Fan.RotationSpeed === undefined) {
242
- this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} RotationSpeed: ${this.Fan.RotationSpeed}`);
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(`${this.device.remoteType}: ${this.accessory.displayName} updateCharacteristic RotationSpeed: ${this.Fan.RotationSpeed}`);
246
+ await this.debugLog(`updateCharacteristic RotationSpeed: ${this.Fan.RotationSpeed}`);
247
247
  }
248
248
  }
249
249