@switchbot/homebridge-switchbot 3.5.0-beta.42 → 3.5.0-beta.44

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 (62) hide show
  1. package/dist/device/blindtilt.js +1 -1
  2. package/dist/device/blindtilt.js.map +1 -1
  3. package/dist/device/bot.js +1 -1
  4. package/dist/device/bot.js.map +1 -1
  5. package/dist/device/ceilinglight.js +1 -1
  6. package/dist/device/ceilinglight.js.map +1 -1
  7. package/dist/device/colorbulb.js +1 -1
  8. package/dist/device/colorbulb.js.map +1 -1
  9. package/dist/device/contact.js +1 -1
  10. package/dist/device/contact.js.map +1 -1
  11. package/dist/device/curtain.js +1 -1
  12. package/dist/device/curtain.js.map +1 -1
  13. package/dist/device/device.d.ts.map +1 -1
  14. package/dist/device/device.js +13 -10
  15. package/dist/device/device.js.map +1 -1
  16. package/dist/device/fan.js +1 -1
  17. package/dist/device/fan.js.map +1 -1
  18. package/dist/device/hub.js +1 -1
  19. package/dist/device/hub.js.map +1 -1
  20. package/dist/device/humidifier.js +1 -1
  21. package/dist/device/humidifier.js.map +1 -1
  22. package/dist/device/iosensor.js +1 -1
  23. package/dist/device/iosensor.js.map +1 -1
  24. package/dist/device/lightstrip.js +1 -1
  25. package/dist/device/lightstrip.js.map +1 -1
  26. package/dist/device/lock.js +1 -1
  27. package/dist/device/lock.js.map +1 -1
  28. package/dist/device/meter.js +1 -1
  29. package/dist/device/meter.js.map +1 -1
  30. package/dist/device/meterplus.js +1 -1
  31. package/dist/device/meterplus.js.map +1 -1
  32. package/dist/device/motion.js +1 -1
  33. package/dist/device/motion.js.map +1 -1
  34. package/dist/device/plug.js +1 -1
  35. package/dist/device/plug.js.map +1 -1
  36. package/dist/device/robotvacuumcleaner.js +1 -1
  37. package/dist/device/robotvacuumcleaner.js.map +1 -1
  38. package/dist/device/waterdetector.js +1 -1
  39. package/dist/device/waterdetector.js.map +1 -1
  40. package/dist/platform.js +54 -54
  41. package/dist/platform.js.map +1 -1
  42. package/package.json +1 -1
  43. package/src/device/blindtilt.ts +1 -1
  44. package/src/device/bot.ts +1 -1
  45. package/src/device/ceilinglight.ts +1 -1
  46. package/src/device/colorbulb.ts +1 -1
  47. package/src/device/contact.ts +1 -1
  48. package/src/device/curtain.ts +1 -1
  49. package/src/device/device.ts +13 -10
  50. package/src/device/fan.ts +1 -1
  51. package/src/device/hub.ts +1 -1
  52. package/src/device/humidifier.ts +1 -1
  53. package/src/device/iosensor.ts +1 -1
  54. package/src/device/lightstrip.ts +1 -1
  55. package/src/device/lock.ts +1 -1
  56. package/src/device/meter.ts +1 -1
  57. package/src/device/meterplus.ts +1 -1
  58. package/src/device/motion.ts +1 -1
  59. package/src/device/plug.ts +1 -1
  60. package/src/device/robotvacuumcleaner.ts +1 -1
  61. package/src/device/waterdetector.ts +1 -1
  62. package/src/platform.ts +54 -54
