@switchbot/homebridge-switchbot 2.8.2-beta.1 → 2.8.2-beta.2

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 (127) hide show
  1. package/config.schema.json +1 -1
  2. package/dist/device/blindtilt.d.ts +2 -1
  3. package/dist/device/blindtilt.d.ts.map +1 -1
  4. package/dist/device/blindtilt.js +26 -14
  5. package/dist/device/blindtilt.js.map +1 -1
  6. package/dist/device/bot.d.ts +2 -1
  7. package/dist/device/bot.d.ts.map +1 -1
  8. package/dist/device/bot.js +19 -15
  9. package/dist/device/bot.js.map +1 -1
  10. package/dist/device/ceilinglight.d.ts +2 -1
  11. package/dist/device/ceilinglight.d.ts.map +1 -1
  12. package/dist/device/ceilinglight.js +16 -14
  13. package/dist/device/ceilinglight.js.map +1 -1
  14. package/dist/device/colorbulb.d.ts +2 -1
  15. package/dist/device/colorbulb.d.ts.map +1 -1
  16. package/dist/device/colorbulb.js +21 -14
  17. package/dist/device/colorbulb.js.map +1 -1
  18. package/dist/device/contact.d.ts +2 -1
  19. package/dist/device/contact.d.ts.map +1 -1
  20. package/dist/device/contact.js +16 -14
  21. package/dist/device/contact.js.map +1 -1
  22. package/dist/device/curtain.d.ts +2 -1
  23. package/dist/device/curtain.d.ts.map +1 -1
  24. package/dist/device/curtain.js +19 -14
  25. package/dist/device/curtain.js.map +1 -1
  26. package/dist/device/hub.d.ts +2 -1
  27. package/dist/device/hub.d.ts.map +1 -1
  28. package/dist/device/hub.js +16 -14
  29. package/dist/device/hub.js.map +1 -1
  30. package/dist/device/humidifier.d.ts +5 -4
  31. package/dist/device/humidifier.d.ts.map +1 -1
  32. package/dist/device/humidifier.js +16 -14
  33. package/dist/device/humidifier.js.map +1 -1
  34. package/dist/device/iosensor.d.ts +2 -1
  35. package/dist/device/iosensor.d.ts.map +1 -1
  36. package/dist/device/iosensor.js +16 -14
  37. package/dist/device/iosensor.js.map +1 -1
  38. package/dist/device/lightstrip.d.ts +2 -1
  39. package/dist/device/lightstrip.d.ts.map +1 -1
  40. package/dist/device/lightstrip.js +21 -14
  41. package/dist/device/lightstrip.js.map +1 -1
  42. package/dist/device/lock.d.ts +2 -1
  43. package/dist/device/lock.d.ts.map +1 -1
  44. package/dist/device/lock.js +16 -14
  45. package/dist/device/lock.js.map +1 -1
  46. package/dist/device/meter.d.ts +3 -2
  47. package/dist/device/meter.d.ts.map +1 -1
  48. package/dist/device/meter.js +35 -26
  49. package/dist/device/meter.js.map +1 -1
  50. package/dist/device/meterplus.d.ts +3 -2
  51. package/dist/device/meterplus.d.ts.map +1 -1
  52. package/dist/device/meterplus.js +33 -23
  53. package/dist/device/meterplus.js.map +1 -1
  54. package/dist/device/motion.d.ts +5 -4
  55. package/dist/device/motion.d.ts.map +1 -1
  56. package/dist/device/motion.js +16 -14
  57. package/dist/device/motion.js.map +1 -1
  58. package/dist/device/plug.d.ts +2 -1
  59. package/dist/device/plug.d.ts.map +1 -1
  60. package/dist/device/plug.js +17 -14
  61. package/dist/device/plug.js.map +1 -1
  62. package/dist/device/robotvacuumcleaner.d.ts +2 -1
  63. package/dist/device/robotvacuumcleaner.d.ts.map +1 -1
  64. package/dist/device/robotvacuumcleaner.js +19 -13
  65. package/dist/device/robotvacuumcleaner.js.map +1 -1
  66. package/dist/irdevice/airconditioner.d.ts +7 -19
  67. package/dist/irdevice/airconditioner.d.ts.map +1 -1
  68. package/dist/irdevice/airconditioner.js +36 -18
  69. package/dist/irdevice/airconditioner.js.map +1 -1
  70. package/dist/irdevice/airpurifier.d.ts +4 -7
  71. package/dist/irdevice/airpurifier.d.ts.map +1 -1
  72. package/dist/irdevice/airpurifier.js +26 -12
  73. package/dist/irdevice/airpurifier.js.map +1 -1
  74. package/dist/irdevice/camera.d.ts +4 -7
  75. package/dist/irdevice/camera.d.ts.map +1 -1
  76. package/dist/irdevice/camera.js +24 -12
  77. package/dist/irdevice/camera.js.map +1 -1
  78. package/dist/irdevice/fan.d.ts +4 -7
  79. package/dist/irdevice/fan.d.ts.map +1 -1
  80. package/dist/irdevice/fan.js +23 -12
  81. package/dist/irdevice/fan.js.map +1 -1
  82. package/dist/irdevice/light.d.ts +4 -7
  83. package/dist/irdevice/light.d.ts.map +1 -1
  84. package/dist/irdevice/light.js +24 -12
  85. package/dist/irdevice/light.js.map +1 -1
  86. package/dist/irdevice/other.d.ts +4 -7
  87. package/dist/irdevice/other.d.ts.map +1 -1
  88. package/dist/irdevice/other.js +24 -12
  89. package/dist/irdevice/other.js.map +1 -1
  90. package/dist/irdevice/tv.d.ts +5 -10
  91. package/dist/irdevice/tv.d.ts.map +1 -1
  92. package/dist/irdevice/tv.js +27 -14
  93. package/dist/irdevice/tv.js.map +1 -1
  94. package/dist/irdevice/vacuumcleaner.d.ts +4 -7
  95. package/dist/irdevice/vacuumcleaner.d.ts.map +1 -1
  96. package/dist/irdevice/vacuumcleaner.js +24 -12
  97. package/dist/irdevice/vacuumcleaner.js.map +1 -1
  98. package/dist/irdevice/waterheater.d.ts +6 -16
  99. package/dist/irdevice/waterheater.d.ts.map +1 -1
  100. package/dist/irdevice/waterheater.js +28 -16
  101. package/dist/irdevice/waterheater.js.map +1 -1
  102. package/package.json +2 -2
  103. package/src/device/blindtilt.ts +28 -16
  104. package/src/device/bot.ts +21 -15
  105. package/src/device/ceilinglight.ts +20 -14
  106. package/src/device/colorbulb.ts +23 -14
  107. package/src/device/contact.ts +20 -14
  108. package/src/device/curtain.ts +22 -15
  109. package/src/device/hub.ts +20 -14
  110. package/src/device/humidifier.ts +23 -17
  111. package/src/device/iosensor.ts +20 -14
  112. package/src/device/lightstrip.ts +23 -14
  113. package/src/device/lock.ts +20 -14
  114. package/src/device/meter.ts +39 -27
  115. package/src/device/meterplus.ts +38 -26
  116. package/src/device/motion.ts +24 -23
  117. package/src/device/plug.ts +20 -14
  118. package/src/device/robotvacuumcleaner.ts +21 -13
  119. package/src/irdevice/airconditioner.ts +36 -18
  120. package/src/irdevice/airpurifier.ts +26 -12
  121. package/src/irdevice/camera.ts +24 -12
  122. package/src/irdevice/fan.ts +23 -12
  123. package/src/irdevice/light.ts +24 -12
  124. package/src/irdevice/other.ts +24 -12
  125. package/src/irdevice/tv.ts +27 -14
  126. package/src/irdevice/vacuumcleaner.ts +24 -12
  127. package/src/irdevice/waterheater.ts +28 -16
