@switchbot/homebridge-switchbot 2.9.1-beta.3 → 2.9.1-beta.4

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 (126) hide show
  1. package/dist/device/blindtilt.d.ts +0 -3
  2. package/dist/device/blindtilt.d.ts.map +1 -1
  3. package/dist/device/blindtilt.js +7 -58
  4. package/dist/device/blindtilt.js.map +1 -1
  5. package/dist/device/bot.d.ts +0 -3
  6. package/dist/device/bot.d.ts.map +1 -1
  7. package/dist/device/bot.js +7 -81
  8. package/dist/device/bot.js.map +1 -1
  9. package/dist/device/ceilinglight.d.ts +0 -3
  10. package/dist/device/ceilinglight.d.ts.map +1 -1
  11. package/dist/device/ceilinglight.js +14 -58
  12. package/dist/device/ceilinglight.js.map +1 -1
  13. package/dist/device/colorbulb.d.ts +0 -3
  14. package/dist/device/colorbulb.d.ts.map +1 -1
  15. package/dist/device/colorbulb.js +10 -54
  16. package/dist/device/colorbulb.js.map +1 -1
  17. package/dist/device/contact.d.ts +0 -3
  18. package/dist/device/contact.d.ts.map +1 -1
  19. package/dist/device/contact.js +7 -58
  20. package/dist/device/contact.js.map +1 -1
  21. package/dist/device/curtain.d.ts +0 -3
  22. package/dist/device/curtain.d.ts.map +1 -1
  23. package/dist/device/curtain.js +7 -58
  24. package/dist/device/curtain.js.map +1 -1
  25. package/dist/device/hub.d.ts +1 -4
  26. package/dist/device/hub.d.ts.map +1 -1
  27. package/dist/device/hub.js +7 -60
  28. package/dist/device/hub.js.map +1 -1
  29. package/dist/device/humidifier.d.ts +0 -3
  30. package/dist/device/humidifier.d.ts.map +1 -1
  31. package/dist/device/humidifier.js +10 -57
  32. package/dist/device/humidifier.js.map +1 -1
  33. package/dist/device/iosensor.d.ts +0 -3
  34. package/dist/device/iosensor.d.ts.map +1 -1
  35. package/dist/device/iosensor.js +7 -57
  36. package/dist/device/iosensor.js.map +1 -1
  37. package/dist/device/lightstrip.d.ts +0 -3
  38. package/dist/device/lightstrip.d.ts.map +1 -1
  39. package/dist/device/lightstrip.js +10 -54
  40. package/dist/device/lightstrip.js.map +1 -1
  41. package/dist/device/lock.d.ts +0 -3
  42. package/dist/device/lock.d.ts.map +1 -1
  43. package/dist/device/lock.js +13 -61
  44. package/dist/device/lock.js.map +1 -1
  45. package/dist/device/meter.d.ts +0 -3
  46. package/dist/device/meter.d.ts.map +1 -1
  47. package/dist/device/meter.js +7 -60
  48. package/dist/device/meter.js.map +1 -1
  49. package/dist/device/meterplus.d.ts +1 -4
  50. package/dist/device/meterplus.d.ts.map +1 -1
  51. package/dist/device/meterplus.js +7 -61
  52. package/dist/device/meterplus.js.map +1 -1
  53. package/dist/device/motion.d.ts +0 -3
  54. package/dist/device/motion.d.ts.map +1 -1
  55. package/dist/device/motion.js +3 -55
  56. package/dist/device/motion.js.map +1 -1
  57. package/dist/device/plug.d.ts +0 -3
  58. package/dist/device/plug.d.ts.map +1 -1
  59. package/dist/device/plug.js +3 -51
  60. package/dist/device/plug.js.map +1 -1
  61. package/dist/device/robotvacuumcleaner.d.ts +0 -3
  62. package/dist/device/robotvacuumcleaner.d.ts.map +1 -1
  63. package/dist/device/robotvacuumcleaner.js +12 -61
  64. package/dist/device/robotvacuumcleaner.js.map +1 -1
  65. package/dist/irdevice/airconditioner.d.ts +0 -1
  66. package/dist/irdevice/airconditioner.d.ts.map +1 -1
  67. package/dist/irdevice/airconditioner.js +6 -45
  68. package/dist/irdevice/airconditioner.js.map +1 -1
  69. package/dist/irdevice/airpurifier.d.ts +0 -1
  70. package/dist/irdevice/airpurifier.d.ts.map +1 -1
  71. package/dist/irdevice/airpurifier.js +6 -45
  72. package/dist/irdevice/airpurifier.js.map +1 -1
  73. package/dist/irdevice/camera.d.ts +0 -1
  74. package/dist/irdevice/camera.d.ts.map +1 -1
  75. package/dist/irdevice/camera.js +6 -45
  76. package/dist/irdevice/camera.js.map +1 -1
  77. package/dist/irdevice/fan.d.ts +0 -1
  78. package/dist/irdevice/fan.d.ts.map +1 -1
  79. package/dist/irdevice/fan.js +6 -45
  80. package/dist/irdevice/fan.js.map +1 -1
  81. package/dist/irdevice/light.d.ts +0 -1
  82. package/dist/irdevice/light.d.ts.map +1 -1
  83. package/dist/irdevice/light.js +6 -45
  84. package/dist/irdevice/light.js.map +1 -1
  85. package/dist/irdevice/other.d.ts +0 -1
  86. package/dist/irdevice/other.d.ts.map +1 -1
  87. package/dist/irdevice/other.js +6 -45
  88. package/dist/irdevice/other.js.map +1 -1
  89. package/dist/irdevice/tv.d.ts +0 -1
  90. package/dist/irdevice/tv.d.ts.map +1 -1
  91. package/dist/irdevice/tv.js +6 -45
  92. package/dist/irdevice/tv.js.map +1 -1
  93. package/dist/irdevice/vacuumcleaner.d.ts +0 -1
  94. package/dist/irdevice/vacuumcleaner.d.ts.map +1 -1
  95. package/dist/irdevice/vacuumcleaner.js +6 -45
  96. package/dist/irdevice/vacuumcleaner.js.map +1 -1
  97. package/dist/irdevice/waterheater.d.ts +0 -1
  98. package/dist/irdevice/waterheater.d.ts.map +1 -1
  99. package/dist/irdevice/waterheater.js +6 -45
  100. package/dist/irdevice/waterheater.js.map +1 -1
  101. package/package.json +8 -8
  102. package/src/device/blindtilt.ts +7 -57
  103. package/src/device/bot.ts +7 -71
  104. package/src/device/ceilinglight.ts +14 -59
  105. package/src/device/colorbulb.ts +10 -54
  106. package/src/device/contact.ts +7 -58
  107. package/src/device/curtain.ts +7 -57
  108. package/src/device/hub.ts +7 -61
  109. package/src/device/humidifier.ts +10 -58
  110. package/src/device/iosensor.ts +7 -57
  111. package/src/device/lightstrip.ts +10 -54
  112. package/src/device/lock.ts +13 -62
  113. package/src/device/meter.ts +7 -59
  114. package/src/device/meterplus.ts +7 -61
  115. package/src/device/motion.ts +3 -54
  116. package/src/device/plug.ts +3 -50
  117. package/src/device/robotvacuumcleaner.ts +12 -61
  118. package/src/irdevice/airconditioner.ts +6 -44
  119. package/src/irdevice/airpurifier.ts +6 -46
  120. package/src/irdevice/camera.ts +6 -46
  121. package/src/irdevice/fan.ts +6 -46
  122. package/src/irdevice/light.ts +6 -46
  123. package/src/irdevice/other.ts +6 -46
  124. package/src/irdevice/tv.ts +6 -46
  125. package/src/irdevice/vacuumcleaner.ts +6 -46
  126. package/src/irdevice/waterheater.ts +6 -46