@@ -55,13 +55,15 @@ export abstract class deviceBase {
55
55
  this.BLE = this.device.connectionType === 'BLE' || this.device.connectionType === 'BLE/OpenAPI';
56
56
  this.OpenAPI = this.device.connectionType === 'OpenAPI' || this.device.connectionType === 'BLE/OpenAPI';
57
57
 
58
- this.getDeviceLogSettings(device);
59
- this.getDeviceRefreshRateSettings(device);
60
- this.getDeviceRetry(device);
61
- this.getDeviceConfigSettings(device);
62
- this.getDeviceContext(accessory, device);
63
- this.setupMqtt(device);
64
- this.scan(device);
58
+ (async () => {
59
+ await this.getDeviceLogSettings(device);
60
+ await this.getDeviceRefreshRateSettings(device);
61
+ await this.getDeviceRetry(device);
62
+ await this.getDeviceConfigSettings(device);
63
+ await this.getDeviceContext(accessory, device);
64
+ await this.setupMqtt(device);
65
+ await this.scan(device);
66
+ })();
65
67
 
66
68
  // Set accessory information
67
69
  accessory
@@ -71,8 +73,8 @@ export abstract class deviceBase {
71
73
  .setCharacteristic(this.hap.Characteristic.ConfiguredName, accessory.context.name)
72
74
  .setCharacteristic(this.hap.Characteristic.Model, accessory.context.model)
73
75
  .setCharacteristic(this.hap.Characteristic.SerialNumber, accessory.context.deviceId)
74
- .setCharacteristic(this.hap.Characteristic.FirmwareRevision, accessory.context.version)
75
- .setCharacteristic(this.hap.Characteristic.HardwareRevision, accessory.context.version);
76
+ .setCharacteristic(this.hap.Characteristic.FirmwareRevision, device.version?.toString() || accessory.context.version)
77
+ .setCharacteristic(this.hap.Characteristic.HardwareRevision, device.version?.toString() || accessory.context.version);
76
78
  }
77
79
 
78
80
  async getDeviceLogSettings(device: device & devicesConfig): Promise<void> {
@@ -551,8 +553,9 @@ export abstract class deviceBase {
551
553
  device.version = this.platform.version;
552
554
  accessory.context.version = this.platform.version;
553
555
  } else {
554
- accessory.context.version = device.version;
556
+ accessory.context.version = device.version?.toString;
555
557
  }
558
+ this.debugSuccessLog(`${this.device.deviceType}: ${this.accessory.displayName} Context: ${JSON.stringify(accessory.context)}`);
556
559
  }
557
560
 
558
561
  async statusCode(statusCode: number): Promise<void> {
package/src/device/fan.ts CHANGED
@@ -206,7 +206,7 @@ export class Fan extends deviceBase {
206
206
  // Firmware Version
207
207
  this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Firmware Version: ${deviceStatus.body.version}`);
208
208
  if (deviceStatus.body.version) {
209
- this.accessory.context.version = deviceStatus.body.version;
209
+ this.accessory.context.version = deviceStatus.body.version.toString();
210
210
  this.accessory
211
211
  .getService(this.hap.Service.AccessoryInformation)!
212
212
  .setCharacteristic(this.hap.Characteristic.FirmwareRevision, this.accessory.context.version)
package/src/device/hub.ts CHANGED
@@ -219,7 +219,7 @@ export class Hub extends deviceBase {
219
219
  // Firmware Version
220
220
  this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Firmware Version: ${deviceStatus.body.version}`);
221
221
  if (deviceStatus.body.version) {
222
- this.accessory.context.version = deviceStatus.body.version;
222
+ this.accessory.context.version = deviceStatus.body.version.toString();
223
223
  this.accessory
224
224
  .getService(this.hap.Service.AccessoryInformation)!
225
225
  .setCharacteristic(this.hap.Characteristic.FirmwareRevision, this.accessory.context.version)
@@ -271,7 +271,7 @@ export class Humidifier extends deviceBase {
271
271
  // Firmware Version
272
272
  this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Firmware Version: ${deviceStatus.body.version}`);
273
273
  if (deviceStatus.body.version) {
274
- this.accessory.context.version = deviceStatus.body.version;
274
+ this.accessory.context.version = deviceStatus.body.version.toString();
275
275
  this.accessory
276
276
  .getService(this.hap.Service.AccessoryInformation)!
277
277
  .setCharacteristic(this.hap.Characteristic.FirmwareRevision, this.accessory.context.version)
@@ -230,7 +230,7 @@ export class IOSensor extends deviceBase {
230
230
  // Firmware Version
231
231
  this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Firmware Version: ${deviceStatus.body.version}`);
232
232
  if (deviceStatus.body.version) {
233
- this.accessory.context.version = deviceStatus.body.version;
233
+ this.accessory.context.version = deviceStatus.body.version.toString();
234
234
  this.accessory
235
235
  .getService(this.hap.Service.AccessoryInformation)!
236
236
  .setCharacteristic(this.hap.Characteristic.FirmwareRevision, this.accessory.context.version)
@@ -328,7 +328,7 @@ export class StripLight extends deviceBase {
328
328
  // Firmware Version
329
329
  this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Firmware Version: ${deviceStatus.body.version}`);
330
330
  if (deviceStatus.body.version) {
331
- this.accessory.context.version = deviceStatus.body.version;
331
+ this.accessory.context.version = deviceStatus.body.version.toString();
332
332
  this.accessory
333
333
  .getService(this.hap.Service.AccessoryInformation)!
334
334
  .setCharacteristic(this.hap.Characteristic.FirmwareRevision, this.accessory.context.version)
@@ -258,7 +258,7 @@ export class Lock extends deviceBase {
258
258
  // Firmware Version
259
259
  this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Firmware Version: ${deviceStatus.body.version}`);
260
260
  if (deviceStatus.body.version) {
261
- this.accessory.context.version = deviceStatus.body.version;
261
+ this.accessory.context.version = deviceStatus.body.version.toString();
262
262
  this.accessory
263
263
  .getService(this.hap.Service.AccessoryInformation)!
264
264
  .setCharacteristic(this.hap.Characteristic.FirmwareRevision, this.accessory.context.version)
@@ -226,7 +226,7 @@ export class Meter extends deviceBase {
226
226
  // Firmware Version
227
227
  this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Firmware Version: ${deviceStatus.body.version}`);
228
228
  if (deviceStatus.body.version) {
229
- this.accessory.context.version = deviceStatus.body.version;
229
+ this.accessory.context.version = deviceStatus.body.version.toString();
230
230
  this.accessory
231
231
  .getService(this.hap.Service.AccessoryInformation)!
232
232
  .setCharacteristic(this.hap.Characteristic.FirmwareRevision, this.accessory.context.version)
@@ -227,7 +227,7 @@ export class MeterPlus extends deviceBase {
227
227
  // Firmware Version
228
228
  this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Firmware Version: ${deviceStatus.body.version}`);
229
229
  if (deviceStatus.body.version) {
230
- this.accessory.context.version = deviceStatus.body.version;
230
+ this.accessory.context.version = deviceStatus.body.version.toString();
231
231
  this.accessory
232
232
  .getService(this.hap.Service.AccessoryInformation)!
233
233
  .setCharacteristic(this.hap.Characteristic.FirmwareRevision, this.accessory.context.version)
@@ -202,7 +202,7 @@ export class Motion extends deviceBase {
202
202
  // Firmware Version
203
203
  this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Firmware Version: ${deviceStatus.body.version}`);
204
204
  if (deviceStatus.body.version) {
205
- this.accessory.context.version = deviceStatus.body.version;
205
+ this.accessory.context.version = deviceStatus.body.version.toString();
206
206
  this.accessory
207
207
  .getService(this.hap.Service.AccessoryInformation)!
208
208
  .setCharacteristic(this.hap.Characteristic.FirmwareRevision, this.accessory.context.version)
@@ -132,7 +132,7 @@ export class Plug extends deviceBase {
132
132
  // Firmware Version
133
133
  this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Firmware Version: ${deviceStatus.body.version}`);
134
134
  if (deviceStatus.body.version) {
135
- this.accessory.context.version = deviceStatus.body.version;
135
+ this.accessory.context.version = deviceStatus.body.version.toString();
136
136
  this.accessory
137
137
  .getService(this.hap.Service.AccessoryInformation)!
138
138
  .setCharacteristic(this.hap.Characteristic.FirmwareRevision, this.accessory.context.version)
@@ -201,7 +201,7 @@ export class RobotVacuumCleaner extends deviceBase {
201
201
  // Firmware Version
202
202
  this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Firmware Version: ${deviceStatus.body.version}`);
203
203
  if (deviceStatus.body.version) {
204
- this.accessory.context.version = deviceStatus.body.version;
204
+ this.accessory.context.version = deviceStatus.body.version.toString();
205
205
  this.accessory
206
206
  .getService(this.hap.Service.AccessoryInformation)!
207
207
  .setCharacteristic(this.hap.Characteristic.FirmwareRevision, this.accessory.context.version)
@@ -168,7 +168,7 @@ export class WaterDetector extends deviceBase {
168
168
  // Firmware Version
169
169
  this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Firmware Version: ${deviceStatus.body.version}`);
170
170
  if (deviceStatus.body.version) {
171
- this.accessory.context.version = deviceStatus.body.version;
171
+ this.accessory.context.version = deviceStatus.body.version.toString();
172
172
  this.accessory
173
173
  .getService(this.hap.Service.AccessoryInformation)!
174
174
  .setCharacteristic(this.hap.Characteristic.FirmwareRevision, this.accessory.context.version)
package/src/platform.ts CHANGED
@@ -846,7 +846,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
846
846
  existingAccessory.context.deviceID = device.deviceId;
847
847
  existingAccessory.displayName = device.configDeviceName || device.deviceName;
848
848
  if (device.version && !device.firmware) {
849
- existingAccessory.context.version = device.version;
849
+ existingAccessory.context.version = device.version.toString();
850
850
  }
851
851
  existingAccessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
852
852
  this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} DeviceID: ${device.deviceId}`);
@@ -874,7 +874,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
874
874
  accessory.context.model = device.deviceType;
875
875
  accessory.context.deviceID = device.deviceId;
876
876
  if (device.version && !device.firmware) {
877
- accessory.context.version = device.version;
877
+ accessory.context.version = device.version.toString();
878
878
  }
879
879
  accessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
880
880
  accessory.context.connectionType = await this.connectionType(device);
@@ -906,7 +906,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
906
906
  existingAccessory.context.deviceID = device.deviceId;
907
907
  existingAccessory.displayName = device.configDeviceName || device.deviceName;
908
908
  if (device.version && !device.firmware) {
909
- existingAccessory.context.version = device.version;
909
+ existingAccessory.context.version = device.version.toString();
910
910
  }
911
911
  existingAccessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
912
912
  this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} DeviceID: ${device.deviceId}`);
@@ -934,7 +934,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
934
934
  accessory.context.model = device.deviceType;
935
935
  accessory.context.deviceID = device.deviceId;
936
936
  if (device.version && !device.firmware) {
937
- accessory.context.version = device.version;
937
+ accessory.context.version = device.version.toString();
938
938
  }
939
939
  accessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
940
940
  accessory.context.connectionType = await this.connectionType(device);
@@ -967,7 +967,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
967
967
  existingAccessory.context.deviceID = device.deviceId;
968
968
  existingAccessory.displayName = device.configDeviceName || device.deviceName;
969
969
  if (device.version && !device.firmware) {
970
- existingAccessory.context.version = device.version;
970
+ existingAccessory.context.version = device.version.toString();
971
971
  }
972
972
  existingAccessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
973
973
  this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} DeviceID: ${device.deviceId}`);
@@ -995,7 +995,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
995
995
  accessory.context.model = device.deviceType;
996
996
  accessory.context.deviceID = device.deviceId;
997
997
  if (device.version && !device.firmware) {
998
- accessory.context.version = device.version;
998
+ accessory.context.version = device.version.toString();
999
999
  }
1000
1000
  accessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
1001
1001
  accessory.context.connectionType = await this.connectionType(device);
@@ -1028,7 +1028,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
1028
1028
  existingAccessory.context.deviceID = device.deviceId;
1029
1029
  existingAccessory.displayName = device.configDeviceName || device.deviceName;
1030
1030
  if (device.version && !device.firmware) {
1031
- existingAccessory.context.version = device.version;
1031
+ existingAccessory.context.version = device.version.toString();
1032
1032
  }
1033
1033
  existingAccessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
1034
1034
  this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} DeviceID: ${device.deviceId}`);
@@ -1056,7 +1056,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
1056
1056
  accessory.context.model = device.deviceType;
1057
1057
  accessory.context.deviceID = device.deviceId;
1058
1058
  if (device.version && !device.firmware) {
1059
- accessory.context.version = device.version;
1059
+ accessory.context.version = device.version.toString();
1060
1060
  }
1061
1061
  accessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
1062
1062
  accessory.context.connectionType = await this.connectionType(device);
@@ -1089,7 +1089,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
1089
1089
  existingAccessory.context.deviceID = device.deviceId;
1090
1090
  existingAccessory.displayName = device.configDeviceName || device.deviceName;
1091
1091
  if (device.version && !device.firmware) {
1092
- existingAccessory.context.version = device.version;
1092
+ existingAccessory.context.version = device.version.toString();
1093
1093
  }
1094
1094
  existingAccessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
1095
1095
  this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} DeviceID: ${device.deviceId}`);
@@ -1117,7 +1117,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
1117
1117
  accessory.context.model = device.deviceType;
1118
1118
  accessory.context.deviceID = device.deviceId;
1119
1119
  if (device.version && !device.firmware) {
1120
- accessory.context.version = device.version;
1120
+ accessory.context.version = device.version.toString();
1121
1121
  }
1122
1122
  accessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
1123
1123
  accessory.context.connectionType = await this.connectionType(device);
@@ -1149,7 +1149,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
1149
1149
  existingAccessory.context.deviceID = device.deviceId;
1150
1150
  existingAccessory.displayName = device.configDeviceName || device.deviceName;
1151
1151
  if (device.version && !device.firmware) {
1152
- existingAccessory.context.version = device.version;
1152
+ existingAccessory.context.version = device.version.toString();
1153
1153
  }
1154
1154
  existingAccessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
1155
1155
  this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} DeviceID: ${device.deviceId}`);
@@ -1177,7 +1177,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
1177
1177
  accessory.context.model = device.deviceType;
1178
1178
  accessory.context.deviceID = device.deviceId;
1179
1179
  if (device.version && !device.firmware) {
1180
- accessory.context.version = device.version;
1180
+ accessory.context.version = device.version.toString();
1181
1181
  }
1182
1182
  accessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
1183
1183
  accessory.context.connectionType = await this.connectionType(device);
@@ -1209,7 +1209,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
1209
1209
  existingAccessory.context.deviceID = device.deviceId;
1210
1210
  existingAccessory.displayName = device.configDeviceName || device.deviceName;
1211
1211
  if (device.version && !device.firmware) {
1212
- existingAccessory.context.version = device.version;
1212
+ existingAccessory.context.version = device.version.toString();
1213
1213
  }
1214
1214
  existingAccessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
1215
1215
  this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} DeviceID: ${device.deviceId}`);
@@ -1237,7 +1237,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
1237
1237
  accessory.context.model = device.deviceType;
1238
1238
  accessory.context.deviceID = device.deviceId;
1239
1239
  if (device.version && !device.firmware) {
1240
- accessory.context.version = device.version;
1240
+ accessory.context.version = device.version.toString();
1241
1241
  }
1242
1242
  accessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
1243
1243
  accessory.context.connectionType = await this.connectionType(device);
@@ -1269,7 +1269,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
1269
1269
  existingAccessory.context.deviceID = device.deviceId;
1270
1270
  existingAccessory.displayName = device.configDeviceName || device.deviceName;
1271
1271
  if (device.version && !device.firmware) {
1272
- existingAccessory.context.version = device.version;
1272
+ existingAccessory.context.version = device.version.toString();
1273
1273
  }
1274
1274
  existingAccessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
1275
1275
  this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} DeviceID: ${device.deviceId}`);