@@ -13,6 +13,7 @@ export class Plug {
13
13
 
14
14
  // Characteristic Values
15
15
  On!: CharacteristicValue;
16
+ FirmwareRevision!: CharacteristicValue;
16
17
 
17
18
  // OpenAPI Others
18
19
  OpenAPI_On: deviceStatus['power'];
@@ -60,9 +61,9 @@ export class Plug {
60
61
  .setCharacteristic(this.platform.Characteristic.Manufacturer, 'SwitchBot')
61
62
  .setCharacteristic(this.platform.Characteristic.Model, this.model(device))
62
63
  .setCharacteristic(this.platform.Characteristic.SerialNumber, device.deviceId!)
63
- .setCharacteristic(this.platform.Characteristic.FirmwareRevision, this.FirmwareRevision(accessory, device))
64
+ .setCharacteristic(this.platform.Characteristic.FirmwareRevision, this.setFirmwareRevision(accessory, device))
64
65
  .getCharacteristic(this.platform.Characteristic.FirmwareRevision)
65
- .updateValue(this.FirmwareRevision(accessory, device));
66
+ .updateValue(this.setFirmwareRevision(accessory, device));
66
67
 
67
68
  // get the Outlet service if it exists, otherwise create a new Outlet service
68
69
  // you can create multiple services for each accessory
@@ -153,6 +154,9 @@ export class Plug {
153
154
  this.On = false;
154
155
  }
155
156
  this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} On: ${this.On}`);
157
+
158
+ // FirmwareRevision
159
+ this.FirmwareRevision = JSON.stringify(this.OpenAPI_FirmwareRevision);
156
160
  }
157
161
 
158
162
  /**
@@ -413,6 +417,7 @@ export class Plug {
413
417
  }
414
418
 
415
419
  async updateHomeKitCharacteristics(): Promise<void> {
420
+ // On
416
421
  if (this.On === undefined) {
417
422
  this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} On: ${this.On}`);
418
423
  } else {
@@ -421,14 +426,14 @@ export class Plug {
421
426
  this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} updateCharacteristic On: ${this.On}`);
422
427
  }
423
428
  // FirmwareRevision
424
- if (this.OpenAPI_FirmwareRevision === undefined) {
425
- this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} FirmwareRevision: ${this.OpenAPI_FirmwareRevision}`);
429
+ if (this.FirmwareRevision === undefined) {
430
+ this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} FirmwareRevision: ${this.FirmwareRevision}`);
426
431
  } else {
427
- this.accessory.context.OpenAPI_FirmwareRevision = this.OpenAPI_FirmwareRevision;
432
+ this.accessory.context.FirmwareRevision = this.FirmwareRevision;
428
433
  this.accessory.getService(this.platform.Service.AccessoryInformation)!
429
- .updateCharacteristic(this.platform.Characteristic.FirmwareRevision, this.OpenAPI_FirmwareRevision);
434
+ .updateCharacteristic(this.platform.Characteristic.FirmwareRevision, this.FirmwareRevision);
430
435
  this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} `
431
- + `updateCharacteristic FirmwareRevision: ${this.OpenAPI_FirmwareRevision}`);
436
+ + `updateCharacteristic FirmwareRevision: ${this.FirmwareRevision}`);
432
437
  }
433
438
  }
434
439
 
@@ -582,23 +587,24 @@ export class Plug {
582
587
  this.outletService.updateCharacteristic(this.platform.Characteristic.On, e);
583
588
  }
584
589
 
