@switchbot/homebridge-switchbot 3.5.0-beta.49 → 3.5.0-beta.50

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/src/platform.ts CHANGED
@@ -845,8 +845,8 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
845
845
  existingAccessory.context.model = device.deviceType;
846
846
  existingAccessory.context.deviceID = device.deviceId;
847
847
  existingAccessory.displayName = device.configDeviceName || device.deviceName;
848
- if (device.version && !device.firmware) {
849
- existingAccessory.context.version = device.version.toString();
848
+ if (device.firmware) {
849
+ existingAccessory.context.version = device.firmware;
850
850
  }
851
851
  existingAccessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
852
852
  this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} DeviceID: ${device.deviceId}`);
@@ -873,8 +873,8 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
873
873
  accessory.context.device = device;
874
874
  accessory.context.model = device.deviceType;
875
875
  accessory.context.deviceID = device.deviceId;
876
- if (device.version && !device.firmware) {
877
- accessory.context.version = device.version.toString();
876
+ if (device.firmware) {
877
+ accessory.context.version = device.firmware;
878
878
  }
879
879
  accessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
880
880
  accessory.context.connectionType = await this.connectionType(device);
@@ -905,8 +905,8 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
905
905
  existingAccessory.context.model = device.deviceType;
906
906
  existingAccessory.context.deviceID = device.deviceId;
907
907
  existingAccessory.displayName = device.configDeviceName || device.deviceName;
908
- if (device.version && !device.firmware) {
909
- existingAccessory.context.version = device.version.toString();
908
+ if (device.firmware) {
909
+ existingAccessory.context.version = device.firmware;
910
910
  }
911
911
  existingAccessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
912
912
  this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} DeviceID: ${device.deviceId}`);
@@ -933,8 +933,8 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
933
933
  accessory.context.device = device;
934
934
  accessory.context.model = device.deviceType;
935
935
  accessory.context.deviceID = device.deviceId;
936
- if (device.version && !device.firmware) {
937
- accessory.context.version = device.version.toString();
936
+ if (device.firmware) {
937
+ accessory.context.version = device.firmware;
938
938
  }
939
939
  accessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
940
940
  accessory.context.connectionType = await this.connectionType(device);
@@ -966,8 +966,8 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
966
966
  existingAccessory.context.model = device.deviceType;
967
967
  existingAccessory.context.deviceID = device.deviceId;
968
968
  existingAccessory.displayName = device.configDeviceName || device.deviceName;
969
- if (device.version && !device.firmware) {
970
- existingAccessory.context.version = device.version.toString();
969
+ if (device.firmware) {
970
+ existingAccessory.context.version = device.firmware;
971
971
  }
972
972
  existingAccessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
973
973
  this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} DeviceID: ${device.deviceId}`);
@@ -994,8 +994,8 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
994
994
  accessory.context.device = device;
995
995
  accessory.context.model = device.deviceType;
996
996
  accessory.context.deviceID = device.deviceId;
997
- if (device.version && !device.firmware) {
998
- accessory.context.version = device.version.toString();
997
+ if (device.firmware) {
998
+ accessory.context.version = device.firmware;
999
999
  }
1000
1000
  accessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
1001
1001
  accessory.context.connectionType = await this.connectionType(device);
@@ -1027,8 +1027,8 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
1027
1027
  existingAccessory.context.model = device.deviceType;
1028
1028
  existingAccessory.context.deviceID = device.deviceId;
1029
1029
  existingAccessory.displayName = device.configDeviceName || device.deviceName;
1030
- if (device.version && !device.firmware) {
1031
- existingAccessory.context.version = device.version.toString();
1030
+ if (device.firmware) {
1031
+ existingAccessory.context.version = device.firmware;
1032
1032
  }
1033
1033
  existingAccessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
1034
1034
  this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} DeviceID: ${device.deviceId}`);
@@ -1055,8 +1055,8 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
1055
1055
  accessory.context.device = device;