@@ -1297,7 +1297,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
1297
1297
  accessory.context.model = device.deviceType;
1298
1298
  accessory.context.deviceID = device.deviceId;
1299
1299
  if (device.version && !device.firmware) {
1300
- accessory.context.version = device.version;
1300
+ accessory.context.version = device.version.toString();
1301
1301
  }
1302
1302
  accessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
1303
1303
  accessory.context.connectionType = await this.connectionType(device);
@@ -1329,7 +1329,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
1329
1329
  existingAccessory.context.deviceID = device.deviceId;
1330
1330
  existingAccessory.displayName = device.configDeviceName || device.deviceName;
1331
1331
  if (device.version && !device.firmware) {
1332
- existingAccessory.context.version = device.version;
1332
+ existingAccessory.context.version = device.version.toString();
1333
1333
  }
1334
1334
  existingAccessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
1335
1335
  this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} DeviceID: ${device.deviceId}`);
@@ -1357,7 +1357,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
1357
1357
  accessory.context.model = device.deviceType;
1358
1358
  accessory.context.deviceID = device.deviceId;
1359
1359
  if (device.version && !device.firmware) {
1360
- accessory.context.version = device.version;
1360
+ accessory.context.version = device.version.toString();
1361
1361
  }
1362
1362
  accessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
1363
1363
  accessory.context.connectionType = await this.connectionType(device);
@@ -1389,7 +1389,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
1389
1389
  existingAccessory.context.deviceID = device.deviceId;
1390
1390
  existingAccessory.displayName = device.configDeviceName || device.deviceName;
1391
1391
  if (device.version && !device.firmware) {
1392
- existingAccessory.context.version = device.version;
1392
+ existingAccessory.context.version = device.version.toString();
1393
1393
  }
1394
1394
  existingAccessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
1395
1395
  this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} DeviceID: ${device.deviceId}`);