585
- FirmwareRevision(accessory: PlatformAccessory<Context>, device: device & devicesConfig): CharacteristicValue {
586
- let FirmwareRevision: string;
590
+ setFirmwareRevision(accessory: PlatformAccessory<Context>, device: device & devicesConfig): CharacteristicValue {
591
+
587
592
  this.debugLog(
588
593
  `${this.device.deviceType}: ${this.accessory.displayName}` + ` accessory.context.FirmwareRevision: ${accessory.context.FirmwareRevision}`,
589
594
  );
590
595
  this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} device.firmware: ${device.firmware}`);
591
596
  this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} this.platform.version: ${this.platform.version}`);
592
597
  if (device.firmware) {
593
- FirmwareRevision = device.firmware;
598
+ this.FirmwareRevision = device.firmware;
594
599
  } else if (device.version) {
595
- FirmwareRevision = JSON.stringify(device.version);
600
+ this.FirmwareRevision = JSON.stringify(device.version);
596
601
  } else if (accessory.context.FirmwareRevision) {
597
- FirmwareRevision = accessory.context.FirmwareRevision;
602
+ this.FirmwareRevision = accessory.context.FirmwareRevision;
598
603
  } else {
599
- FirmwareRevision = this.platform.version;
604
+ this.FirmwareRevision = this.platform.version;
600
605
  }
601
- return FirmwareRevision;
606
+ this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} setFirmwareRevision: ${this.FirmwareRevision}`);
607
+ return this.FirmwareRevision;
602
608
  }
603
609
 
604
610
  async context() {
@@ -18,6 +18,7 @@ export class RobotVacuumCleaner {
18
18
  Brightness!: CharacteristicValue;
19
19
  BatteryLevel!: CharacteristicValue;
20
20
  StatusLowBattery!: CharacteristicValue;
21
+ FirmwareRevision!: CharacteristicValue;
21
22
 
22
23
  // OpenAPI Status
23
24
  OpenAPI_On: deviceStatus['power'];
@@ -68,9 +69,9 @@ export class RobotVacuumCleaner {
68
69
  .setCharacteristic(this.platform.Characteristic.Manufacturer, 'SwitchBot')
69
70
  .setCharacteristic(this.platform.Characteristic.Model, this.model(device))
70
71
  .setCharacteristic(this.platform.Characteristic.SerialNumber, device.deviceId!)
71
- .setCharacteristic(this.platform.Characteristic.FirmwareRevision, this.FirmwareRevision(accessory, device))
72
+ .setCharacteristic(this.platform.Characteristic.FirmwareRevision, this.setFirmwareRevision(accessory, device))
72
73
  .getCharacteristic(this.platform.Characteristic.FirmwareRevision)
73
- .updateValue(this.FirmwareRevision(accessory, device));
74
+ .updateValue(this.setFirmwareRevision(accessory, device));
74
75
 
75
76
  // get the Lightbulb service if it exists, otherwise create a new Lightbulb service
76
77
  // you can create multiple services for each accessory
@@ -199,6 +200,9 @@ export class RobotVacuumCleaner {
199
200
  this.StatusLowBattery = this.platform.Characteristic.StatusLowBattery.BATTERY_LEVEL_NORMAL;
200
201
  }
201
202
  this.debugLog(`${this.accessory.displayName} BatteryLevel: ${this.BatteryLevel}, StatusLowBattery: ${this.StatusLowBattery}`);
203
+
204
+ // FirmwareRevision
205
+ this.FirmwareRevision = JSON.stringify(this.OpenAPI_FirmwareRevision);
202
206
  }
203
207
 
204
208
  /**
@@ -553,6 +557,7 @@ export class RobotVacuumCleaner {
553
557
  }
554
558
 
555
559
  async updateHomeKitCharacteristics(): Promise<void> {
560
+ // On
556
561
  if (this.On === undefined) {
557
562
  this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} On: ${this.On}`);
558
563
  } else {
@@ -560,6 +565,7 @@ export class RobotVacuumCleaner {
560
565
  this.robotVacuumCleanerService.updateCharacteristic(this.platform.Characteristic.On, this.On);
561
566
  this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} updateCharacteristic On: ${this.On}`);
562
567
  }
568
+ // Brightness
563
569
  if (this.Brightness === undefined) {
564
570
  this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Brightness: ${this.Brightness}`);
565
571
  } else {
@@ -567,6 +573,7 @@ export class RobotVacuumCleaner {
567
573
  this.robotVacuumCleanerService.updateCharacteristic(this.platform.Characteristic.Brightness, this.Brightness);
568
574
  this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} updateCharacteristic Brightness: ${this.Brightness}`);
569
575
  }
576
+ // BatteryLevel
570
577
  if (this.BatteryLevel === undefined) {
571
578
  this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} BatteryLevel: ${this.BatteryLevel}`);
572
579
  } else {
@@ -574,6 +581,7 @@ export class RobotVacuumCleaner {
574
581
  this.batteryService?.updateCharacteristic(this.platform.Characteristic.BatteryLevel, this.BatteryLevel);
575
582
  this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} updateCharacteristic BatteryLevel: ${this.BatteryLevel}`);
576
583
  }
584
+ // StatusLowBattery
577
585
  if (this.StatusLowBattery === undefined) {
578
586
  this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} StatusLowBattery: ${this.StatusLowBattery}`);
579
587
  } else {
@@ -582,14 +590,14 @@ export class RobotVacuumCleaner {
582
590
  this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} updateCharacteristic StatusLowBattery: ${this.StatusLowBattery}`);
583
591
  }
584
592
  // FirmwareRevision
585
- if (this.OpenAPI_FirmwareRevision === undefined) {
586
- this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} FirmwareRevision: ${this.OpenAPI_FirmwareRevision}`);
593
+ if (this.FirmwareRevision === undefined) {
594
+ this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} FirmwareRevision: ${this.FirmwareRevision}`);
587
595
  } else {
588
- this.accessory.context.OpenAPI_FirmwareRevision = this.OpenAPI_FirmwareRevision;
596
+ this.accessory.context.FirmwareRevision = this.FirmwareRevision;
589
597
  this.accessory.getService(this.platform.Service.AccessoryInformation)!
590
- .updateCharacteristic(this.platform.Characteristic.FirmwareRevision, this.OpenAPI_FirmwareRevision);
598
+ .updateCharacteristic(this.platform.Characteristic.FirmwareRevision, this.FirmwareRevision);
591
599
  this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} `