@@ -1,4 +1,3 @@
1
- import { Context } from 'vm';
2
1
  import { request } from 'undici';
3
2
  import { sleep } from '../utils';
4
3
  import { MqttClient } from 'mqtt';
@@ -114,20 +113,8 @@ export class BlindTilt {
114
113
  .getService(this.platform.Service.AccessoryInformation)!
115
114
  .setCharacteristic(this.platform.Characteristic.Manufacturer, 'SwitchBot')
116
115
  .setCharacteristic(this.platform.Characteristic.Model, 'W2701600')
117
- .setCharacteristic(this.platform.Characteristic.SerialNumber, device.deviceId!);
118
-
119
- if (accessory.context.FirmwareRevision) {
120
- this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName}`
121
- + ` accessory.context.FirmwareRevision: ${accessory.context.FirmwareRevision}`);
122
- accessory
123
- .getService(this.platform.Service.AccessoryInformation)!
124
- .setCharacteristic(this.platform.Characteristic.FirmwareRevision, accessory.context.FirmwareRevision)
125
- .updateCharacteristic(this.platform.Characteristic.FirmwareRevision, accessory.context.FirmwareRevision)
126
- .getCharacteristic(this.platform.Characteristic.FirmwareRevision)
127
- .updateValue(accessory.context.FirmwareRevision);
128
- } else {
129
- this.setFirmwareRevision(accessory, device);
130
- }
116
+ .setCharacteristic(this.platform.Characteristic.SerialNumber, device.deviceId)
117
+ .setCharacteristic(this.platform.Characteristic.FirmwareRevision, accessory.context.FirmwareRevision);
131
118
 
132
119
  // get the WindowCovering service if it exists, otherwise create a new WindowCovering service
133
120
  // you can create multiple services for each accessory
@@ -455,6 +442,7 @@ export class BlindTilt {
455
442
 
456
443
  // FirmwareRevision
457
444
  this.FirmwareRevision = this.OpenAPI_FirmwareRevision!;
445
+ this.accessory.context.FirmwareRevision = this.FirmwareRevision;
458
446
  }
459
447
 
460
448
  async refreshStatus(): Promise<void> {
@@ -897,22 +885,6 @@ export class BlindTilt {
897
885
  this.batteryService?.updateCharacteristic(this.platform.Characteristic.StatusLowBattery, this.StatusLowBattery);
898
886
  this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} updateCharacteristic StatusLowBattery: ${this.StatusLowBattery}`);
899
887
  }
900
- // FirmwareRevision
901
- if (this.FirmwareRevision === undefined) {
902
- this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} FirmwareRevision: ${this.FirmwareRevision}`);
903
- } else {
904
- if (this.device.mqttURL) {
905
- this.mqttPublish('FirmwareRevision', this.FirmwareRevision);
906
- }
907
- this.accessory.context.FirmwareRevision = this.FirmwareRevision;
908
- this.batteryService.updateCharacteristic(this.platform.Characteristic.FirmwareRevision, this.FirmwareRevision);
909
- this.windowCoveringService.updateCharacteristic(this.platform.Characteristic.FirmwareRevision, this.FirmwareRevision);
910
- if (!this.device.blindTilt?.hide_lightsensor) {
911
- this.lightSensorService!.updateCharacteristic(this.platform.Characteristic.FirmwareRevision, this.FirmwareRevision);
912
- }
913
- this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} `
914
- + `updateCharacteristic FirmwareRevision: ${this.FirmwareRevision}`);
915
- }
916
888
  }
917
889
 