1056
1056
  accessory.context.model = device.deviceType;
1057
1057
  accessory.context.deviceID = device.deviceId;
1058
- if (device.version && !device.firmware) {
1059
- accessory.context.version = device.version.toString();
1058
+ if (device.firmware) {
1059
+ accessory.context.version = device.firmware;
1060
1060
  }
1061
1061
  accessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
1062
1062
  accessory.context.connectionType = await this.connectionType(device);
@@ -1088,8 +1088,8 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
1088
1088
  existingAccessory.context.model = device.deviceType;
1089
1089
  existingAccessory.context.deviceID = device.deviceId;
1090
1090
  existingAccessory.displayName = device.configDeviceName || device.deviceName;
1091
- if (device.version && !device.firmware) {
1092
- existingAccessory.context.version = device.version.toString();
1091
+ if (device.firmware) {
1092
+ existingAccessory.context.version = device.firmware;
1093
1093
  }
1094
1094
  existingAccessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
1095
1095
  this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} DeviceID: ${device.deviceId}`);
@@ -1116,8 +1116,8 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
1116
1116
  accessory.context.device = device;
1117
1117
  accessory.context.model = device.deviceType;
1118
1118
  accessory.context.deviceID = device.deviceId;
1119
- if (device.version && !device.firmware) {
1120
- accessory.context.version = device.version.toString();
1119
+ if (device.firmware) {
1120
+ accessory.context.version = device.firmware;
1121
1121
  }
1122
1122
  accessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
1123
1123
  accessory.context.connectionType = await this.connectionType(device);
@@ -1148,8 +1148,8 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
1148
1148
  existingAccessory.context.model = device.deviceType;
1149
1149
  existingAccessory.context.deviceID = device.deviceId;
1150
1150
  existingAccessory.displayName = device.configDeviceName || device.deviceName;
1151
- if (device.version && !device.firmware) {
1152
- existingAccessory.context.version = device.version.toString();
1151
+ if (device.firmware) {
1152
+ existingAccessory.context.version = device.firmware;
1153
1153
  }
1154
1154
  existingAccessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
1155
1155
  this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} DeviceID: ${device.deviceId}`);
@@ -1176,8 +1176,8 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
1176
1176
  accessory.context.device = device;
1177
1177
  accessory.context.model = device.deviceType;
1178
1178
  accessory.context.deviceID = device.deviceId;
1179
- if (device.version && !device.firmware) {
1180
- accessory.context.version = device.version.toString();
1179
+ if (device.firmware) {
1180
+ accessory.context.version = device.firmware;
1181
1181
  }
1182
1182
  accessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
1183
1183
  accessory.context.connectionType = await this.connectionType(device);
@@ -1208,8 +1208,8 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
1208
1208
  existingAccessory.context.model = device.deviceType;
1209
1209
  existingAccessory.context.deviceID = device.deviceId;
1210
1210
  existingAccessory.displayName = device.configDeviceName || device.deviceName;
1211
- if (device.version && !device.firmware) {
1212
- existingAccessory.context.version = device.version.toString();
1211
+ if (device.firmware) {
1212
+ existingAccessory.context.version = device.firmware;
1213
1213
  }
1214
1214
  existingAccessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
1215
1215
  this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} DeviceID: ${device.deviceId}`);
@@ -1236,8 +1236,8 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
1236
1236
  accessory.context.device = device;
1237
1237
  accessory.context.model = device.deviceType;
1238
1238
  accessory.context.deviceID = device.deviceId;
1239
- if (device.version && !device.firmware) {
1240
- accessory.context.version = device.version.toString();
1239
+ if (device.firmware) {
1240
+ accessory.context.version = device.firmware;
1241
1241
  }
1242
1242
  accessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
1243
1243
  accessory.context.connectionType = await this.connectionType(device);
@@ -1268,8 +1268,8 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
1268
1268
  existingAccessory.context.model = device.deviceType;
1269
1269
  existingAccessory.context.deviceID = device.deviceId;
1270
1270
  existingAccessory.displayName = device.configDeviceName || device.deviceName;
1271
- if (device.version && !device.firmware) {
1272
- existingAccessory.context.version = device.version.toString();
1271
+ if (device.firmware) {
1272
+ existingAccessory.context.version = device.firmware;
1273
1273
  }
1274
1274
  existingAccessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
1275
1275
  this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} DeviceID: ${device.deviceId}`);