592
- + `updateCharacteristic FirmwareRevision: ${this.OpenAPI_FirmwareRevision}`);
600
+ + `updateCharacteristic FirmwareRevision: ${this.FirmwareRevision}`);
593
601
  }
594
602
  }
595
603
 
@@ -743,21 +751,21 @@ export class RobotVacuumCleaner {
743
751
  this.robotVacuumCleanerService.updateCharacteristic(this.platform.Characteristic.On, e);
744
752
  }
745
753
 
746
- FirmwareRevision(accessory: PlatformAccessory<Context>, device: device & devicesConfig): CharacteristicValue {
747
- let FirmwareRevision: string;
754
+ setFirmwareRevision(accessory: PlatformAccessory<Context>, device: device & devicesConfig): CharacteristicValue {
748
755
  this.debugLog(
749
756
  `${this.device.deviceType}: ${this.accessory.displayName}` + ` accessory.context.FirmwareRevision: ${accessory.context.FirmwareRevision}`,
750
757
  );
751
758
  this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} device.firmware: ${device.firmware}`);
752
759
  this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} this.platform.version: ${this.platform.version}`);
753
760
  if (accessory.context.FirmwareRevision) {
754
- FirmwareRevision = accessory.context.FirmwareRevision;
761
+ this.FirmwareRevision = accessory.context.FirmwareRevision;
755
762
  } else if (device.firmware) {
756
- FirmwareRevision = device.firmware;
763
+ this.FirmwareRevision = device.firmware;
757
764
  } else {
758
- FirmwareRevision = this.platform.version;
765
+ this.FirmwareRevision = this.platform.version;
759
766
  }
760
- return FirmwareRevision;
767
+ this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} setFirmwareRevision: ${this.FirmwareRevision}`);
768
+ return this.FirmwareRevision;
761
769
  }
762
770
 
763
771
  async context() {
@@ -15,6 +15,7 @@ export class AirConditioner {
15
15
  // Characteristic Values
16
16
  Active!: CharacteristicValue;
17
17
  RotationSpeed!: CharacteristicValue;
18
+ FirmwareRevision!: CharacteristicValue;
18
19
  CurrentTemperature!: CharacteristicValue;
19
20
  ThresholdTemperature!: CharacteristicValue;
20
21
  CurrentRelativeHumidity?: CharacteristicValue;
@@ -49,12 +50,12 @@ export class AirConditioner {
49
50
  public device: irdevice & irDevicesConfig,
50
51
  ) {
51
52
  // default placeholders
52
- this.logs({ device });
53
+ this.logs(device);
53
54
  this.context();
54
- this.disablePushOnChanges({ device });
55
- this.disablePushOffChanges({ device });
56
- this.disablePushDetailChanges({ device });
57
- this.config({ device });
55
+ this.disablePushOnChanges(device);
56
+ this.disablePushOffChanges(device);
57
+ this.disablePushDetailChanges(device);
58
+ this.config(device);
58
59
 
59
60
  // set accessory information
60
61
  accessory
@@ -62,9 +63,9 @@ export class AirConditioner {
62
63
  .setCharacteristic(this.platform.Characteristic.Manufacturer, 'SwitchBot')
63
64
  .setCharacteristic(this.platform.Characteristic.Model, device.remoteType)
64
65
  .setCharacteristic(this.platform.Characteristic.SerialNumber, device.deviceId!)
65
- .setCharacteristic(this.platform.Characteristic.FirmwareRevision, this.FirmwareRevision({ accessory, device }))
66
+ .setCharacteristic(this.platform.Characteristic.FirmwareRevision, this.setFirmwareRevision(accessory, device))
66
67
  .getCharacteristic(this.platform.Characteristic.FirmwareRevision)
67
- .updateValue(this.FirmwareRevision({ accessory, device }));
68
+ .updateValue(this.setFirmwareRevision(accessory, device));
68
69
 
69
70
  // get the Television service if it exists, otherwise create a new Television service
70
71
  // you can create multiple services for each accessory
@@ -445,6 +446,7 @@ export class AirConditioner {
445
446
  }
446
447
 
447
448
  async updateHomeKitCharacteristics(): Promise<void> {
449
+ // Active
448
450
  if (this.Active === undefined) {
449
451
  this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} Active: ${this.Active}`);
450
452
  } else {
@@ -452,6 +454,7 @@ export class AirConditioner {
452
454
  this.coolerService?.updateCharacteristic(this.platform.Characteristic.Active, this.Active);
453
455
  this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} updateCharacteristic Active: ${this.Active}`);
454
456
  }
457
+ // RotationSpeed
455
458
  if (this.RotationSpeed === undefined) {
456
459
  this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} RotationSpeed: ${this.RotationSpeed}`);
457
460
  } else {
@@ -459,6 +462,7 @@ export class AirConditioner {
459
462
  this.coolerService?.updateCharacteristic(this.platform.Characteristic.RotationSpeed, this.RotationSpeed);
460
463
  this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} updateCharacteristic RotationSpeed: ${this.RotationSpeed}`);
461
464
  }
465
+ // CurrentTemperature
462
466
  if (this.CurrentTemperature === undefined) {
463
467
  this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} CurrentTemperature: ${this.CurrentTemperature}`);