918
890
  /*
@@ -1145,32 +1117,6 @@ export class BlindTilt {
1145
1117
  //throw new this.platform.api.hap.HapStatusError(HAPStatus.SERVICE_COMMUNICATION_FAILURE);
1146
1118
  }
1147
1119
 
1148
- async setFirmwareRevision(accessory: PlatformAccessory<Context>, device: device & devicesConfig) {
1149
- await this.refreshStatus();
1150
- if (device.firmware) {
1151
- this.warnLog(`${this.device.deviceType}: ${this.accessory.displayName} device.firmware: ${device.firmware}`);
1152
- accessory.context.FirmwareRevision = device.firmware;
1153
- this.FirmwareRevision = accessory.context.FirmwareRevision;
1154
- this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} device.firmware, FirmwareRevision: ${this.FirmwareRevision}`);
1155
- } else if (device.version) {
1156
- this.warnLog(`${this.device.deviceType}: ${this.accessory.displayName} device.version: ${device.version}`);
1157
- accessory.context.FirmwareRevision = device.version;
1158
- this.FirmwareRevision = accessory.context.FirmwareRevision;
1159
- this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} device.version, FirmwareRevision: ${this.FirmwareRevision}`);
1160
- } else {
1161
- this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} this.platform.version: ${this.platform.version}`);
1162
- accessory.context.FirmwareRevision = this.platform.version;
1163
- this.FirmwareRevision = accessory.context.FirmwareRevision;
1164
- this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} this.platform.version, FirmwareRevision: ${this.FirmwareRevision}`);
1165
- }
1166
- this.infoLog(`${this.device.deviceType}: ${this.accessory.displayName} setFirmwareRevision: ${this.FirmwareRevision}`);
1167
- accessory
1168
- .getService(this.platform.Service.AccessoryInformation)!
1169
- .updateCharacteristic(this.platform.Characteristic.FirmwareRevision, accessory.context.FirmwareRevision)
1170
- .getCharacteristic(this.platform.Characteristic.FirmwareRevision)
1171
- .updateValue(this.FirmwareRevision);
1172
- }
1173
-
1174
1120
  async context() {
1175
1121
  if (this.CurrentPosition === undefined) {
1176
1122
  this.CurrentPosition = 0;
@@ -1189,6 +1135,10 @@ export class BlindTilt {
1189
1135
  } else {
1190
1136
  this.PositionState = this.accessory.context.PositionState;
1191
1137
  }
1138
+ if (this.FirmwareRevision === undefined) {
1139
+ this.FirmwareRevision = this.platform.version;
1140
+ this.accessory.context.FirmwareRevision = this.FirmwareRevision;
1141
+ }
1192
1142
  }
1193
1143
 
1194
1144
  /**
package/src/device/bot.ts CHANGED
@@ -1,4 +1,3 @@
1
- import { Context } from 'vm';
2
1
  import { request } from 'undici';
3
2
  import { sleep } from '../utils';
4
3
  import { interval, Subject } from 'rxjs';
@@ -94,20 +93,8 @@ export class Bot {
94
93
  .getService(this.platform.Service.AccessoryInformation)!
95
94
  .setCharacteristic(this.platform.Characteristic.Manufacturer, 'SwitchBot')
96
95
  .setCharacteristic(this.platform.Characteristic.Model, 'SWITCHBOT-BOT-S1')
97
- .setCharacteristic(this.platform.Characteristic.SerialNumber, device.deviceId!);
98
-
99
- if (accessory.context.FirmwareRevision) {
100
- this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName}`
101
- + ` accessory.context.FirmwareRevision: ${accessory.context.FirmwareRevision}`);
102
- accessory
103
- .getService(this.platform.Service.AccessoryInformation)!
104
- .setCharacteristic(this.platform.Characteristic.FirmwareRevision, accessory.context.FirmwareRevision)
105
- .updateCharacteristic(this.platform.Characteristic.FirmwareRevision, accessory.context.FirmwareRevision)
106
- .getCharacteristic(this.platform.Characteristic.FirmwareRevision)
107
- .updateValue(accessory.context.FirmwareRevision);
108
- } else {
109
- this.setFirmwareRevision(accessory, device);
110
- }
96
+ .setCharacteristic(this.platform.Characteristic.SerialNumber, device.deviceId)
97
+ .setCharacteristic(this.platform.Characteristic.FirmwareRevision, accessory.context.FirmwareRevision);
111
98
 
112
99
  // deviceType
113
100
  if (this.botDeviceType === 'switch') {
@@ -481,6 +468,7 @@ export class Bot {
481
468
 
482
469
  // FirmwareRevision
483
470
  this.FirmwareRevision = this.OpenAPI_FirmwareRevision!;
471
+ this.accessory.context.FirmwareRevision = this.FirmwareRevision;
484
472
  }
485
473
 
486
474
  /**
@@ -1042,36 +1030,6 @@ export class Bot {
1042
1030
  this.batteryService?.updateCharacteristic(this.platform.Characteristic.StatusLowBattery, this.StatusLowBattery);
1043
1031
  this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} updateCharacteristic StatusLowBattery: ${this.StatusLowBattery}`);
1044
1032
  }
1045
- // FirmwareRevision
1046
- if (this.FirmwareRevision === undefined) {
1047
- this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} FirmwareRevision: ${this.FirmwareRevision}`);
1048
- } else {
1049
- this.accessory.context.FirmwareRevision = this.FirmwareRevision;
1050
- this.batteryService.updateCharacteristic(this.platform.Characteristic.FirmwareRevision, this.FirmwareRevision);
1051
- if (this.botDeviceType === 'garagedoor') {
1052
- this.garageDoorService!.updateCharacteristic(this.platform.Characteristic.FirmwareRevision, this.FirmwareRevision);
1053
- } else if (this.botDeviceType === 'door') {
1054
- this.doorService!.updateCharacteristic(this.platform.Characteristic.FirmwareRevision, this.FirmwareRevision);
1055
- } else if (this.botDeviceType === 'window') {
1056
- this.windowService!.updateCharacteristic(this.platform.Characteristic.FirmwareRevision, this.FirmwareRevision);
1057
- } else if (this.botDeviceType === 'windowcovering') {
1058
- this.windowCoveringService!.updateCharacteristic(this.platform.Characteristic.FirmwareRevision, this.FirmwareRevision);
1059
- } else if (this.botDeviceType === 'lock') {
1060
- this.lockService!.updateCharacteristic(this.platform.Characteristic.FirmwareRevision, this.FirmwareRevision);
1061
- } else if (this.botDeviceType === 'faucet') {
1062
- this.faucetService!.updateCharacteristic(this.platform.Characteristic.FirmwareRevision, this.FirmwareRevision);
1063
- } else if (this.botDeviceType === 'fan') {
1064
- this.fanService!.updateCharacteristic(this.platform.Characteristic.FirmwareRevision, this.FirmwareRevision);
1065
- } else if (this.botDeviceType === 'stateful') {
1066
- this.statefulProgrammableSwitchService!.updateCharacteristic(this.platform.Characteristic.FirmwareRevision, this.FirmwareRevision);
1067
- } else if (this.botDeviceType === 'switch') {
1068
- this.switchService!.updateCharacteristic(this.platform.Characteristic.FirmwareRevision, this.FirmwareRevision);
1069
- } else {
1070
- this.outletService!.updateCharacteristic(this.platform.Characteristic.FirmwareRevision, this.FirmwareRevision);
1071
- }
1072
- this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} `
1073
- + `updateCharacteristic FirmwareRevision: ${this.FirmwareRevision}`);
1074
- }
1075
1033
  }
1076
1034
 
1077
1035
  async removeOutletService(accessory: PlatformAccessory): Promise<void> {
@@ -1363,32 +1321,6 @@ export class Bot {
1363
1321
  this.batteryService?.updateCharacteristic(this.platform.Characteristic.StatusLowBattery, e);
1364
1322
  }
1365
1323
 
1366
- async setFirmwareRevision(accessory: PlatformAccessory<Context>, device: device & devicesConfig) {
1367
- await this.refreshStatus();
1368
- if (device.firmware) {
1369
- this.warnLog(`${this.device.deviceType}: ${this.accessory.displayName} device.firmware: ${device.firmware}`);
1370
- accessory.context.FirmwareRevision = device.firmware;
1371
- this.FirmwareRevision = accessory.context.FirmwareRevision;
1372
- this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} device.firmware, FirmwareRevision: ${this.FirmwareRevision}`);
1373
- } else if (device.version) {
1374
- this.warnLog(`${this.device.deviceType}: ${this.accessory.displayName} device.version: ${device.version}`);
1375
- accessory.context.FirmwareRevision = device.version;
1376
- this.FirmwareRevision = accessory.context.FirmwareRevision;
1377
- this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} device.version, FirmwareRevision: ${this.FirmwareRevision}`);
1378
- } else {
1379
- this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} this.platform.version: ${this.platform.version}`);
1380
- accessory.context.FirmwareRevision = this.platform.version;
1381
- this.FirmwareRevision = accessory.context.FirmwareRevision;
1382
- this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} this.platform.version, FirmwareRevision: ${this.FirmwareRevision}`);
1383
- }
1384
- this.infoLog(`${this.device.deviceType}: ${this.accessory.displayName} setFirmwareRevision: ${this.FirmwareRevision}`);
1385
- accessory
1386
- .getService(this.platform.Service.AccessoryInformation)!
1387
- .updateCharacteristic(this.platform.Characteristic.FirmwareRevision, accessory.context.FirmwareRevision)
1388
- .getCharacteristic(this.platform.Characteristic.FirmwareRevision)
1389
- .updateValue(this.FirmwareRevision);
1390
- }
1391
-
1392
1324
  async deviceType(device: device & devicesConfig): Promise<void> {
1393
1325
  if (!device.bot?.deviceType && this.accessory.context.deviceType) {
1394
1326
  this.botDeviceType = this.accessory.context.deviceType;
@@ -1423,6 +1355,10 @@ export class Bot {
1423
1355
  } else {
1424
1356
  this.StatusLowBattery = this.accessory.context.StatusLowBattery;
1425
1357
  }
1358
+ if (this.FirmwareRevision === undefined) {
1359
+ this.FirmwareRevision = this.platform.version;
1360
+ this.accessory.context.FirmwareRevision = this.FirmwareRevision;
1361
+ }
1426
1362
  }
1427
1363
 
1428
1364
  async refreshRate(device: device & devicesConfig): Promise<void> {
@@ -1,5 +1,3 @@
1
- /* eslint-disable brace-style */
2
- import { Context } from 'vm';
3
1
  import { request } from 'undici';