@@ -1430,7 +1430,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
1430
1430
  accessory.context.model = device.deviceType;
1431
1431
  accessory.context.deviceID = device.deviceId;
1432
1432
  if (device.version && !device.firmware) {
1433
- accessory.context.version = device.version;
1433
+ accessory.context.version = device.version.toString();
1434
1434
  }
1435
1435
  accessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
1436
1436
  accessory.context.connectionType = await this.connectionType(device);
@@ -1462,7 +1462,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
1462
1462
  existingAccessory.context.deviceID = device.deviceId;
1463
1463
  existingAccessory.displayName = device.configDeviceName || device.deviceName;
1464
1464
  if (device.version && !device.firmware) {
1465
- existingAccessory.context.version = device.version;
1465
+ existingAccessory.context.version = device.version.toString();
1466
1466
  }
1467
1467
  existingAccessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
1468
1468
  this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} DeviceID: ${device.deviceId}`);
@@ -1503,7 +1503,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
1503
1503
  accessory.context.model = device.deviceType;
1504
1504
  accessory.context.deviceID = device.deviceId;
1505
1505
  if (device.version && !device.firmware) {
1506
- accessory.context.version = device.version;
1506
+ accessory.context.version = device.version.toString();
1507
1507
  }
1508
1508
  accessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
1509
1509
  accessory.context.connectionType = await this.connectionType(device);
@@ -1535,7 +1535,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
1535
1535
  existingAccessory.context.deviceID = device.deviceId;
1536
1536
  existingAccessory.displayName = device.configDeviceName || device.deviceName;
1537
1537
  if (device.version && !device.firmware) {
1538
- existingAccessory.context.version = device.version;
1538
+ existingAccessory.context.version = device.version.toString();
1539
1539
  }
1540
1540
  existingAccessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
1541
1541
  this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} DeviceID: ${device.deviceId}`);