@@ -1296,8 +1296,8 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
1296
1296
  accessory.context.device = device;
1297
1297
  accessory.context.model = device.deviceType;
1298
1298
  accessory.context.deviceID = device.deviceId;
1299
- if (device.version && !device.firmware) {
1300
- accessory.context.version = device.version.toString();
1299
+ if (device.firmware) {
1300
+ accessory.context.version = device.firmware;
1301
1301
  }
1302
1302
  accessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
1303
1303
  accessory.context.connectionType = await this.connectionType(device);
@@ -1328,8 +1328,8 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
1328
1328
  existingAccessory.context.model = device.deviceType;
1329
1329
  existingAccessory.context.deviceID = device.deviceId;
1330
1330
  existingAccessory.displayName = device.configDeviceName || device.deviceName;
1331
- if (device.version && !device.firmware) {
1332
- existingAccessory.context.version = device.version.toString();
1331
+ if (device.firmware) {
1332
+ existingAccessory.context.version = device.firmware;
1333
1333
  }
1334
1334
  existingAccessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
1335
1335
  this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} DeviceID: ${device.deviceId}`);
@@ -1356,8 +1356,8 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
1356
1356
  accessory.context.device = device;
1357
1357
  accessory.context.model = device.deviceType;
1358
1358
  accessory.context.deviceID = device.deviceId;
1359
- if (device.version && !device.firmware) {
1360
- accessory.context.version = device.version.toString();
1359
+ if (device.firmware) {
1360
+ accessory.context.version = device.firmware;
1361
1361
  }
1362
1362
  accessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
1363
1363
  accessory.context.connectionType = await this.connectionType(device);
@@ -1388,8 +1388,8 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
1388
1388
  existingAccessory.context.model = device.deviceType;
1389
1389
  existingAccessory.context.deviceID = device.deviceId;
1390
1390
  existingAccessory.displayName = device.configDeviceName || device.deviceName;
1391
- if (device.version && !device.firmware) {
1392
- existingAccessory.context.version = device.version.toString();
1391
+ if (device.firmware) {
1392
+ existingAccessory.context.version = device.firmware;
1393
1393
  }
1394
1394
  existingAccessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
1395
1395
  this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} DeviceID: ${device.deviceId}`);
@@ -1429,8 +1429,8 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
1429
1429
  accessory.context.device = device;
1430
1430
  accessory.context.model = device.deviceType;
1431
1431
  accessory.context.deviceID = device.deviceId;