4
2
  import { sleep } from '../utils';
5
3
  import { interval, Subject } from 'rxjs';
@@ -88,20 +86,8 @@ export class CeilingLight {
88
86
  .getService(this.platform.Service.AccessoryInformation)!
89
87
  .setCharacteristic(this.platform.Characteristic.Manufacturer, 'SwitchBot')
90
88
  .setCharacteristic(this.platform.Characteristic.Model, this.model(device))
91
- .setCharacteristic(this.platform.Characteristic.SerialNumber, device.deviceId!);
92
-
93
- if (accessory.context.FirmwareRevision) {
94
- this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName}`
95
- + ` accessory.context.FirmwareRevision: ${accessory.context.FirmwareRevision}`);
96
- accessory
97
- .getService(this.platform.Service.AccessoryInformation)!
98
- .setCharacteristic(this.platform.Characteristic.FirmwareRevision, accessory.context.FirmwareRevision)
99
- .updateCharacteristic(this.platform.Characteristic.FirmwareRevision, accessory.context.FirmwareRevision)
100
- .getCharacteristic(this.platform.Characteristic.FirmwareRevision)
101
- .updateValue(accessory.context.FirmwareRevision);
102
- } else {
103
- this.setFirmwareRevision(accessory, device);
104
- }
89
+ .setCharacteristic(this.platform.Characteristic.SerialNumber, device.deviceId)
90
+ .setCharacteristic(this.platform.Characteristic.FirmwareRevision, accessory.context.FirmwareRevision);
105
91
 
106
92
  // get the Lightbulb service if it exists, otherwise create a new Lightbulb service
107
93
  // you can create multiple services for each accessory
@@ -242,7 +228,7 @@ export class CeilingLight {
242
228
  }
243
229
  /*if (this.BLE) {
244
230
  await this.BLEparseStatus();
245
- } else*/ else if (this.OpenAPI && this.platform.config.credentials?.token) {
231
+ } else*/ if (this.OpenAPI && this.platform.config.credentials?.token) {
246
232
  await this.openAPIparseStatus();
247
233
  } else {
248
234
  await this.offlineOff();
@@ -315,6 +301,7 @@ export class CeilingLight {
315
301
 
316
302
  // FirmwareRevision
317
303
  this.FirmwareRevision = this.OpenAPI_FirmwareRevision!;
304
+ this.accessory.context.FirmwareRevision = this.FirmwareRevision;
318
305
  }
319
306
 
320
307
  /**
@@ -323,9 +310,9 @@ export class CeilingLight {
323
310
  async refreshStatus(): Promise<void> {
324
311
  if (!this.device.enableCloudService && this.OpenAPI) {
325
312
  this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} refreshStatus enableCloudService: ${this.device.enableCloudService}`);