@@ -1563,7 +1563,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
1563
1563
  accessory.context.model = device.deviceType;
1564
1564
  accessory.context.deviceID = device.deviceId;
1565
1565
  if (device.version && !device.firmware) {
1566
- accessory.context.version = device.version;
1566
+ accessory.context.version = device.version.toString();
1567
1567
  }
1568
1568
  accessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
1569
1569
  accessory.context.connectionType = await this.connectionType(device);
@@ -1595,7 +1595,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
1595
1595
  existingAccessory.context.deviceID = device.deviceId;
1596
1596
  existingAccessory.displayName = device.configDeviceName || device.deviceName;
1597
1597
  if (device.version && !device.firmware) {
1598
- existingAccessory.context.version = device.version;
1598
+ existingAccessory.context.version = device.version.toString();
1599
1599
  }
1600
1600
  existingAccessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
1601
1601
  this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} DeviceID: ${device.deviceId}`);
@@ -1623,7 +1623,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
1623
1623
  accessory.context.model = device.deviceType;
1624
1624
  accessory.context.deviceID = device.deviceId;
1625
1625
  if (device.version && !device.firmware) {
1626
- accessory.context.version = device.version;
1626
+ accessory.context.version = device.version.toString();
1627
1627
  }
1628
1628
  accessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
1629
1629
  accessory.context.connectionType = await this.connectionType(device);
@@ -1656,7 +1656,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
1656
1656
  existingAccessory.displayName = device.configDeviceName || device.deviceName;
1657
1657
  this.warnLog(`${existingAccessory.displayName} version: ${device.version} firmware: ${device.firmware}`);
1658
1658
  if (device.version && !device.firmware) {
1659
- existingAccessory.context.version = device.version;
1659
+ existingAccessory.context.version = device.version.toString();
1660
1660
  }
1661
1661
  existingAccessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
1662
1662
  this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} DeviceID: ${device.deviceId}`);