464
468
  } else {
@@ -466,6 +470,7 @@ export class AirConditioner {
466
470
  this.coolerService?.updateCharacteristic(this.platform.Characteristic.CurrentTemperature, this.CurrentTemperature);
467
471
  this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} updateCharacteristic CurrentTemperature: ${this.CurrentTemperature}`);
468
472
  }
473
+ // CurrentRelativeHumidity
469
474
  if (this.meter) {
470
475
  if (this.CurrentRelativeHumidity === undefined) {
471
476
  this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} CurrentRelativeHumidity: ${this.CurrentRelativeHumidity}`);
@@ -477,6 +482,7 @@ export class AirConditioner {
477
482
  );
478
483
  }
479
484
  }
485
+ // TargetHeaterCoolerState
480
486
  if (this.TargetHeaterCoolerState === undefined) {
481
487
  this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} TargetHeaterCoolerState: ${this.TargetHeaterCoolerState}`);
482
488
  } else {
@@ -486,6 +492,7 @@ export class AirConditioner {
486
492
  `${this.device.remoteType}: ${this.accessory.displayName}` + ` updateCharacteristic TargetHeaterCoolerState: ${this.TargetHeaterCoolerState}`,
487
493
  );
488
494
  }
495
+ // CurrentHeaterCoolerState
489
496
  if (this.CurrentHeaterCoolerState === undefined) {
490
497
  this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} CurrentHeaterCoolerState: ${this.CurrentHeaterCoolerState}`);
491
498
  } else {
@@ -496,6 +503,7 @@ export class AirConditioner {
496
503
  ` updateCharacteristic CurrentHeaterCoolerState: ${this.CurrentHeaterCoolerState}`,
497
504
  );
498
505
  }
506
+ // ThresholdTemperature
499
507
  if (this.ThresholdTemperature === undefined) {
500
508
  this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} ThresholdTemperature: ${this.ThresholdTemperature}`);
501
509
  } else {
@@ -506,9 +514,19 @@ export class AirConditioner {
506
514
  `${this.device.remoteType}: ${this.accessory.displayName}` + ` updateCharacteristic ThresholdTemperature: ${this.ThresholdTemperature}`,
507
515
  );
508
516
  }
517
+ // FirmwareRevision
518
+ if (this.FirmwareRevision === undefined) {
519
+ this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} FirmwareRevision: ${this.FirmwareRevision}`);
520
+ } else {
521
+ this.accessory.context.FirmwareRevision = this.FirmwareRevision;
522
+ this.accessory.getService(this.platform.Service.AccessoryInformation)!
523
+ .updateCharacteristic(this.platform.Characteristic.FirmwareRevision, this.FirmwareRevision);
524
+ this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} `
525
+ + `updateCharacteristic FirmwareRevision: ${this.FirmwareRevision}`);
526
+ }
509
527
  }
510
528
 
511
- async disablePushOnChanges({ device }: { device: irdevice & irDevicesConfig }): Promise<void> {
529
+ async disablePushOnChanges(device: irdevice & irDevicesConfig): Promise<void> {
512
530
  if (device.disablePushOn === undefined) {
513
531
  this.disablePushOn = false;
514
532
  } else {
@@ -516,7 +534,7 @@ export class AirConditioner {
516
534
  }
517
535
  }
518
536
 
519
- async disablePushOffChanges({ device }: { device: irdevice & irDevicesConfig }): Promise<void> {
537
+ async disablePushOffChanges(device: irdevice & irDevicesConfig): Promise<void> {
520
538
  if (device.disablePushOff === undefined) {
521
539
  this.disablePushOff = false;
522
540
  } else {
@@ -524,7 +542,7 @@ export class AirConditioner {
524
542
  }
525
543
  }
526
544
 
527
- async disablePushDetailChanges({ device }: { device: irdevice & irDevicesConfig }): Promise<void> {
545
+ async disablePushDetailChanges(device: irdevice & irDevicesConfig): Promise<void> {
528
546
  if (device.disablePushDetail === undefined) {
529
547
  this.disablePushDetail = false;
530
548
  } else {
@@ -613,21 +631,21 @@ export class AirConditioner {
613
631
  this.coolerService.updateCharacteristic(this.platform.Characteristic.CoolingThresholdTemperature, e);
614
632
  }
615
633
 
616
- FirmwareRevision({ accessory, device }: { accessory: PlatformAccessory; device: irdevice & irDevicesConfig }): string {
617
- let FirmwareRevision: string;
634
+ setFirmwareRevision(accessory: PlatformAccessory, device: irdevice & irDevicesConfig): string {
618
635
  this.debugLog(
619
636
  `${this.device.remoteType}: ${this.accessory.displayName}` + ` accessory.context.FirmwareRevision: ${accessory.context.FirmwareRevision}`,
620
637
  );
621
638
  this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} device.firmware: ${device.firmware}`);
622
639
  this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} this.platform.version: ${this.platform.version}`);
623
640
  if (accessory.context.FirmwareRevision) {
624
- FirmwareRevision = accessory.context.FirmwareRevision;
641
+ this.FirmwareRevision = accessory.context.FirmwareRevision;
625
642
  } else if (device.firmware) {
626
- FirmwareRevision = device.firmware;
643
+ this.FirmwareRevision = device.firmware;
627
644
  } else {
628
- FirmwareRevision = this.platform.version;
645
+ this.FirmwareRevision = this.platform.version!;
629
646
  }
630
- return FirmwareRevision;
647
+ this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} setFirmwareRevision: ${this.FirmwareRevision}`);
648
+ return JSON.stringify(this.FirmwareRevision);
631
649
  }
632
650
 
633
651
  async context(): Promise<void> {
@@ -674,7 +692,7 @@ export class AirConditioner {
674
692
  }
675
693
  }
676
694
 