326
- } /*if (this.BLE) {
327
- await this.BLERefreshStatus();
328
- } else*/ else if (this.OpenAPI && this.platform.config.credentials?.token) {
313
+ /*} else if (this.BLE) {
314
+ await this.BLERefreshStatus();*/
315
+ } else if (this.OpenAPI && this.platform.config.credentials?.token) {
329
316
  await this.openAPIRefreshStatus();
330
317
  } else {
331
318
  await this.offlineOff();
@@ -454,9 +441,9 @@ export class CeilingLight {
454
441
  async pushChanges(): Promise<void> {
455
442
  if (!this.device.enableCloudService && this.OpenAPI) {
456
443
  this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} pushChanges enableCloudService: ${this.device.enableCloudService}`);
457
- } /*if (this.BLE) {
458
- await this.BLEpushChanges();
459
- } else*/ else if (this.OpenAPI && this.platform.config.credentials?.token) {
444
+ /*} else if (this.BLE) {
445
+ await this.BLEpushChanges();*/
446
+ } else if (this.OpenAPI && this.platform.config.credentials?.token) {
460
447
  await this.openAPIpushChanges();
461
448
  } else {
462
449
  await this.offlineOff();
@@ -856,16 +843,6 @@ export class CeilingLight {
856
843
  this.lightBulbService.updateCharacteristic(this.platform.Characteristic.Saturation, this.Saturation);
857
844
  this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} updateCharacteristic Saturation: ${this.Saturation}`);
858
845
  }
859
-
860
- // FirmwareRevision
861
- if (this.FirmwareRevision === undefined) {
862
- this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} FirmwareRevision: ${this.FirmwareRevision}`);
863
- } else {
864
- this.accessory.context.FirmwareRevision = this.FirmwareRevision;
865
- this.lightBulbService.updateCharacteristic(this.platform.Characteristic.FirmwareRevision, this.FirmwareRevision);
866
- this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} `
867
- + `updateCharacteristic FirmwareRevision: ${this.FirmwareRevision}`);
868
- }
869
846
  }
870
847
 