@@ -1684,7 +1684,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
1684
1684
  accessory.context.model = device.deviceType;
1685
1685
  accessory.context.deviceID = device.deviceId;
1686
1686
  if (device.version && !device.firmware) {
1687
- accessory.context.version = device.version;
1687
+ accessory.context.version = device.version.toString();
1688
1688
  }
1689
1689
  accessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
1690
1690
  accessory.context.connectionType = await this.connectionType(device);
@@ -1716,7 +1716,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
1716
1716
  existingAccessory.context.deviceID = device.deviceId;
1717
1717
  existingAccessory.displayName = device.configDeviceName || device.deviceName;
1718
1718
  if (device.version && !device.firmware) {
1719
- existingAccessory.context.version = device.version;
1719
+ existingAccessory.context.version = device.version.toString();
1720
1720
  }
1721
1721
  existingAccessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
1722
1722
  this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} DeviceID: ${device.deviceId}`);
@@ -1744,7 +1744,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
1744
1744
  accessory.context.model = device.deviceType;
1745
1745
  accessory.context.deviceID = device.deviceId;
1746
1746
  if (device.version && !device.firmware) {
1747
- accessory.context.version = device.version;
1747
+ accessory.context.version = device.version.toString();
1748
1748
  }
1749
1749
  accessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
1750
1750
  accessory.context.connectionType = await this.connectionType(device);
@@ -1776,7 +1776,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
1776
1776
  existingAccessory.context.deviceID = device.deviceId;
1777
1777
  existingAccessory.displayName = device.configDeviceName || device.deviceName;
1778
1778
  if (device.version && !device.firmware) {
1779
- existingAccessory.context.version = device.version;
1779
+ existingAccessory.context.version = device.version.toString();
1780
1780
  }
1781
1781
  existingAccessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
1782
1782
  this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} DeviceID: ${device.deviceId}`);
@@ -1804,7 +1804,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
1804
1804
  accessory.context.model = device.deviceType;
1805
1805
  accessory.context.deviceID = device.deviceId;
1806
1806
  if (device.version && !device.firmware) {
1807
- accessory.context.version = device.version;
1807
+ accessory.context.version = device.version.toString();
1808
1808
  }
1809
1809
  accessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
1810
1810
  accessory.context.connectionType = await this.connectionType(device);
@@ -1836,7 +1836,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
1836
1836
  existingAccessory.context.deviceID = device.deviceId;
1837
1837
  existingAccessory.displayName = device.configDeviceName || device.deviceName;
1838
1838
  if (device.version && !device.firmware) {
1839
- existingAccessory.context.version = device.version;
1839
+ existingAccessory.context.version = device.version.toString();
1840
1840
  }
1841
1841
  existingAccessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
1842
1842
  this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} DeviceID: ${device.deviceId}`);
@@ -1864,7 +1864,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
1864
1864
  accessory.context.model = device.deviceType;
1865
1865
  accessory.context.deviceID = device.deviceId;
1866
1866
  if (device.version && !device.firmware) {
1867
- accessory.context.version = device.version;
1867
+ accessory.context.version = device.version.toString();
1868
1868
  }
1869
1869
  accessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
1870
1870
  accessory.context.connectionType = await this.connectionType(device);
@@ -1896,7 +1896,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
1896
1896
  existingAccessory.context.deviceID = device.deviceId;
1897
1897
  existingAccessory.displayName = device.configDeviceName || device.deviceName;
1898
1898
  if (device.version && !device.firmware) {
1899
- existingAccessory.context.version = device.version;
1899
+ existingAccessory.context.version = device.version.toString();
1900
1900
  }
1901
1901
  existingAccessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
1902
1902
  this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} DeviceID: ${device.deviceId}`);