1432
- if (device.version && !device.firmware) {
1433
- accessory.context.version = device.version.toString();
1432
+ if (device.firmware) {
1433
+ accessory.context.version = device.firmware;
1434
1434
  }
1435
1435
  accessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
1436
1436
  accessory.context.connectionType = await this.connectionType(device);
@@ -1461,8 +1461,8 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
1461
1461
  existingAccessory.context.model = device.deviceType;
1462
1462
  existingAccessory.context.deviceID = device.deviceId;
1463
1463
  existingAccessory.displayName = device.configDeviceName || device.deviceName;
1464
- if (device.version && !device.firmware) {
1465
- existingAccessory.context.version = device.version.toString();
1464
+ if (device.firmware) {
1465
+ existingAccessory.context.version = device.firmware;
1466
1466
  }
1467
1467
  existingAccessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
1468
1468
  this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} DeviceID: ${device.deviceId}`);
@@ -1502,8 +1502,8 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
1502
1502
  accessory.context.device = device;
1503
1503
  accessory.context.model = device.deviceType;
1504
1504
  accessory.context.deviceID = device.deviceId;
1505
- if (device.version && !device.firmware) {
1506
- accessory.context.version = device.version.toString();
1505
+ if (device.firmware) {
1506
+ accessory.context.version = device.firmware;
1507
1507
  }
1508
1508
  accessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
1509
1509
  accessory.context.connectionType = await this.connectionType(device);
@@ -1534,8 +1534,8 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
1534
1534
  existingAccessory.context.model = device.deviceType;
1535
1535
  existingAccessory.context.deviceID = device.deviceId;
1536
1536
  existingAccessory.displayName = device.configDeviceName || device.deviceName;
1537
- if (device.version && !device.firmware) {
1538
- existingAccessory.context.version = device.version.toString();
1537
+ if (device.firmware) {
1538
+ existingAccessory.context.version = device.firmware;
1539
1539
  }
1540
1540
  existingAccessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
1541
1541
  this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} DeviceID: ${device.deviceId}`);
@@ -1562,8 +1562,8 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
1562
1562
  accessory.context.device = device;
1563
1563
  accessory.context.model = device.deviceType;
1564
1564
  accessory.context.deviceID = device.deviceId;
1565
- if (device.version && !device.firmware) {
1566
- accessory.context.version = device.version.toString();
1565
+ if (device.firmware) {
1566
+ accessory.context.version = device.firmware;
1567
1567
  }
1568
1568
  accessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
1569
1569
  accessory.context.connectionType = await this.connectionType(device);
@@ -1594,8 +1594,8 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
1594
1594
  existingAccessory.context.model = device.deviceType;
1595
1595
  existingAccessory.context.deviceID = device.deviceId;
1596
1596
  existingAccessory.displayName = device.configDeviceName || device.deviceName;
1597
- if (device.version && !device.firmware) {
1598
- existingAccessory.context.version = device.version.toString();
1597
+ if (device.firmware) {
1598
+ existingAccessory.context.version = device.firmware;
1599
1599
  }
1600
1600
  existingAccessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
1601
1601
  this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} DeviceID: ${device.deviceId}`);
@@ -1622,8 +1622,8 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
1622
1622
  accessory.context.device = device;
1623
1623
  accessory.context.model = device.deviceType;
1624
1624
  accessory.context.deviceID = device.deviceId;
1625
- if (device.version && !device.firmware) {
1626
- accessory.context.version = device.version.toString();
1625
+ if (device.firmware) {
1626
+ accessory.context.version = device.firmware;
1627
1627
  }
1628
1628
  accessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
1629
1629
  accessory.context.connectionType = await this.connectionType(device);
@@ -1654,9 +1654,8 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
1654
1654
  existingAccessory.context.model = device.deviceType;
1655
1655
  existingAccessory.context.deviceID = device.deviceId;
1656
1656
  existingAccessory.displayName = device.configDeviceName || device.deviceName;
1657
- this.warnLog(`${existingAccessory.displayName} version: ${device.version} firmware: ${device.firmware}`);
1658
- if (device.version && !device.firmware) {
1659
- existingAccessory.context.version = device.version.toString();
1657
+ if (device.firmware) {
1658
+ existingAccessory.context.version = device.firmware;
1660
1659
  }
1661
1660
  existingAccessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
1662
1661
  this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} DeviceID: ${device.deviceId}`);
@@ -1683,8 +1682,8 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
1683
1682
  accessory.context.device = device;
1684
1683
  accessory.context.model = device.deviceType;
1685
1684
  accessory.context.deviceID = device.deviceId;