871
848
  async adaptiveLighting(device: device & devicesConfig): Promise<void> {
@@ -1022,32 +999,6 @@ export class CeilingLight {
1022
999
  this.lightBulbService.updateCharacteristic(this.platform.Characteristic.ColorTemperature, e);
1023
1000
  }
1024
1001
 
1025
- async setFirmwareRevision(accessory: PlatformAccessory<Context>, device: device & devicesConfig) {
1026
- await this.refreshStatus();
1027
- if (device.firmware) {
1028
- this.warnLog(`${this.device.deviceType}: ${this.accessory.displayName} device.firmware: ${device.firmware}`);
1029
- accessory.context.FirmwareRevision = device.firmware;
1030
- this.FirmwareRevision = accessory.context.FirmwareRevision;
1031
- this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} device.firmware, FirmwareRevision: ${this.FirmwareRevision}`);
1032
- } else if (device.version) {
1033
- this.warnLog(`${this.device.deviceType}: ${this.accessory.displayName} device.version: ${device.version}`);
1034
- accessory.context.FirmwareRevision = device.version;
1035
- this.FirmwareRevision = accessory.context.FirmwareRevision;
1036
- this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} device.version, FirmwareRevision: ${this.FirmwareRevision}`);
1037
- } else {
1038
- this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} this.platform.version: ${this.platform.version}`);
1039
- accessory.context.FirmwareRevision = this.platform.version;
1040
- this.FirmwareRevision = accessory.context.FirmwareRevision;
1041
- this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} this.platform.version, FirmwareRevision: ${this.FirmwareRevision}`);
1042
- }
1043
- this.infoLog(`${this.device.deviceType}: ${this.accessory.displayName} setFirmwareRevision: ${this.FirmwareRevision}`);
1044
- accessory
1045
- .getService(this.platform.Service.AccessoryInformation)!
1046
- .updateCharacteristic(this.platform.Characteristic.FirmwareRevision, accessory.context.FirmwareRevision)
1047
- .getCharacteristic(this.platform.Characteristic.FirmwareRevision)
1048
- .updateValue(this.FirmwareRevision);
1049
- }
1050
-
1051
1002
  async context() {
1052
1003
  if (this.On === undefined) {
1053
1004
  this.On = false;
@@ -1076,6 +1027,10 @@ export class CeilingLight {
1076
1027
  }
1077
1028
  this.minKelvin = 2000;
1078
1029
  this.maxKelvin = 9000;
1030
+ if (this.FirmwareRevision === undefined) {
1031
+ this.FirmwareRevision = this.platform.version;
1032
+ this.accessory.context.FirmwareRevision = this.FirmwareRevision;
1033
+ }
1079
1034
  }
1080
1035
 
1081
1036
  async refreshRate(device: device & devicesConfig): Promise<void> {
@@ -1,5 +1,3 @@
1
- /* eslint-disable brace-style */
2
- import { Context } from 'vm';
3
1
  import { request } from 'undici';
4
2
  import { sleep } from '../utils';
5
3
  import { interval, Subject } from 'rxjs';
@@ -94,20 +92,8 @@ export class ColorBulb {
94
92
  .getService(this.platform.Service.AccessoryInformation)!
95
93
  .setCharacteristic(this.platform.Characteristic.Manufacturer, 'SwitchBot')
96
94
  .setCharacteristic(this.platform.Characteristic.Model, 'W1401400')
97
- .setCharacteristic(this.platform.Characteristic.SerialNumber, device.deviceId!);
98
-
99
- if (accessory.context.FirmwareRevision) {
100
- this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName}`
101
- + ` accessory.context.FirmwareRevision: ${accessory.context.FirmwareRevision}`);
102
- accessory
103
- .getService(this.platform.Service.AccessoryInformation)!
104
- .setCharacteristic(this.platform.Characteristic.FirmwareRevision, accessory.context.FirmwareRevision)
105
- .updateCharacteristic(this.platform.Characteristic.FirmwareRevision, accessory.context.FirmwareRevision)
106
- .getCharacteristic(this.platform.Characteristic.FirmwareRevision)
107
- .updateValue(accessory.context.FirmwareRevision);
108
- } else {
109
- this.setFirmwareRevision(accessory, device);
110
- }
95
+ .setCharacteristic(this.platform.Characteristic.SerialNumber, device.deviceId)
96
+ .setCharacteristic(this.platform.Characteristic.FirmwareRevision, accessory.context.FirmwareRevision);
111
97
 
112
98
  // get the Lightbulb service if it exists, otherwise create a new Lightbulb service
113
99
  // you can create multiple services for each accessory
@@ -341,6 +327,7 @@ export class ColorBulb {
341
327
 
342
328
  // FirmwareRevision
343
329
  this.FirmwareRevision = this.OpenAPI_FirmwareRevision!;
330
+ this.accessory.context.FirmwareRevision = this.FirmwareRevision;
344
331
  }
345
332
 
346
333
  /**
@@ -481,9 +468,9 @@ export class ColorBulb {
481
468
  async pushChanges(): Promise<void> {
482
469
  if (!this.device.enableCloudService && this.OpenAPI) {
483
470
  this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} pushChanges enableCloudService: ${this.device.enableCloudService}`);
484
- } /* if (this.BLE) {
485
- await this.BLEpushChanges();
486
- } else*/ else if (this.OpenAPI && this.platform.config.credentials?.token) {
471
+ /*} else if (this.BLE) {
472
+ await this.BLEpushChanges();*/
473
+ } else if (this.OpenAPI && this.platform.config.credentials?.token) {
487
474
  await this.openAPIpushChanges();
488
475
  } else {
489
476
  await this.offlineOff();
@@ -1024,15 +1011,6 @@ export class ColorBulb {
1024
1011
  this.lightBulbService.updateCharacteristic(this.platform.Characteristic.Saturation, this.Saturation);
1025
1012
  this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} updateCharacteristic Saturation: ${this.Saturation}`);
1026
1013
  }
1027
- // FirmwareRevision
1028
- if (this.FirmwareRevision === undefined) {
1029
- this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} FirmwareRevision: ${this.FirmwareRevision}`);
1030
- } else {
1031
- this.accessory.context.FirmwareRevision = this.FirmwareRevision;
1032
- this.lightBulbService.updateCharacteristic(this.platform.Characteristic.FirmwareRevision, this.FirmwareRevision);
1033
- this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} `
1034
- + `updateCharacteristic FirmwareRevision: ${this.FirmwareRevision}`);
1035
- }
1036
1014
  }
1037
1015
 
1038
1016
  async adaptiveLighting(device: device & devicesConfig): Promise<void> {
@@ -1189,32 +1167,6 @@ export class ColorBulb {
1189
1167
  this.lightBulbService.updateCharacteristic(this.platform.Characteristic.ColorTemperature, e);
1190
1168
  }
1191
1169
 
1192
- async setFirmwareRevision(accessory: PlatformAccessory<Context>, device: device & devicesConfig) {
1193
- await this.refreshStatus();
1194
- if (device.firmware) {
1195
- this.warnLog(`${this.device.deviceType}: ${this.accessory.displayName} device.firmware: ${device.firmware}`);
1196
- accessory.context.FirmwareRevision = device.firmware;
1197
- this.FirmwareRevision = accessory.context.FirmwareRevision;
1198
- this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} device.firmware, FirmwareRevision: ${this.FirmwareRevision}`);
1199
- } else if (device.version) {
1200
- this.warnLog(`${this.device.deviceType}: ${this.accessory.displayName} device.version: ${device.version}`);
1201
- accessory.context.FirmwareRevision = device.version;
1202
- this.FirmwareRevision = accessory.context.FirmwareRevision;
1203
- this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} device.version, FirmwareRevision: ${this.FirmwareRevision}`);
1204
- } else {
1205
- this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} this.platform.version: ${this.platform.version}`);
1206
- accessory.context.FirmwareRevision = this.platform.version;
1207
- this.FirmwareRevision = accessory.context.FirmwareRevision;
1208
- this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} this.platform.version, FirmwareRevision: ${this.FirmwareRevision}`);
1209
- }
1210
- this.infoLog(`${this.device.deviceType}: ${this.accessory.displayName} setFirmwareRevision: ${this.FirmwareRevision}`);
1211
- accessory
1212
- .getService(this.platform.Service.AccessoryInformation)!
1213
- .updateCharacteristic(this.platform.Characteristic.FirmwareRevision, accessory.context.FirmwareRevision)
1214
- .getCharacteristic(this.platform.Characteristic.FirmwareRevision)
1215
- .updateValue(this.FirmwareRevision);
1216
- }
1217
-
1218
1170
  async context() {
1219
1171
  if (this.On === undefined) {
1220
1172
  this.On = false;
@@ -1243,6 +1195,10 @@ export class ColorBulb {
1243
1195
  }
1244
1196
  this.minKelvin = 2000;
1245
1197
  this.maxKelvin = 9000;
1198
+ if (this.FirmwareRevision === undefined) {
1199
+ this.FirmwareRevision = this.platform.version;
1200
+ this.accessory.context.FirmwareRevision = this.FirmwareRevision;
1201
+ }
1246
1202
  }
1247
1203
 
1248
1204
  async refreshRate(device: device & devicesConfig): Promise<void> {
@@ -1,4 +1,3 @@
1
- import { Context } from 'vm';
2
1
  import { request } from 'undici';
3
2
  import { sleep } from '../utils';
4
3
  import { interval, Subject } from 'rxjs';
@@ -83,20 +82,8 @@ export class Contact {
83
82
  .getService(this.platform.Service.AccessoryInformation)!
84
83
  .setCharacteristic(this.platform.Characteristic.Manufacturer, 'SwitchBot')
85
84
  .setCharacteristic(this.platform.Characteristic.Model, 'W1201500')
86
- .setCharacteristic(this.platform.Characteristic.SerialNumber, device.deviceId!);
87
-
88
- if (accessory.context.FirmwareRevision) {
89
- this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName}`
90
- + ` accessory.context.FirmwareRevision: ${accessory.context.FirmwareRevision}`);
91
- accessory
92
- .getService(this.platform.Service.AccessoryInformation)!
93
- .setCharacteristic(this.platform.Characteristic.FirmwareRevision, accessory.context.FirmwareRevision)
94
- .updateCharacteristic(this.platform.Characteristic.FirmwareRevision, accessory.context.FirmwareRevision)
95
- .getCharacteristic(this.platform.Characteristic.FirmwareRevision)
96
- .updateValue(accessory.context.FirmwareRevision);
97
- } else {
98
- this.setFirmwareRevision(accessory, device);
99
- }
85
+ .setCharacteristic(this.platform.Characteristic.SerialNumber, device.deviceId)
86
+ .setCharacteristic(this.platform.Characteristic.FirmwareRevision, accessory.context.FirmwareRevision);
100
87
 