@@ -1924,7 +1924,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
1924
1924
  accessory.context.model = device.deviceType;
1925
1925
  accessory.context.deviceID = device.deviceId;
1926
1926
  if (device.version && !device.firmware) {
1927
- accessory.context.version = device.version;
1927
+ accessory.context.version = device.version.toString();
1928
1928
  }
1929
1929
  accessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
1930
1930
  accessory.context.connectionType = await this.connectionType(device);
@@ -1954,7 +1954,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
1954
1954
  existingAccessory.context.deviceID = device.deviceId;
1955
1955
  existingAccessory.displayName = device.configDeviceName || device.deviceName;
1956
1956
  if (device.version && !device.firmware) {
1957
- existingAccessory.context.version = device.version;
1957
+ existingAccessory.context.version = device.version.toString();
1958
1958
  }
1959
1959
  existingAccessory.context.deviceType = `IR: ${device.remoteType}`;
1960
1960
  this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} DeviceID: ${device.deviceId}`);
@@ -1979,7 +1979,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
1979
1979
  accessory.context.model = device.remoteType;
1980
1980
  accessory.context.deviceID = device.deviceId;
1981
1981
  if (device.version && !device.firmware) {
1982
- accessory.context.version = device.version;
1982
+ accessory.context.version = device.version.toString();
1983
1983
  }
1984
1984
  accessory.context.deviceType = `IR: ${device.remoteType}`;
1985
1985
  accessory.context.connectionType = device.connectionType;
@@ -2010,7 +2010,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
2010
2010
  existingAccessory.context.deviceID = device.deviceId;
2011
2011
  existingAccessory.displayName = device.configDeviceName || device.deviceName;
2012
2012
  if (device.version && !device.firmware) {
2013
- existingAccessory.context.version = device.version;
2013
+ existingAccessory.context.version = device.version.toString();
2014
2014
  }
2015
2015
  existingAccessory.context.deviceType = `IR: ${device.remoteType}`;
2016
2016
  this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} DeviceID: ${device.deviceId}`);
@@ -2038,7 +2038,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
2038
2038
  accessory.context.model = device.remoteType;
2039
2039
  accessory.context.deviceID = device.deviceId;
2040
2040
  if (device.version && !device.firmware) {
2041
- accessory.context.version = device.version;
2041
+ accessory.context.version = device.version.toString();
2042
2042
  }
2043
2043
  accessory.context.deviceType = `IR: ${device.remoteType}`;
2044
2044
  accessory.context.connectionType = device.connectionType;
@@ -2070,7 +2070,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
2070
2070
  existingAccessory.context.deviceID = device.deviceId;
2071
2071
  existingAccessory.displayName = device.configDeviceName || device.deviceName;
2072
2072
  if (device.version && !device.firmware) {
2073
- existingAccessory.context.version = device.version;
2073
+ existingAccessory.context.version = device.version.toString();
2074
2074
  }
2075
2075
  existingAccessory.context.deviceType = `IR: ${device.remoteType}`;
2076
2076
  this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} DeviceID: ${device.deviceId}`);
@@ -2098,7 +2098,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
2098
2098
  accessory.context.model = device.remoteType;
2099
2099
  accessory.context.deviceID = device.deviceId;
2100
2100
  if (device.version && !device.firmware) {
2101
- accessory.context.version = device.version;
2101
+ accessory.context.version = device.version.toString();
2102
2102
  }
2103
2103
  accessory.context.deviceType = `IR: ${device.remoteType}`;
2104
2104
  accessory.context.connectionType = device.connectionType;
@@ -2130,7 +2130,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
2130
2130
  existingAccessory.context.deviceID = device.deviceId;
2131
2131
  existingAccessory.displayName = device.configDeviceName || device.deviceName;
2132
2132
  if (device.version && !device.firmware) {
2133
- existingAccessory.context.version = device.version;
2133
+ existingAccessory.context.version = device.version.toString();
2134
2134
  }
2135
2135
  existingAccessory.context.deviceType = `IR: ${device.remoteType}`;
2136
2136
  this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} DeviceID: ${device.deviceId}`);
@@ -2158,7 +2158,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
2158
2158
  accessory.context.model = device.remoteType;
2159
2159
  accessory.context.deviceID = device.deviceId;
2160
2160
  if (device.version && !device.firmware) {
2161
- accessory.context.version = device.version;
2161
+ accessory.context.version = device.version.toString();
2162
2162
  }
2163
2163
  accessory.context.deviceType = `IR: ${device.remoteType}`;
2164
2164
  accessory.context.connectionType = device.connectionType;
@@ -2190,7 +2190,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
2190
2190
  existingAccessory.context.deviceID = device.deviceId;
2191
2191
  existingAccessory.displayName = device.configDeviceName || device.deviceName;