1686
- if (device.version && !device.firmware) {
1687
- accessory.context.version = device.version.toString();
1685
+ if (device.firmware) {
1686
+ accessory.context.version = device.firmware;
1688
1687
  }
1689
1688
  accessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
1690
1689
  accessory.context.connectionType = await this.connectionType(device);
@@ -1715,8 +1714,8 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
1715
1714
  existingAccessory.context.model = device.deviceType;
1716
1715
  existingAccessory.context.deviceID = device.deviceId;
1717
1716
  existingAccessory.displayName = device.configDeviceName || device.deviceName;
1718
- if (device.version && !device.firmware) {
1719
- existingAccessory.context.version = device.version.toString();
1717
+ if (device.firmware) {
1718
+ existingAccessory.context.version = device.firmware;
1720
1719
  }
1721
1720
  existingAccessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
1722
1721
  this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} DeviceID: ${device.deviceId}`);
@@ -1743,8 +1742,8 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
1743
1742
  accessory.context.device = device;
1744
1743
  accessory.context.model = device.deviceType;
1745
1744
  accessory.context.deviceID = device.deviceId;
1746
- if (device.version && !device.firmware) {
1747
- accessory.context.version = device.version.toString();
1745
+ if (device.firmware) {
1746
+ accessory.context.version = device.firmware;
1748
1747
  }
1749
1748
  accessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
1750
1749
  accessory.context.connectionType = await this.connectionType(device);
@@ -1775,8 +1774,8 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
1775
1774
  existingAccessory.context.model = device.deviceType;
1776
1775
  existingAccessory.context.deviceID = device.deviceId;
1777
1776
  existingAccessory.displayName = device.configDeviceName || device.deviceName;
1778
- if (device.version && !device.firmware) {
1779
- existingAccessory.context.version = device.version.toString();
1777
+ if (device.firmware) {
1778
+ existingAccessory.context.version = device.firmware;
1780
1779
  }
1781
1780
  existingAccessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
1782
1781
  this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} DeviceID: ${device.deviceId}`);
@@ -1803,8 +1802,8 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
1803
1802
  accessory.context.device = device;
1804
1803
  accessory.context.model = device.deviceType;
1805
1804
  accessory.context.deviceID = device.deviceId;
1806
- if (device.version && !device.firmware) {
1807
- accessory.context.version = device.version.toString();
1805
+ if (device.firmware) {
1806
+ accessory.context.version = device.firmware;
1808
1807
  }
1809
1808
  accessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
1810
1809
  accessory.context.connectionType = await this.connectionType(device);
@@ -1835,8 +1834,8 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
1835
1834
  existingAccessory.context.model = device.deviceType;
1836
1835
  existingAccessory.context.deviceID = device.deviceId;
1837
1836
  existingAccessory.displayName = device.configDeviceName || device.deviceName;
1838
- if (device.version && !device.firmware) {
1839
- existingAccessory.context.version = device.version.toString();
1837
+ if (device.firmware) {
1838
+ existingAccessory.context.version = device.firmware;
1840
1839
  }
1841
1840
  existingAccessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
1842
1841
  this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} DeviceID: ${device.deviceId}`);
@@ -1863,8 +1862,8 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
1863
1862
  accessory.context.device = device;
1864
1863
  accessory.context.model = device.deviceType;
1865
1864
  accessory.context.deviceID = device.deviceId;
1866
- if (device.version && !device.firmware) {
1867
- accessory.context.version = device.version.toString();
1865
+ if (device.firmware) {
1866
+ accessory.context.version = device.firmware;
1868
1867
  }
1869
1868
  accessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
1870
1869
  accessory.context.connectionType = await this.connectionType(device);
@@ -1895,8 +1894,8 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
1895
1894
  existingAccessory.context.model = device.deviceType;
1896
1895
  existingAccessory.context.deviceID = device.deviceId;
1897
1896
  existingAccessory.displayName = device.configDeviceName || device.deviceName;
1898
- if (device.version && !device.firmware) {
1899
- existingAccessory.context.version = device.version.toString();
1897
+ if (device.firmware) {
1898
+ existingAccessory.context.version = device.firmware;
1900
1899
  }
1901
1900
  existingAccessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
1902
1901
  this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} DeviceID: ${device.deviceId}`);