101
88
  // get the Contact service if it exists, otherwise create a new Contact service
102
89
  // you can create multiple services for each accessory
@@ -293,6 +280,7 @@ export class Contact {
293
280
 
294
281
  // FirmwareRevision
295
282
  this.FirmwareRevision = this.OpenAPI_FirmwareRevision!;
283
+ this.accessory.context.FirmwareRevision = this.FirmwareRevision;
296
284
  }
297
285
 
298
286
  /**
@@ -464,23 +452,6 @@ export class Contact {
464
452
  this.batteryService?.updateCharacteristic(this.platform.Characteristic.StatusLowBattery, this.StatusLowBattery);
465
453
  this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} updateCharacteristic StatusLowBattery: ${this.StatusLowBattery}`);
466
454
  }
467
-
468
- // FirmwareRevision
469
- if (this.FirmwareRevision === undefined) {
470
- this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} FirmwareRevision: ${this.FirmwareRevision}`);
471
- } else {
472
- this.accessory.context.FirmwareRevision = this.FirmwareRevision;
473
- this.batteryService.updateCharacteristic(this.platform.Characteristic.FirmwareRevision, this.FirmwareRevision);
474
- this.contactSensorservice.updateCharacteristic(this.platform.Characteristic.FirmwareRevision, this.FirmwareRevision);
475
- if (!this.device.contact?.hide_motionsensor) {
476
- this.motionService!.updateCharacteristic(this.platform.Characteristic.FirmwareRevision, this.FirmwareRevision);
477
- }
478
- if (!this.device.contact?.hide_lightsensor) {
479
- this.lightSensorService!.updateCharacteristic(this.platform.Characteristic.FirmwareRevision, this.FirmwareRevision);
480
- }
481
- this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} `
482
- + `updateCharacteristic FirmwareRevision: ${this.FirmwareRevision}`);
483
- }
484
455
  }
485
456
 
486
457
  async stopScanning(switchbot: any) {
@@ -612,32 +583,6 @@ export class Contact {
612
583
  this.batteryService?.updateCharacteristic(this.platform.Characteristic.StatusLowBattery, e);
613
584
  }
614
585
 
615
- async setFirmwareRevision(accessory: PlatformAccessory<Context>, device: device & devicesConfig) {
616
- await this.refreshStatus();
617
- if (device.firmware) {
618
- this.warnLog(`${this.device.deviceType}: ${this.accessory.displayName} device.firmware: ${device.firmware}`);
619
- accessory.context.FirmwareRevision = device.firmware;
620
- this.FirmwareRevision = accessory.context.FirmwareRevision;
621
- this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} device.firmware, FirmwareRevision: ${this.FirmwareRevision}`);
622
- } else if (device.version) {
623
- this.warnLog(`${this.device.deviceType}: ${this.accessory.displayName} device.version: ${device.version}`);
624
- accessory.context.FirmwareRevision = device.version;
625
- this.FirmwareRevision = accessory.context.FirmwareRevision;
626
- this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} device.version, FirmwareRevision: ${this.FirmwareRevision}`);
627
- } else {
628
- this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} this.platform.version: ${this.platform.version}`);
629
- accessory.context.FirmwareRevision = this.platform.version;
630
- this.FirmwareRevision = accessory.context.FirmwareRevision;
631
- this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} this.platform.version, FirmwareRevision: ${this.FirmwareRevision}`);
632
- }
633
- this.infoLog(`${this.device.deviceType}: ${this.accessory.displayName} setFirmwareRevision: ${this.FirmwareRevision}`);
634
- accessory
635
- .getService(this.platform.Service.AccessoryInformation)!
636
- .updateCharacteristic(this.platform.Characteristic.FirmwareRevision, accessory.context.FirmwareRevision)
637
- .getCharacteristic(this.platform.Characteristic.FirmwareRevision)
638
- .updateValue(this.FirmwareRevision);
639
- }
640
-
641
586
  async context() {
642
587
  if (this.MotionDetected === undefined) {
643
588
  this.MotionDetected = false;
@@ -649,6 +594,10 @@ export class Contact {
649
594
  } else {
650
595
  this.ContactSensorState = this.accessory.context.ContactSensorState;
651
596
  }
597
+ if (this.FirmwareRevision === undefined) {
598
+ this.FirmwareRevision = this.platform.version;
599
+ this.accessory.context.FirmwareRevision = this.FirmwareRevision;
600
+ }
652
601
  }
653
602
 
654
603
  async refreshRate(device: device & devicesConfig): Promise<void> {
@@ -1,4 +1,3 @@
1
- import { Context } from 'vm';
2
1
  import { request } from 'undici';
3
2
  import { sleep } from '../utils';
4
3
  import { MqttClient } from 'mqtt';
@@ -102,20 +101,8 @@ export class Curtain {
102
101
  .getService(this.platform.Service.AccessoryInformation)!
103
102
  .setCharacteristic(this.platform.Characteristic.Manufacturer, 'SwitchBot')
104
103
  .setCharacteristic(this.platform.Characteristic.Model, 'W0701600')
105
- .setCharacteristic(this.platform.Characteristic.SerialNumber, device.deviceId!);
106
-
107
- if (accessory.context.FirmwareRevision) {
108
- this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName}`
109
- + ` accessory.context.FirmwareRevision: ${accessory.context.FirmwareRevision}`);
110
- accessory
111
- .getService(this.platform.Service.AccessoryInformation)!
112
- .setCharacteristic(this.platform.Characteristic.FirmwareRevision, accessory.context.FirmwareRevision)
113
- .updateCharacteristic(this.platform.Characteristic.FirmwareRevision, accessory.context.FirmwareRevision)
114
- .getCharacteristic(this.platform.Characteristic.FirmwareRevision)
115
- .updateValue(accessory.context.FirmwareRevision);
116
- } else {
117
- this.setFirmwareRevision(accessory, device);
118
- }
104
+ .setCharacteristic(this.platform.Characteristic.SerialNumber, device.deviceId)
105
+ .setCharacteristic(this.platform.Characteristic.FirmwareRevision, accessory.context.FirmwareRevision);
119
106
 
120
107
  // get the WindowCovering service if it exists, otherwise create a new WindowCovering service
121
108
  // you can create multiple services for each accessory
@@ -482,6 +469,7 @@ export class Curtain {
482
469
 
483
470
  // FirmwareRevision
484
471
  this.FirmwareRevision = this.OpenAPI_FirmwareRevision!;
472
+ this.accessory.context.FirmwareRevision = this.FirmwareRevision;
485
473
  }
486
474
 
487
475
  async refreshStatus(): Promise<void> {
@@ -875,22 +863,6 @@ export class Curtain {
875
863
  this.batteryService?.updateCharacteristic(this.platform.Characteristic.StatusLowBattery, this.StatusLowBattery);
876
864
  this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} updateCharacteristic StatusLowBattery: ${this.StatusLowBattery}`);
877
865
  }
878
- // FirmwareRevision
879
- if (this.FirmwareRevision === undefined) {
880
- this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} FirmwareRevision: ${this.FirmwareRevision}`);
881
- } else {
882
- if (this.device.mqttURL) {
883
- this.mqttPublish('FirmwareRevision', this.FirmwareRevision);
884
- }
885
- this.accessory.context.FirmwareRevision = this.FirmwareRevision;
886
- this.batteryService.updateCharacteristic(this.platform.Characteristic.FirmwareRevision, this.FirmwareRevision);
887
- this.windowCoveringService.updateCharacteristic(this.platform.Characteristic.FirmwareRevision, this.FirmwareRevision);
888
- if (this.device.curtain?.hide_lightsensor) {
889
- this.windowCoveringService.updateCharacteristic(this.platform.Characteristic.FirmwareRevision, this.FirmwareRevision);
890
- }
891
- this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} `
892
- + `updateCharacteristic FirmwareRevision: ${this.FirmwareRevision}`);
893
- }
894
866
  }
895
867
 
896
868
  /*
@@ -1122,32 +1094,6 @@ export class Curtain {
1122
1094
  //throw new this.platform.api.hap.HapStatusError(HAPStatus.SERVICE_COMMUNICATION_FAILURE);
1123
1095
  }
1124
1096
 
1125
- async setFirmwareRevision(accessory: PlatformAccessory<Context>, device: device & devicesConfig) {
1126
- await this.refreshStatus();
1127
- if (device.firmware) {
1128
- this.warnLog(`${this.device.deviceType}: ${this.accessory.displayName} device.firmware: ${device.firmware}`);
1129
- accessory.context.FirmwareRevision = device.firmware;
1130
- this.FirmwareRevision = accessory.context.FirmwareRevision;
1131
- this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} device.firmware, FirmwareRevision: ${this.FirmwareRevision}`);
1132
- } else if (device.version) {
1133
- this.warnLog(`${this.device.deviceType}: ${this.accessory.displayName} device.version: ${device.version}`);
1134
- accessory.context.FirmwareRevision = device.version;
1135
- this.FirmwareRevision = accessory.context.FirmwareRevision;
1136
- this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} device.version, FirmwareRevision: ${this.FirmwareRevision}`);
1137
- } else {
1138
- this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} this.platform.version: ${this.platform.version}`);
1139
- accessory.context.FirmwareRevision = this.platform.version;
1140
- this.FirmwareRevision = accessory.context.FirmwareRevision;
1141
- this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} this.platform.version, FirmwareRevision: ${this.FirmwareRevision}`);
1142
- }
1143
- this.infoLog(`${this.device.deviceType}: ${this.accessory.displayName} setFirmwareRevision: ${this.FirmwareRevision}`);
1144
- accessory
1145
- .getService(this.platform.Service.AccessoryInformation)!
1146
- .updateCharacteristic(this.platform.Characteristic.FirmwareRevision, accessory.context.FirmwareRevision)
1147
- .getCharacteristic(this.platform.Characteristic.FirmwareRevision)
1148
- .updateValue(this.FirmwareRevision);
1149
- }
1150
-
1151
1097
  async context() {
1152
1098
  if (this.accessory.context.CurrentPosition === undefined) {
1153
1099
  this.CurrentPosition = 0;
@@ -1193,6 +1139,10 @@ export class Curtain {
1193
1139
  // removes cached values if history is turned off
1194
1140
  delete this.accessory.context.lastActivation;
1195
1141
  }
1142
+ if (this.FirmwareRevision === undefined) {
1143
+ this.FirmwareRevision = this.platform.version;
1144
+ this.accessory.context.FirmwareRevision = this.FirmwareRevision;
1145
+ }
1196
1146
  }
1197
1147
 
1198
1148
  async refreshRate(device: device & devicesConfig): Promise<void> {