2192
2192
  if (device.version && !device.firmware) {
2193
- existingAccessory.context.version = device.version;
2193
+ existingAccessory.context.version = device.version.toString();
2194
2194
  }
2195
2195
  existingAccessory.context.deviceType = `IR: ${device.remoteType}`;
2196
2196
  this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} DeviceID: ${device.deviceId}`);
@@ -2218,7 +2218,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
2218
2218
  accessory.context.model = device.remoteType;
2219
2219
  accessory.context.deviceID = device.deviceId;
2220
2220
  if (device.version && !device.firmware) {
2221
- accessory.context.version = device.version;
2221
+ accessory.context.version = device.version.toString();
2222
2222
  }
2223
2223
  accessory.context.deviceType = `IR: ${device.remoteType}`;
2224
2224
  accessory.context.connectionType = device.connectionType;
@@ -2250,7 +2250,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
2250
2250
  existingAccessory.context.deviceID = device.deviceId;
2251
2251
  existingAccessory.displayName = device.configDeviceName || device.deviceName;
2252
2252
  if (device.version && !device.firmware) {
2253
- existingAccessory.context.version = device.version;
2253
+ existingAccessory.context.version = device.version.toString();
2254
2254
  }
2255
2255
  existingAccessory.context.deviceType = `IR: ${device.remoteType}`;
2256
2256
  this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} DeviceID: ${device.deviceId}`);
@@ -2278,7 +2278,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
2278
2278
  accessory.context.model = device.remoteType;
2279
2279
  accessory.context.deviceID = device.deviceId;
2280
2280
  if (device.version && !device.firmware) {
2281
- accessory.context.version = device.version;
2281
+ accessory.context.version = device.version.toString();
2282
2282
  }
2283
2283
  accessory.context.deviceType = `IR: ${device.remoteType}`;
2284
2284
  accessory.context.connectionType = device.connectionType;
@@ -2310,7 +2310,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
2310
2310
  existingAccessory.context.deviceID = device.deviceId;
2311
2311
  existingAccessory.displayName = device.configDeviceName || device.deviceName;
2312
2312
  if (device.version && !device.firmware) {
2313
- existingAccessory.context.version = device.version;
2313
+ existingAccessory.context.version = device.version.toString();
2314
2314
  }
2315
2315
  existingAccessory.context.deviceType = `IR: ${device.remoteType}`;
2316
2316
  this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} DeviceID: ${device.deviceId}`);
@@ -2338,7 +2338,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
2338
2338
  accessory.context.model = device.remoteType;
2339
2339
  accessory.context.deviceID = device.deviceId;
2340
2340
  if (device.version && !device.firmware) {
2341
- accessory.context.version = device.version;
2341
+ accessory.context.version = device.version.toString();
2342
2342
  }
2343
2343
  accessory.context.deviceType = `IR: ${device.remoteType}`;
2344
2344
  accessory.context.connectionType = device.connectionType;
@@ -2370,7 +2370,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
2370
2370
  existingAccessory.context.deviceID = device.deviceId;
2371
2371
  existingAccessory.displayName = device.configDeviceName || device.deviceName;
2372
2372
  if (device.version && !device.firmware) {
2373
- existingAccessory.context.version = device.version;
2373
+ existingAccessory.context.version = device.version.toString();
2374
2374
  }
2375
2375
  existingAccessory.context.deviceType = `IR: ${device.remoteType}`;
2376
2376
  this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} DeviceID: ${device.deviceId}`);
@@ -2398,7 +2398,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
2398
2398
  accessory.context.model = device.remoteType;
2399
2399
  accessory.context.deviceID = device.deviceId;
2400
2400
  if (device.version && !device.firmware) {
2401
- accessory.context.version = device.version;
2401
+ accessory.context.version = device.version.toString();
2402
2402
  }
2403
2403
  accessory.context.deviceType = `IR: ${device.remoteType}`;
2404
2404
  accessory.context.connectionType = device.connectionType;
@@ -2430,7 +2430,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
2430
2430
  existingAccessory.context.deviceID = device.deviceId;
2431
2431
  existingAccessory.displayName = device.configDeviceName || device.deviceName;
2432
2432
  if (device.version && !device.firmware) {
2433
- existingAccessory.context.version = device.version;
2433
+ existingAccessory.context.version = device.version.toString();
2434
2434
  }
2435
2435
  existingAccessory.context.deviceType = `IR: ${device.remoteType}`;
2436
2436
  this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} DeviceID: ${device.deviceId}`);
@@ -2458,7 +2458,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
2458
2458
  accessory.context.model = device.remoteType;
2459
2459
  accessory.context.deviceID = device.deviceId;
2460
2460
  if (device.version && !device.firmware) {
2461
- accessory.context.version = device.version;
2461
+ accessory.context.version = device.version.toString();
2462
2462
  }
2463
2463
  accessory.context.deviceType = `IR: ${device.remoteType}`;
2464
2464
  accessory.context.connectionType = device.connectionType;