@@ -1923,8 +1922,8 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
1923
1922
  accessory.context.device = device;
1924
1923
  accessory.context.model = device.deviceType;
1925
1924
  accessory.context.deviceID = device.deviceId;
1926
- if (device.version && !device.firmware) {
1927
- accessory.context.version = device.version.toString();
1925
+ if (device.firmware) {
1926
+ accessory.context.version = device.firmware;
1928
1927
  }
1929
1928
  accessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
1930
1929
  accessory.context.connectionType = await this.connectionType(device);
@@ -1954,7 +1953,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
1954
1953
  existingAccessory.context.deviceID = device.deviceId;
1955
1954
  existingAccessory.displayName = device.configDeviceName || device.deviceName;
1956
1955
  if (device.version && !device.firmware) {
1957
- existingAccessory.context.version = device.version.toString();
1956
+ existingAccessory.context.version = device.version;
1958
1957
  }
1959
1958
  existingAccessory.context.deviceType = `IR: ${device.remoteType}`;
1960
1959
  this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} DeviceID: ${device.deviceId}`);
@@ -1978,8 +1977,8 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
1978
1977
  accessory.context.device = device;
1979
1978
  accessory.context.model = device.remoteType;
1980
1979
  accessory.context.deviceID = device.deviceId;
1981
- if (device.version && !device.firmware) {
1982
- accessory.context.version = device.version.toString();
1980
+ if (device.firmware) {
1981
+ accessory.context.version = device.firmware;
1983
1982
  }
1984
1983
  accessory.context.deviceType = `IR: ${device.remoteType}`;
1985
1984
  accessory.context.connectionType = device.connectionType;
@@ -2009,8 +2008,8 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
2009
2008
  existingAccessory.context.model = device.remoteType;
2010
2009
  existingAccessory.context.deviceID = device.deviceId;
2011
2010
  existingAccessory.displayName = device.configDeviceName || device.deviceName;
2012
- if (device.version && !device.firmware) {
2013
- existingAccessory.context.version = device.version.toString();
2011
+ if (device.firmware) {
2012
+ existingAccessory.context.version = device.firmware;
2014
2013
  }
2015
2014
  existingAccessory.context.deviceType = `IR: ${device.remoteType}`;
2016
2015
  this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} DeviceID: ${device.deviceId}`);
@@ -2037,8 +2036,8 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
2037
2036
  accessory.context.device = device;
2038
2037
  accessory.context.model = device.remoteType;
2039
2038
  accessory.context.deviceID = device.deviceId;
2040
- if (device.version && !device.firmware) {
2041
- accessory.context.version = device.version.toString();
2039
+ if (device.firmware) {
2040
+ accessory.context.version = device.firmware;
2042
2041
  }
2043
2042
  accessory.context.deviceType = `IR: ${device.remoteType}`;
2044
2043
  accessory.context.connectionType = device.connectionType;
@@ -2069,8 +2068,8 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
2069
2068
  existingAccessory.context.model = device.remoteType;
2070
2069
  existingAccessory.context.deviceID = device.deviceId;
2071
2070
  existingAccessory.displayName = device.configDeviceName || device.deviceName;
2072
- if (device.version && !device.firmware) {
2073
- existingAccessory.context.version = device.version.toString();
2071
+ if (device.firmware) {
2072
+ existingAccessory.context.version = device.firmware;
2074
2073
  }
2075
2074
  existingAccessory.context.deviceType = `IR: ${device.remoteType}`;
2076
2075
  this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} DeviceID: ${device.deviceId}`);
@@ -2097,8 +2096,8 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
2097
2096
  accessory.context.device = device;
2098
2097
  accessory.context.model = device.remoteType;
2099
2098
  accessory.context.deviceID = device.deviceId;
2100
- if (device.version && !device.firmware) {
2101
- accessory.context.version = device.version.toString();
2099
+ if (device.firmware) {
2100
+ accessory.context.version = device.firmware;
2102
2101
  }
2103
2102
  accessory.context.deviceType = `IR: ${device.remoteType}`;
2104
2103
  accessory.context.connectionType = device.connectionType;
@@ -2129,8 +2128,8 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
2129
2128
  existingAccessory.context.model = device.remoteType;
2130
2129
  existingAccessory.context.deviceID = device.deviceId;
2131
2130
  existingAccessory.displayName = device.configDeviceName || device.deviceName;
2132
- if (device.version && !device.firmware) {
2133
- existingAccessory.context.version = device.version.toString();
2131
+ if (device.firmware) {
2132
+ existingAccessory.context.version = device.firmware;
2134
2133
  }
2135
2134
  existingAccessory.context.deviceType = `IR: ${device.remoteType}`;
2136
2135
  this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} DeviceID: ${device.deviceId}`);