677
- async config({ device }: { device: irdevice & irDevicesConfig }): Promise<void> {
695
+ async config(device: irdevice & irDevicesConfig): Promise<void> {
678
696
  let config = {};
679
697
  if (device.irair) {
680
698
  config = device.irair;
@@ -711,7 +729,7 @@ export class AirConditioner {
711
729
  }
712
730
  }
713
731
 
714
- async logs({ device }: { device: irdevice & irDevicesConfig }): Promise<void> {
732
+ async logs(device: irdevice & irDevicesConfig): Promise<void> {
715
733
  if (this.platform.debugMode) {
716
734
  this.deviceLogging = this.accessory.context.logging = 'debugMode';
717
735
  this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} Using Debug Mode Logging: ${this.deviceLogging}`);
@@ -18,6 +18,7 @@ export class AirPurifier {
18
18
  CurrentAPTemp!: CharacteristicValue;
19
19
  CurrentAPMode!: CharacteristicValue;
20
20
  RotationSpeed!: CharacteristicValue;
21
+ FirmwareRevision!: CharacteristicValue;
21
22
  CurrentAPFanSpeed!: CharacteristicValue;
22
23
  CurrentTemperature!: CharacteristicValue;
23
24
  CurrentAirPurifierState!: CharacteristicValue;
@@ -46,8 +47,8 @@ export class AirPurifier {
46
47
  // default placeholders
47
48
  this.logs(device);
48
49
  this.context();
49
- this.disablePushOnChanges({ device });
50
- this.disablePushOffChanges({ device });
50
+ this.disablePushOnChanges(device);
51
+ this.disablePushOffChanges(device);
51
52
  this.config(device);
52
53
 
53
54
  // set accessory information
@@ -56,9 +57,9 @@ export class AirPurifier {
56
57
  .setCharacteristic(this.platform.Characteristic.Manufacturer, 'SwitchBot')
57
58
  .setCharacteristic(this.platform.Characteristic.Model, device.remoteType)
58
59
  .setCharacteristic(this.platform.Characteristic.SerialNumber, device.deviceId!)
59
- .setCharacteristic(this.platform.Characteristic.FirmwareRevision, this.FirmwareRevision(accessory, device))
60
+ .setCharacteristic(this.platform.Characteristic.FirmwareRevision, this.setFirmwareRevision(accessory, device))
60
61
  .getCharacteristic(this.platform.Characteristic.FirmwareRevision)
61
- .updateValue(this.FirmwareRevision(accessory, device));
62
+ .updateValue(this.setFirmwareRevision(accessory, device));
62
63
 
63
64
  // get the Television service if it exists, otherwise create a new Television service
64
65
  // you can create multiple services for each accessory
@@ -243,6 +244,7 @@ export class AirPurifier {
243
244
  }
244
245
 
245
246
  async updateHomeKitCharacteristics(): Promise<void> {
247
+ // Active
246
248
  if (this.Active === undefined) {
247
249
  this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} Active: ${this.Active}`);
248
250
  } else {
@@ -250,6 +252,7 @@ export class AirPurifier {
250
252
  this.airPurifierService?.updateCharacteristic(this.platform.Characteristic.Active, this.Active);
251
253
  this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} updateCharacteristic Active: ${this.Active}`);
252
254
  }
255
+ // CurrentAirPurifierState
253
256
  if (this.CurrentAirPurifierState === undefined) {
254
257
  this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} CurrentAirPurifierState: ${this.CurrentAirPurifierState}`);
255
258
  } else {
@@ -259,6 +262,7 @@ export class AirPurifier {
259
262
  `${this.device.remoteType}: ${this.accessory.displayName}` + ` updateCharacteristic CurrentAirPurifierState: ${this.CurrentAirPurifierState}`,
260
263
  );
261
264
  }
265
+ // CurrentHeaterCoolerState
262
266
  if (this.CurrentHeaterCoolerState === undefined) {
263
267
  this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} CurrentHeaterCoolerState: ${this.CurrentHeaterCoolerState}`);
264
268
  } else {
@@ -269,9 +273,19 @@ export class AirPurifier {
269
273
  ` updateCharacteristic CurrentHeaterCoolerState: ${this.CurrentHeaterCoolerState}`,
270
274
  );
271
275
  }
276
+ // FirmwareRevision
277
+ if (this.FirmwareRevision === undefined) {
278
+ this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} FirmwareRevision: ${this.FirmwareRevision}`);
279
+ } else {
280
+ this.accessory.context.FirmwareRevision = this.FirmwareRevision;
281
+ this.accessory.getService(this.platform.Service.AccessoryInformation)!
282
+ .updateCharacteristic(this.platform.Characteristic.FirmwareRevision, this.FirmwareRevision);
283
+ this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} `
284
+ + `updateCharacteristic FirmwareRevision: ${this.FirmwareRevision}`);
285
+ }
272
286
  }
273
287
 
274
- async disablePushOnChanges({ device }: { device: irdevice & irDevicesConfig }): Promise<void> {
288
+ async disablePushOnChanges(device: irdevice & irDevicesConfig): Promise<void> {
275
289
  if (device.disablePushOn === undefined) {
276
290
  this.disablePushOn = false;
277
291
  } else {
@@ -279,7 +293,7 @@ export class AirPurifier {
279
293
  }
280
294
  }
281
295
 
282
- async disablePushOffChanges({ device }: { device: irdevice & irDevicesConfig }): Promise<void> {
296
+ async disablePushOffChanges(device: irdevice & irDevicesConfig): Promise<void> {
283
297
  if (device.disablePushOff === undefined) {
284
298
  this.disablePushOff = false;
285
299
  } else {
@@ -364,21 +378,21 @@ export class AirPurifier {
364
378
  this.airPurifierService.updateCharacteristic(this.platform.Characteristic.Active, e);
365
379
  }
366
380
 
367
- FirmwareRevision(accessory: PlatformAccessory, device: irdevice & irDevicesConfig): string {
368
- let FirmwareRevision: string;
381
+ setFirmwareRevision(accessory: PlatformAccessory, device: irdevice & irDevicesConfig): string {
369
382
  this.debugLog(
370
383
  `${this.device.remoteType}: ${this.accessory.displayName}` + ` accessory.context.FirmwareRevision: ${accessory.context.FirmwareRevision}`,
371
384
  );
372
385
  this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} device.firmware: ${device.firmware}`);