@@ -2157,8 +2156,8 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
2157
2156
  accessory.context.device = device;
2158
2157
  accessory.context.model = device.remoteType;
2159
2158
  accessory.context.deviceID = device.deviceId;
2160
- if (device.version && !device.firmware) {
2161
- accessory.context.version = device.version.toString();
2159
+ if (device.firmware) {
2160
+ accessory.context.version = device.firmware;
2162
2161
  }
2163
2162
  accessory.context.deviceType = `IR: ${device.remoteType}`;
2164
2163
  accessory.context.connectionType = device.connectionType;
@@ -2189,8 +2188,8 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
2189
2188
  existingAccessory.context.model = device.remoteType;
2190
2189
  existingAccessory.context.deviceID = device.deviceId;
2191
2190
  existingAccessory.displayName = device.configDeviceName || device.deviceName;
2192
- if (device.version && !device.firmware) {
2193
- existingAccessory.context.version = device.version.toString();
2191
+ if (device.firmware) {
2192
+ existingAccessory.context.version = device.firmware;
2194
2193
  }
2195
2194
  existingAccessory.context.deviceType = `IR: ${device.remoteType}`;
2196
2195
  this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} DeviceID: ${device.deviceId}`);
@@ -2217,8 +2216,8 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
2217
2216
  accessory.context.device = device;
2218
2217
  accessory.context.model = device.remoteType;
2219
2218
  accessory.context.deviceID = device.deviceId;
2220
- if (device.version && !device.firmware) {
2221
- accessory.context.version = device.version.toString();
2219
+ if (device.firmware) {
2220
+ accessory.context.version = device.firmware;
2222
2221
  }
2223
2222
  accessory.context.deviceType = `IR: ${device.remoteType}`;
2224
2223
  accessory.context.connectionType = device.connectionType;
@@ -2249,8 +2248,8 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
2249
2248
  existingAccessory.context.model = device.remoteType;
2250
2249
  existingAccessory.context.deviceID = device.deviceId;
2251
2250
  existingAccessory.displayName = device.configDeviceName || device.deviceName;
2252
- if (device.version && !device.firmware) {
2253
- existingAccessory.context.version = device.version.toString();
2251
+ if (device.firmware) {
2252
+ existingAccessory.context.version = device.firmware;
2254
2253
  }
2255
2254
  existingAccessory.context.deviceType = `IR: ${device.remoteType}`;
2256
2255
  this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} DeviceID: ${device.deviceId}`);
@@ -2277,8 +2276,8 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
2277
2276
  accessory.context.device = device;
2278
2277
  accessory.context.model = device.remoteType;
2279
2278
  accessory.context.deviceID = device.deviceId;
2280
- if (device.version && !device.firmware) {
2281
- accessory.context.version = device.version.toString();
2279
+ if (device.firmware) {
2280
+ accessory.context.version = device.firmware;
2282
2281
  }
2283
2282
  accessory.context.deviceType = `IR: ${device.remoteType}`;
2284
2283
  accessory.context.connectionType = device.connectionType;
@@ -2309,8 +2308,8 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
2309
2308
  existingAccessory.context.model = device.remoteType;
2310
2309
  existingAccessory.context.deviceID = device.deviceId;
2311
2310
  existingAccessory.displayName = device.configDeviceName || device.deviceName;
2312
- if (device.version && !device.firmware) {
2313
- existingAccessory.context.version = device.version.toString();
2311
+ if (device.firmware) {
2312
+ existingAccessory.context.version = device.firmware;
2314
2313
  }
2315
2314
  existingAccessory.context.deviceType = `IR: ${device.remoteType}`;
2316
2315
  this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} DeviceID: ${device.deviceId}`);
@@ -2337,8 +2336,8 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
2337
2336
  accessory.context.device = device;
2338
2337
  accessory.context.model = device.remoteType;
2339
2338
  accessory.context.deviceID = device.deviceId;
2340
- if (device.version && !device.firmware) {
2341
- accessory.context.version = device.version.toString();
2339
+ if (device.firmware) {
2340
+ accessory.context.version = device.firmware;
2342
2341
  }
2343
2342
  accessory.context.deviceType = `IR: ${device.remoteType}`;
2344
2343
  accessory.context.connectionType = device.connectionType;
@@ -2369,8 +2368,8 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
2369
2368
  existingAccessory.context.model = device.remoteType;
2370
2369
  existingAccessory.context.deviceID = device.deviceId;
2371
2370
  existingAccessory.displayName = device.configDeviceName || device.deviceName;
2372
- if (device.version && !device.firmware) {
2373
- existingAccessory.context.version = device.version.toString();
2371
+ if (device.firmware) {
2372
+ existingAccessory.context.version = device.firmware;
2374
2373
  }
2375
2374
  existingAccessory.context.deviceType = `IR: ${device.remoteType}`;
2376
2375
  this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} DeviceID: ${device.deviceId}`);
@@ -2397,8 +2396,8 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
2397
2396
  accessory.context.device = device;
2398
2397
  accessory.context.model = device.remoteType;
2399
2398
  accessory.context.deviceID = device.deviceId;
2400
- if (device.version && !device.firmware) {
2401
- accessory.context.version = device.version.toString();
2399
+ if (device.firmware) {
2400
+ accessory.context.version = device.firmware;
2402
2401
  }
2403
2402
  accessory.context.deviceType = `IR: ${device.remoteType}`;
2404
2403
  accessory.context.connectionType = device.connectionType;
@@ -2429,8 +2428,8 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
2429
2428
  existingAccessory.context.model = device.remoteType;
2430
2429
  existingAccessory.context.deviceID = device.deviceId;
2431
2430
  existingAccessory.displayName = device.configDeviceName || device.deviceName;
2432
- if (device.version && !device.firmware) {
2433
- existingAccessory.context.version = device.version.toString();
2431
+ if (device.firmware) {
2432
+ existingAccessory.context.version = device.firmware;
2434
2433
  }
2435
2434
  existingAccessory.context.deviceType = `IR: ${device.remoteType}`;
2436
2435
  this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} DeviceID: ${device.deviceId}`);
@@ -2457,8 +2456,8 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
2457
2456
  accessory.context.device = device;
2458
2457
  accessory.context.model = device.remoteType;
2459
2458
  accessory.context.deviceID = device.deviceId;
2460
- if (device.version && !device.firmware) {
2461
- accessory.context.version = device.version.toString();
2459
+ if (device.firmware) {
2460
+ accessory.context.version = device.firmware;
2462
2461
  }
2463
2462
  accessory.context.deviceType = `IR: ${device.remoteType}`;
2464
2463
  accessory.context.connectionType = device.connectionType;