373
386
  this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} this.platform.version: ${this.platform.version}`);
374
387
  if (accessory.context.FirmwareRevision) {
375
- FirmwareRevision = accessory.context.FirmwareRevision;
388
+ this.FirmwareRevision = accessory.context.FirmwareRevision;
376
389
  } else if (device.firmware) {
377
- FirmwareRevision = device.firmware;
390
+ this.FirmwareRevision = device.firmware;
378
391
  } else {
379
- FirmwareRevision = this.platform.version;
392
+ this.FirmwareRevision = this.platform.version!;
380
393
  }
381
- return FirmwareRevision;
394
+ this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} setFirmwareRevision: ${this.FirmwareRevision}`);
395
+ return JSON.stringify(this.FirmwareRevision);
382
396
  }
383
397
 
384
398
  private context() {
@@ -14,6 +14,7 @@ export class Camera {
14
14
 
15
15
  // Characteristic Values
16
16
  On!: CharacteristicValue;
17
+ FirmwareRevision!: CharacteristicValue;
17
18
 
18
19
  // Config
19
20
  deviceLogging!: string;
@@ -28,8 +29,8 @@ export class Camera {
28
29
  // default placeholders
29
30
  this.logs(device);
30
31
  this.context();
31
- this.disablePushOnChanges({ device });
32
- this.disablePushOffChanges({ device });
32
+ this.disablePushOnChanges(device);
33
+ this.disablePushOffChanges(device);
33
34
  this.config(device);
34
35
 
35
36
  // set accessory information
@@ -38,9 +39,9 @@ export class Camera {
38
39
  .setCharacteristic(this.platform.Characteristic.Manufacturer, 'SwitchBot')
39
40
  .setCharacteristic(this.platform.Characteristic.Model, device.remoteType)
40
41
  .setCharacteristic(this.platform.Characteristic.SerialNumber, device.deviceId!)
41
- .setCharacteristic(this.platform.Characteristic.FirmwareRevision, this.FirmwareRevision(accessory, device))
42
+ .setCharacteristic(this.platform.Characteristic.FirmwareRevision, this.setFirmwareRevision(accessory, device))
42
43
  .getCharacteristic(this.platform.Characteristic.FirmwareRevision)
43
- .updateValue(this.FirmwareRevision(accessory, device));
44
+ .updateValue(this.setFirmwareRevision(accessory, device));
44
45
 
45
46
  // get the Television service if it exists, otherwise create a new Television service
46
47
  // you can create multiple services for each accessory
@@ -148,6 +149,7 @@ export class Camera {
148
149
  }
149
150
 
150
151
  async updateHomeKitCharacteristics(): Promise<void> {
152
+ // On
151
153
  if (this.On === undefined) {
152
154
  this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} On: ${this.On}`);
153
155
  } else {
@@ -155,9 +157,19 @@ export class Camera {
155
157
  this.switchService?.updateCharacteristic(this.platform.Characteristic.On, this.On);
156
158
  this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} updateCharacteristic On: ${this.On}`);
157
159
  }
160
+ // FirmwareRevision
161
+ if (this.FirmwareRevision === undefined) {
162
+ this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} FirmwareRevision: ${this.FirmwareRevision}`);
163
+ } else {
164
+ this.accessory.context.FirmwareRevision = this.FirmwareRevision;
165
+ this.accessory.getService(this.platform.Service.AccessoryInformation)!
166
+ .updateCharacteristic(this.platform.Characteristic.FirmwareRevision, this.FirmwareRevision);
167
+ this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} `
168
+ + `updateCharacteristic FirmwareRevision: ${this.FirmwareRevision}`);
169
+ }
158
170
  }
159
171
 
160
- async disablePushOnChanges({ device }: { device: irdevice & irDevicesConfig }): Promise<void> {
172
+ async disablePushOnChanges(device: irdevice & irDevicesConfig): Promise<void> {
161
173
  if (device.disablePushOn === undefined) {
162
174
  this.disablePushOn = false;
163
175
  } else {
@@ -165,7 +177,7 @@ export class Camera {
165
177
  }
166
178
  }
167
179
 
168
- async disablePushOffChanges({ device }: { device: irdevice & irDevicesConfig }): Promise<void> {
180
+ async disablePushOffChanges(device: irdevice & irDevicesConfig): Promise<void> {
169
181
  if (device.disablePushOff === undefined) {
170
182
  this.disablePushOff = false;
171
183
  } else {
@@ -247,21 +259,21 @@ export class Camera {
247
259
  this.switchService.updateCharacteristic(this.platform.Characteristic.On, e);
248
260
  }
249
261
 
250
- FirmwareRevision(accessory: PlatformAccessory, device: irdevice & irDevicesConfig): string {
251
- let FirmwareRevision: string;
262
+ setFirmwareRevision(accessory: PlatformAccessory, device: irdevice & irDevicesConfig): string {
252
263
  this.debugLog(
253
264
  `${this.device.remoteType}: ${this.accessory.displayName}` + ` accessory.context.FirmwareRevision: ${accessory.context.FirmwareRevision}`,
254
265
  );
255
266
  this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} device.firmware: ${device.firmware}`);
256
267
  this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} this.platform.version: ${this.platform.version}`);
257
268
  if (accessory.context.FirmwareRevision) {
258
- FirmwareRevision = accessory.context.FirmwareRevision;
269
+ this.FirmwareRevision = accessory.context.FirmwareRevision;
259
270
  } else if (device.firmware) {
260
- FirmwareRevision = device.firmware;
271
+ this.FirmwareRevision = device.firmware;
261
272
  } else {
262
- FirmwareRevision = this.platform.version;
273
+ this.FirmwareRevision = this.platform.version!;
263
274
  }
264
- return FirmwareRevision;
275
+ this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} setFirmwareRevision: ${this.FirmwareRevision}`);
276
+ return JSON.stringify(this.FirmwareRevision);
265
277
  }
266
278
 
267
279
  async context() {
@@ -16,6 +16,7 @@ export class Fan {
16
16
  Active!: CharacteristicValue;
17
17
  SwingMode!: CharacteristicValue;
18
18
  RotationSpeed!: CharacteristicValue;
19
+ FirmwareRevision!: CharacteristicValue;
19
20
  ActiveIdentifier!: CharacteristicValue;
20
21
  RotationDirection!: CharacteristicValue;
21
22
 
@@ -35,8 +36,8 @@ export class Fan {
35
36
  // default placeholders
36
37
  this.logs(device);
37
38
  this.context();
38
- this.disablePushOnChanges({ device });
39
- this.disablePushOffChanges({ device });
39
+ this.disablePushOnChanges(device);
40
+ this.disablePushOffChanges(device);
40
41
  this.config(device);
41
42
 
42
43
  // set accessory information
@@ -45,9 +46,9 @@ export class Fan {
45
46
  .setCharacteristic(this.platform.Characteristic.Manufacturer, 'SwitchBot')
46
47
  .setCharacteristic(this.platform.Characteristic.Model, device.remoteType)
47
48
  .setCharacteristic(this.platform.Characteristic.SerialNumber, device.deviceId!)
48
- .setCharacteristic(this.platform.Characteristic.FirmwareRevision, this.FirmwareRevision(accessory, device))
49
+ .setCharacteristic(this.platform.Characteristic.FirmwareRevision, this.setFirmwareRevision(accessory, device))
49
50
  .getCharacteristic(this.platform.Characteristic.FirmwareRevision)
50
- .updateValue(this.FirmwareRevision(accessory, device));
51
+ .updateValue(this.setFirmwareRevision(accessory, device));
51
52
 
52
53
  // get the Television service if it exists, otherwise create a new Television service
53
54
  // you can create multiple services for each accessory
@@ -286,9 +287,19 @@ export class Fan {
286
287
  this.fanService?.updateCharacteristic(this.platform.Characteristic.RotationSpeed, this.RotationSpeed);
287
288
  this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} updateCharacteristic RotationSpeed: ${this.RotationSpeed}`);
288
289
  }
290
+ // FirmwareRevision
291
+ if (this.FirmwareRevision === undefined) {
292
+ this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} FirmwareRevision: ${this.FirmwareRevision}`);
293
+ } else {
294
+ this.accessory.context.FirmwareRevision = this.FirmwareRevision;
295
+ this.accessory.getService(this.platform.Service.AccessoryInformation)!
296
+ .updateCharacteristic(this.platform.Characteristic.FirmwareRevision, this.FirmwareRevision);
297
+ this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} `
298
+ + `updateCharacteristic FirmwareRevision: ${this.FirmwareRevision}`);
299
+ }
289
300
  }
290
301
 
291
- async disablePushOnChanges({ device }: { device: irdevice & irDevicesConfig }): Promise<void> {
302
+ async disablePushOnChanges(device: irdevice & irDevicesConfig): Promise<void> {
292
303
  if (device.disablePushOn === undefined) {
293
304
  this.disablePushOn = false;
294
305
  } else {
@@ -296,7 +307,7 @@ export class Fan {
296
307
  }
297
308
  }
298
309
 
299
- async disablePushOffChanges({ device }: { device: irdevice & irDevicesConfig }): Promise<void> {
310
+ async disablePushOffChanges(device: irdevice & irDevicesConfig): Promise<void> {
300
311
  if (device.disablePushOff === undefined) {
301
312
  this.disablePushOff = false;
302
313
  } else {
@@ -380,21 +391,21 @@ export class Fan {
380
391
  this.fanService.updateCharacteristic(this.platform.Characteristic.SwingMode, e);
381
392
  }
382
393
 
383
- FirmwareRevision(accessory: PlatformAccessory, device: irdevice & irDevicesConfig): string {
384
- let FirmwareRevision: string;
394
+ setFirmwareRevision(accessory: PlatformAccessory, device: irdevice & irDevicesConfig): string {
385
395
  this.debugLog(
386
396
  `${this.device.remoteType}: ${this.accessory.displayName}` + ` accessory.context.FirmwareRevision: ${accessory.context.FirmwareRevision}`,
387
397
  );
388
398
  this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} device.firmware: ${device.firmware}`);
389
399
  this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} this.platform.version: ${this.platform.version}`);
390
400
  if (accessory.context.FirmwareRevision) {
391
- FirmwareRevision = accessory.context.FirmwareRevision;
401
+ this.FirmwareRevision = accessory.context.FirmwareRevision;
392
402
  } else if (device.firmware) {
393
- FirmwareRevision = device.firmware;
403
+ this.FirmwareRevision = device.firmware;
394
404
  } else {
395
- FirmwareRevision = this.platform.version;
405
+ this.FirmwareRevision = this.platform.version!;
396
406
  }
397
- return FirmwareRevision;
407
+ this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} setFirmwareRevision: ${this.FirmwareRevision}`);
408
+ return JSON.stringify(this.FirmwareRevision);
398
409
  }
399
410
 
400
411
  async context() {