@switchbot/homebridge-switchbot 3.5.0-beta.34 → 3.5.0-beta.36

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,7 +845,9 @@ 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
- existingAccessory.context.FirmwareRevision = device.version;
848
+ if (device.version && !device.firmware) {
849
+ existingAccessory.context.FirmwareRevision = device.version;
850
+ }
849
851
  existingAccessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
850
852
  this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} DeviceID: ${device.deviceId}`);
851
853
  existingAccessory.context.connectionType = await this.connectionType(device);
@@ -871,7 +873,9 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
871
873
  accessory.context.device = device;
872
874
  accessory.context.model = device.deviceType;
873
875
  accessory.context.deviceID = device.deviceId;
874
- accessory.context.FirmwareRevision = device.version;
876
+ if (device.version && !device.firmware) {
877
+ accessory.context.FirmwareRevision = device.version;
878
+ }
875
879
  accessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
876
880
  accessory.context.connectionType = await this.connectionType(device);
877
881
  // create the accessory handler for the newly create accessory
@@ -901,7 +905,9 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
901
905
  existingAccessory.context.model = device.deviceType;
902
906
  existingAccessory.context.deviceID = device.deviceId;
903
907
  existingAccessory.displayName = device.configDeviceName || device.deviceName;
904
- existingAccessory.context.FirmwareRevision = device.version;
908
+ if (device.version && !device.firmware) {
909
+ existingAccessory.context.FirmwareRevision = device.version;
910
+ }
905
911
  existingAccessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
906
912
  this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} DeviceID: ${device.deviceId}`);
907
913
  existingAccessory.context.connectionType = await this.connectionType(device);
@@ -927,7 +933,9 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
927
933
  accessory.context.device = device;
928
934
  accessory.context.model = device.deviceType;
929
935
  accessory.context.deviceID = device.deviceId;
930
- accessory.context.FirmwareRevision = device.version;
936
+ if (device.version && !device.firmware) {
937
+ accessory.context.FirmwareRevision = device.version;
938
+ }
931
939
  accessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
932
940
  accessory.context.connectionType = await this.connectionType(device);
933
941
  // accessory.context.FirmwareRevision = findaccessories.accessoryAttribute.softwareRevision;
@@ -958,7 +966,9 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
958
966
  existingAccessory.context.model = device.deviceType;
959
967
  existingAccessory.context.deviceID = device.deviceId;
960
968
  existingAccessory.displayName = device.configDeviceName || device.deviceName;
961
- existingAccessory.context.FirmwareRevision = device.version;
969
+ if (device.version && !device.firmware) {
970
+ existingAccessory.context.FirmwareRevision = device.version;
971
+ }
962
972
  existingAccessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
963
973
  this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} DeviceID: ${device.deviceId}`);
964
974
  existingAccessory.context.connectionType = await this.connectionType(device);
@@ -984,7 +994,9 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
984
994
  accessory.context.device = device;
985
995
  accessory.context.model = device.deviceType;
986
996
  accessory.context.deviceID = device.deviceId;
987
- accessory.context.FirmwareRevision = device.version;
997
+ if (device.version && !device.firmware) {
998
+ accessory.context.FirmwareRevision = device.version;
999
+ }
988
1000
  accessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
989
1001
  accessory.context.connectionType = await this.connectionType(device);
990
1002
  // create the accessory handler for the newly create accessory
@@ -1015,7 +1027,9 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
1015
1027
  existingAccessory.context.model = device.deviceType;
1016
1028
  existingAccessory.context.deviceID = device.deviceId;
1017
1029
  existingAccessory.displayName = device.configDeviceName || device.deviceName;
1018
- existingAccessory.context.FirmwareRevision = device.version;
1030
+ if (device.version && !device.firmware) {
1031
+ existingAccessory.context.FirmwareRevision = device.version;
1032
+ }
1019
1033
  existingAccessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
1020
1034
  this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} DeviceID: ${device.deviceId}`);
1021
1035
  existingAccessory.context.connectionType = await this.connectionType(device);
@@ -1041,7 +1055,9 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
1041
1055
  accessory.context.device = device;
1042
1056
  accessory.context.model = device.deviceType;
1043
1057
  accessory.context.deviceID = device.deviceId;
1044
- accessory.context.FirmwareRevision = device.version;
1058
+ if (device.version && !device.firmware) {
1059
+ accessory.context.FirmwareRevision = device.version;
1060
+ }
1045
1061
  accessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
1046
1062
  accessory.context.connectionType = await this.connectionType(device);
1047
1063
  // create the accessory handler for the newly create accessory
@@ -1072,7 +1088,9 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
1072
1088
  existingAccessory.context.model = device.deviceType;
1073
1089
  existingAccessory.context.deviceID = device.deviceId;
1074
1090
  existingAccessory.displayName = device.configDeviceName || device.deviceName;
1075
- existingAccessory.context.FirmwareRevision = device.version;
1091
+ if (device.version && !device.firmware) {
1092
+ existingAccessory.context.FirmwareRevision = device.version;
1093
+ }
1076
1094
  existingAccessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
1077
1095
  this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} DeviceID: ${device.deviceId}`);
1078
1096
  existingAccessory.context.connectionType = await this.connectionType(device);
@@ -1098,7 +1116,9 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
1098
1116
  accessory.context.device = device;
1099
1117
  accessory.context.model = device.deviceType;
1100
1118
  accessory.context.deviceID = device.deviceId;
1101
- accessory.context.FirmwareRevision = device.version;
1119
+ if (device.version && !device.firmware) {
1120
+ accessory.context.FirmwareRevision = device.version;
1121
+ }
1102
1122
  accessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
1103
1123
  accessory.context.connectionType = await this.connectionType(device);
1104
1124
  // create the accessory handler for the newly create accessory
@@ -1128,7 +1148,9 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
1128
1148
  existingAccessory.context.model = device.deviceType;
1129
1149
  existingAccessory.context.deviceID = device.deviceId;
1130
1150
  existingAccessory.displayName = device.configDeviceName || device.deviceName;
1131
- existingAccessory.context.FirmwareRevision = device.version;
1151
+ if (device.version && !device.firmware) {
1152
+ existingAccessory.context.FirmwareRevision = device.version;
1153
+ }
1132
1154
  existingAccessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
1133
1155
  this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} DeviceID: ${device.deviceId}`);
1134
1156
  existingAccessory.context.connectionType = await this.connectionType(device);
@@ -1154,7 +1176,9 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
1154
1176
  accessory.context.device = device;
1155
1177
  accessory.context.model = device.deviceType;
1156
1178
  accessory.context.deviceID = device.deviceId;
1157
- accessory.context.FirmwareRevision = device.version;
1179
+ if (device.version && !device.firmware) {
1180
+ accessory.context.FirmwareRevision = device.version;
1181
+ }
1158
1182
  accessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
1159
1183
  accessory.context.connectionType = await this.connectionType(device);
1160
1184
  // create the accessory handler for the newly create accessory
@@ -1184,7 +1208,9 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
1184
1208
  existingAccessory.context.model = device.deviceType;
1185
1209
  existingAccessory.context.deviceID = device.deviceId;
1186
1210
  existingAccessory.displayName = device.configDeviceName || device.deviceName;
1187
- existingAccessory.context.FirmwareRevision = device.version;
1211
+ if (device.version && !device.firmware) {
1212
+ existingAccessory.context.FirmwareRevision = device.version;
1213
+ }
1188
1214
  existingAccessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
1189
1215
  this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} DeviceID: ${device.deviceId}`);
1190
1216
  existingAccessory.context.connectionType = await this.connectionType(device);
@@ -1210,7 +1236,9 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
1210
1236
  accessory.context.device = device;
1211
1237
  accessory.context.model = device.deviceType;
1212
1238
  accessory.context.deviceID = device.deviceId;
1213
- accessory.context.FirmwareRevision = device.version;
1239
+ if (device.version && !device.firmware) {
1240
+ accessory.context.FirmwareRevision = device.version;
1241
+ }
1214
1242
  accessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
1215
1243
  accessory.context.connectionType = await this.connectionType(device);
1216
1244
  // create the accessory handler for the newly create accessory
@@ -1240,7 +1268,9 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
1240
1268
  existingAccessory.context.model = device.deviceType;
1241
1269
  existingAccessory.context.deviceID = device.deviceId;
1242
1270
  existingAccessory.displayName = device.configDeviceName || device.deviceName;
1243
- existingAccessory.context.FirmwareRevision = device.version;
1271
+ if (device.version && !device.firmware) {
1272
+ existingAccessory.context.FirmwareRevision = device.version;
1273
+ }
1244
1274
  existingAccessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
1245
1275
  this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} DeviceID: ${device.deviceId}`);
1246
1276
  existingAccessory.context.connectionType = await this.connectionType(device);
@@ -1266,7 +1296,9 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
1266
1296
  accessory.context.device = device;
1267
1297
  accessory.context.model = device.deviceType;
1268
1298
  accessory.context.deviceID = device.deviceId;
1269
- accessory.context.FirmwareRevision = device.version;
1299
+ if (device.version && !device.firmware) {
1300
+ accessory.context.FirmwareRevision = device.version;
1301
+ }
1270
1302
  accessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
1271
1303
  accessory.context.connectionType = await this.connectionType(device);
1272
1304
  // create the accessory handler for the newly create accessory
@@ -1296,7 +1328,9 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
1296
1328
  existingAccessory.context.model = device.deviceType;
1297
1329
  existingAccessory.context.deviceID = device.deviceId;
1298
1330
  existingAccessory.displayName = device.configDeviceName || device.deviceName;
1299
- existingAccessory.context.FirmwareRevision = device.version;
1331
+ if (device.version && !device.firmware) {
1332
+ existingAccessory.context.FirmwareRevision = device.version;
1333
+ }
1300
1334
  existingAccessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
1301
1335
  this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} DeviceID: ${device.deviceId}`);
1302
1336
  existingAccessory.context.connectionType = await this.connectionType(device);
@@ -1322,7 +1356,9 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
1322
1356
  accessory.context.device = device;
1323
1357
  accessory.context.model = device.deviceType;
1324
1358
  accessory.context.deviceID = device.deviceId;
1325
- accessory.context.FirmwareRevision = device.version;
1359
+ if (device.version && !device.firmware) {
1360
+ accessory.context.FirmwareRevision = device.version;
1361
+ }
1326
1362
  accessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
1327
1363
  accessory.context.connectionType = await this.connectionType(device);
1328
1364
  // create the accessory handler for the newly create accessory
@@ -1352,7 +1388,9 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
1352
1388
  existingAccessory.context.model = device.deviceType;
1353
1389
  existingAccessory.context.deviceID = device.deviceId;
1354
1390
  existingAccessory.displayName = device.configDeviceName || device.deviceName;
1355
- existingAccessory.context.FirmwareRevision = device.version;
1391
+ if (device.version && !device.firmware) {
1392
+ existingAccessory.context.FirmwareRevision = device.version;
1393
+ }
1356
1394
  existingAccessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
1357
1395
  this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} DeviceID: ${device.deviceId}`);
1358
1396
  existingAccessory.context.connectionType = await this.connectionType(device);
@@ -1391,7 +1429,9 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
1391
1429
  accessory.context.device = device;
1392
1430
  accessory.context.model = device.deviceType;
1393
1431
  accessory.context.deviceID = device.deviceId;
1394
- accessory.context.FirmwareRevision = device.version;
1432
+ if (device.version && !device.firmware) {
1433
+ accessory.context.FirmwareRevision = device.version;
1434
+ }
1395
1435
  accessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
1396
1436
  accessory.context.connectionType = await this.connectionType(device);
1397
1437
  // create the accessory handler for the newly create accessory
@@ -1421,7 +1461,9 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
1421
1461
  existingAccessory.context.model = device.deviceType;
1422
1462
  existingAccessory.context.deviceID = device.deviceId;
1423
1463
  existingAccessory.displayName = device.configDeviceName || device.deviceName;
1424
- existingAccessory.context.FirmwareRevision = device.version;
1464
+ if (device.version && !device.firmware) {
1465
+ existingAccessory.context.FirmwareRevision = device.version;
1466
+ }
1425
1467
  existingAccessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
1426
1468
  this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} DeviceID: ${device.deviceId}`);
1427
1469
  existingAccessory.context.connectionType = await this.connectionType(device);
@@ -1460,7 +1502,9 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
1460
1502
  accessory.context.device = device;
1461
1503
  accessory.context.model = device.deviceType;
1462
1504
  accessory.context.deviceID = device.deviceId;
1463
- accessory.context.FirmwareRevision = device.version;
1505
+ if (device.version && !device.firmware) {
1506
+ accessory.context.FirmwareRevision = device.version;
1507
+ }
1464
1508
  accessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
1465
1509
  accessory.context.connectionType = await this.connectionType(device);
1466
1510
  // create the accessory handler for the newly create accessory
@@ -1490,7 +1534,9 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
1490
1534
  existingAccessory.context.model = device.deviceType;
1491
1535
  existingAccessory.context.deviceID = device.deviceId;
1492
1536
  existingAccessory.displayName = device.configDeviceName || device.deviceName;
1493
- existingAccessory.context.FirmwareRevision = device.version;
1537
+ if (device.version && !device.firmware) {
1538
+ existingAccessory.context.FirmwareRevision = device.version;
1539
+ }
1494
1540
  existingAccessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
1495
1541
  this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} DeviceID: ${device.deviceId}`);
1496
1542
  existingAccessory.context.connectionType = await this.connectionType(device);
@@ -1516,7 +1562,9 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
1516
1562
  accessory.context.device = device;
1517
1563
  accessory.context.model = device.deviceType;
1518
1564
  accessory.context.deviceID = device.deviceId;
1519
- accessory.context.FirmwareRevision = device.version;
1565
+ if (device.version && !device.firmware) {
1566
+ accessory.context.FirmwareRevision = device.version;
1567
+ }
1520
1568
  accessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
1521
1569
  accessory.context.connectionType = await this.connectionType(device);
1522
1570
  // create the accessory handler for the newly create accessory
@@ -1546,7 +1594,9 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
1546
1594
  existingAccessory.context.model = device.deviceType;
1547
1595
  existingAccessory.context.deviceID = device.deviceId;
1548
1596
  existingAccessory.displayName = device.configDeviceName || device.deviceName;
1549
- existingAccessory.context.FirmwareRevision = device.version;
1597
+ if (device.version && !device.firmware) {
1598
+ existingAccessory.context.FirmwareRevision = device.version;
1599
+ }
1550
1600
  existingAccessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
1551
1601
  this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} DeviceID: ${device.deviceId}`);
1552
1602
  existingAccessory.context.connectionType = await this.connectionType(device);
@@ -1572,7 +1622,9 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
1572
1622
  accessory.context.device = device;
1573
1623
  accessory.context.model = device.deviceType;
1574
1624
  accessory.context.deviceID = device.deviceId;
1575
- accessory.context.FirmwareRevision = device.version;
1625
+ if (device.version && !device.firmware) {
1626
+ accessory.context.FirmwareRevision = device.version;
1627
+ }
1576
1628
  accessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
1577
1629
  accessory.context.connectionType = await this.connectionType(device);
1578
1630
  // create the accessory handler for the newly create accessory
@@ -1602,7 +1654,9 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
1602
1654
  existingAccessory.context.model = device.deviceType;
1603
1655
  existingAccessory.context.deviceID = device.deviceId;
1604
1656
  existingAccessory.displayName = device.configDeviceName || device.deviceName;
1605
- existingAccessory.context.FirmwareRevision = device.version;
1657
+ if (device.version && !device.firmware) {
1658
+ existingAccessory.context.FirmwareRevision = device.version;
1659
+ }
1606
1660
  existingAccessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
1607
1661
  this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} DeviceID: ${device.deviceId}`);
1608
1662
  existingAccessory.context.connectionType = await this.connectionType(device);
@@ -1628,7 +1682,9 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
1628
1682
  accessory.context.device = device;
1629
1683
  accessory.context.model = device.deviceType;
1630
1684
  accessory.context.deviceID = device.deviceId;
1631
- accessory.context.FirmwareRevision = device.version;
1685
+ if (device.version && !device.firmware) {
1686
+ accessory.context.FirmwareRevision = device.version;
1687
+ }
1632
1688
  accessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
1633
1689
  accessory.context.connectionType = await this.connectionType(device);
1634
1690
  // create the accessory handler for the newly create accessory
@@ -1658,7 +1714,9 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
1658
1714
  existingAccessory.context.model = device.deviceType;
1659
1715
  existingAccessory.context.deviceID = device.deviceId;
1660
1716
  existingAccessory.displayName = device.configDeviceName || device.deviceName;
1661
- existingAccessory.context.FirmwareRevision = device.version;
1717
+ if (device.version && !device.firmware) {
1718
+ existingAccessory.context.FirmwareRevision = device.version;
1719
+ }
1662
1720
  existingAccessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
1663
1721
  this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} DeviceID: ${device.deviceId}`);
1664
1722
  existingAccessory.context.connectionType = await this.connectionType(device);
@@ -1684,7 +1742,9 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
1684
1742
  accessory.context.device = device;
1685
1743
  accessory.context.model = device.deviceType;
1686
1744
  accessory.context.deviceID = device.deviceId;
1687
- accessory.context.FirmwareRevision = device.version;
1745
+ if (device.version && !device.firmware) {
1746
+ accessory.context.FirmwareRevision = device.version;
1747
+ }
1688
1748
  accessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
1689
1749
  accessory.context.connectionType = await this.connectionType(device);
1690
1750
  // create the accessory handler for the newly create accessory
@@ -1714,7 +1774,9 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
1714
1774
  existingAccessory.context.model = device.deviceType;
1715
1775
  existingAccessory.context.deviceID = device.deviceId;
1716
1776
  existingAccessory.displayName = device.configDeviceName || device.deviceName;
1717
- existingAccessory.context.FirmwareRevision = device.version;
1777
+ if (device.version && !device.firmware) {
1778
+ existingAccessory.context.FirmwareRevision = device.version;
1779
+ }
1718
1780
  existingAccessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
1719
1781
  this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} DeviceID: ${device.deviceId}`);
1720
1782
  existingAccessory.context.connectionType = await this.connectionType(device);
@@ -1740,7 +1802,9 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
1740
1802
  accessory.context.device = device;
1741
1803
  accessory.context.model = device.deviceType;
1742
1804
  accessory.context.deviceID = device.deviceId;
1743
- accessory.context.FirmwareRevision = device.version;
1805
+ if (device.version && !device.firmware) {
1806
+ accessory.context.FirmwareRevision = device.version;
1807
+ }
1744
1808
  accessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
1745
1809
  accessory.context.connectionType = await this.connectionType(device);
1746
1810
  // create the accessory handler for the newly create accessory
@@ -1770,7 +1834,9 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
1770
1834
  existingAccessory.context.model = device.deviceType;
1771
1835
  existingAccessory.context.deviceID = device.deviceId;
1772
1836
  existingAccessory.displayName = device.configDeviceName || device.deviceName;
1773
- existingAccessory.context.FirmwareRevision = device.version;
1837
+ if (device.version && !device.firmware) {
1838
+ existingAccessory.context.FirmwareRevision = device.version;
1839
+ }
1774
1840
  existingAccessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
1775
1841
  this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} DeviceID: ${device.deviceId}`);
1776
1842
  existingAccessory.context.connectionType = await this.connectionType(device);
@@ -1796,7 +1862,9 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
1796
1862
  accessory.context.device = device;
1797
1863
  accessory.context.model = device.deviceType;
1798
1864
  accessory.context.deviceID = device.deviceId;
1799
- accessory.context.FirmwareRevision = device.version;
1865
+ if (device.version && !device.firmware) {
1866
+ accessory.context.FirmwareRevision = device.version;
1867
+ }
1800
1868
  accessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
1801
1869
  accessory.context.connectionType = await this.connectionType(device);
1802
1870
  // create the accessory handler for the newly create accessory
@@ -1826,7 +1894,9 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
1826
1894
  existingAccessory.context.model = device.deviceType;
1827
1895
  existingAccessory.context.deviceID = device.deviceId;
1828
1896
  existingAccessory.displayName = device.configDeviceName || device.deviceName;
1829
- existingAccessory.context.FirmwareRevision = device.version;
1897
+ if (device.version && !device.firmware) {
1898
+ existingAccessory.context.FirmwareRevision = device.version;
1899
+ }
1830
1900
  existingAccessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
1831
1901
  this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} DeviceID: ${device.deviceId}`);
1832
1902
  existingAccessory.context.connectionType = await this.connectionType(device);
@@ -1852,7 +1922,9 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
1852
1922
  accessory.context.device = device;
1853
1923
  accessory.context.model = device.deviceType;
1854
1924
  accessory.context.deviceID = device.deviceId;
1855
- accessory.context.FirmwareRevision = device.version;
1925
+ if (device.version && !device.firmware) {
1926
+ accessory.context.FirmwareRevision = device.version;
1927
+ }
1856
1928
  accessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
1857
1929
  accessory.context.connectionType = await this.connectionType(device);
1858
1930
  // create the accessory handler for the newly create accessory
@@ -1880,7 +1952,9 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
1880
1952
  existingAccessory.context.model = device.remoteType;
1881
1953
  existingAccessory.context.deviceID = device.deviceId;
1882
1954
  existingAccessory.displayName = device.configDeviceName || device.deviceName;
1883
- existingAccessory.context.FirmwareRevision = device.version;
1955
+ if (device.version && !device.firmware) {
1956
+ existingAccessory.context.FirmwareRevision = device.version;
1957
+ }
1884
1958
  existingAccessory.context.deviceType = `IR: ${device.remoteType}`;
1885
1959
  this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} DeviceID: ${device.deviceId}`);
1886
1960
  existingAccessory.context.connectionType = device.connectionType;
@@ -1903,7 +1977,9 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
1903
1977
  accessory.context.device = device;
1904
1978
  accessory.context.model = device.remoteType;
1905
1979
  accessory.context.deviceID = device.deviceId;
1906
- accessory.context.FirmwareRevision = device.version;
1980
+ if (device.version && !device.firmware) {
1981
+ accessory.context.FirmwareRevision = device.version;
1982
+ }
1907
1983
  accessory.context.deviceType = `IR: ${device.remoteType}`;
1908
1984
  accessory.context.connectionType = device.connectionType;
1909
1985
  // create the accessory handler for the newly create accessory
@@ -1932,7 +2008,9 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
1932
2008
  existingAccessory.context.model = device.remoteType;
1933
2009
  existingAccessory.context.deviceID = device.deviceId;
1934
2010
  existingAccessory.displayName = device.configDeviceName || device.deviceName;
1935
- existingAccessory.context.FirmwareRevision = device.version;
2011
+ if (device.version && !device.firmware) {
2012
+ existingAccessory.context.FirmwareRevision = device.version;
2013
+ }
1936
2014
  existingAccessory.context.deviceType = `IR: ${device.remoteType}`;
1937
2015
  this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} DeviceID: ${device.deviceId}`);
1938
2016
  existingAccessory.context.connectionType = device.connectionType;
@@ -1958,7 +2036,9 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
1958
2036
  accessory.context.device = device;
1959
2037
  accessory.context.model = device.remoteType;
1960
2038
  accessory.context.deviceID = device.deviceId;
1961
- accessory.context.FirmwareRevision = device.version;
2039
+ if (device.version && !device.firmware) {
2040
+ accessory.context.FirmwareRevision = device.version;
2041
+ }
1962
2042
  accessory.context.deviceType = `IR: ${device.remoteType}`;
1963
2043
  accessory.context.connectionType = device.connectionType;
1964
2044
  // create the accessory handler for the newly create accessory
@@ -1988,7 +2068,9 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
1988
2068
  existingAccessory.context.model = device.remoteType;
1989
2069
  existingAccessory.context.deviceID = device.deviceId;
1990
2070
  existingAccessory.displayName = device.configDeviceName || device.deviceName;
1991
- existingAccessory.context.FirmwareRevision = device.version;
2071
+ if (device.version && !device.firmware) {
2072
+ existingAccessory.context.FirmwareRevision = device.version;
2073
+ }
1992
2074
  existingAccessory.context.deviceType = `IR: ${device.remoteType}`;
1993
2075
  this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} DeviceID: ${device.deviceId}`);
1994
2076
  existingAccessory.context.connectionType = device.connectionType;
@@ -2014,7 +2096,9 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
2014
2096
  accessory.context.device = device;
2015
2097
  accessory.context.model = device.remoteType;
2016
2098
  accessory.context.deviceID = device.deviceId;
2017
- accessory.context.FirmwareRevision = device.version;
2099
+ if (device.version && !device.firmware) {
2100
+ accessory.context.FirmwareRevision = device.version;
2101
+ }
2018
2102
  accessory.context.deviceType = `IR: ${device.remoteType}`;
2019
2103
  accessory.context.connectionType = device.connectionType;
2020
2104
  // create the accessory handler for the newly create accessory
@@ -2044,7 +2128,9 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
2044
2128
  existingAccessory.context.model = device.remoteType;
2045
2129
  existingAccessory.context.deviceID = device.deviceId;
2046
2130
  existingAccessory.displayName = device.configDeviceName || device.deviceName;
2047
- existingAccessory.context.FirmwareRevision = device.version;
2131
+ if (device.version && !device.firmware) {
2132
+ existingAccessory.context.FirmwareRevision = device.version;
2133
+ }
2048
2134
  existingAccessory.context.deviceType = `IR: ${device.remoteType}`;
2049
2135
  this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} DeviceID: ${device.deviceId}`);
2050
2136
  existingAccessory.context.connectionType = device.connectionType;
@@ -2070,7 +2156,9 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
2070
2156
  accessory.context.device = device;
2071
2157
  accessory.context.model = device.remoteType;
2072
2158
  accessory.context.deviceID = device.deviceId;
2073
- accessory.context.FirmwareRevision = device.version;
2159
+ if (device.version && !device.firmware) {
2160
+ accessory.context.FirmwareRevision = device.version;
2161
+ }
2074
2162
  accessory.context.deviceType = `IR: ${device.remoteType}`;
2075
2163
  accessory.context.connectionType = device.connectionType;
2076
2164
  // create the accessory handler for the newly create accessory
@@ -2100,7 +2188,9 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
2100
2188
  existingAccessory.context.model = device.remoteType;
2101
2189
  existingAccessory.context.deviceID = device.deviceId;
2102
2190
  existingAccessory.displayName = device.configDeviceName || device.deviceName;
2103
- existingAccessory.context.FirmwareRevision = device.version;
2191
+ if (device.version && !device.firmware) {
2192
+ existingAccessory.context.FirmwareRevision = device.version;
2193
+ }
2104
2194
  existingAccessory.context.deviceType = `IR: ${device.remoteType}`;
2105
2195
  this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} DeviceID: ${device.deviceId}`);
2106
2196
  existingAccessory.context.connectionType = device.connectionType;
@@ -2126,7 +2216,9 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
2126
2216
  accessory.context.device = device;
2127
2217
  accessory.context.model = device.remoteType;
2128
2218
  accessory.context.deviceID = device.deviceId;
2129
- accessory.context.FirmwareRevision = device.version;
2219
+ if (device.version && !device.firmware) {
2220
+ accessory.context.FirmwareRevision = device.version;
2221
+ }
2130
2222
  accessory.context.deviceType = `IR: ${device.remoteType}`;
2131
2223
  accessory.context.connectionType = device.connectionType;
2132
2224
  // create the accessory handler for the newly create accessory
@@ -2156,7 +2248,9 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
2156
2248
  existingAccessory.context.model = device.remoteType;
2157
2249
  existingAccessory.context.deviceID = device.deviceId;
2158
2250
  existingAccessory.displayName = device.configDeviceName || device.deviceName;
2159
- existingAccessory.context.FirmwareRevision = device.version;
2251
+ if (device.version && !device.firmware) {
2252
+ existingAccessory.context.FirmwareRevision = device.version;
2253
+ }
2160
2254
  existingAccessory.context.deviceType = `IR: ${device.remoteType}`;
2161
2255
  this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} DeviceID: ${device.deviceId}`);
2162
2256
  existingAccessory.context.connectionType = device.connectionType;
@@ -2182,7 +2276,9 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
2182
2276
  accessory.context.device = device;
2183
2277
  accessory.context.model = device.remoteType;
2184
2278
  accessory.context.deviceID = device.deviceId;
2185
- accessory.context.FirmwareRevision = device.version;
2279
+ if (device.version && !device.firmware) {
2280
+ accessory.context.FirmwareRevision = device.version;
2281
+ }
2186
2282
  accessory.context.deviceType = `IR: ${device.remoteType}`;
2187
2283
  accessory.context.connectionType = device.connectionType;
2188
2284
  // create the accessory handler for the newly create accessory
@@ -2212,7 +2308,9 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
2212
2308
  existingAccessory.context.model = device.remoteType;
2213
2309
  existingAccessory.context.deviceID = device.deviceId;
2214
2310
  existingAccessory.displayName = device.configDeviceName || device.deviceName;
2215
- existingAccessory.context.FirmwareRevision = device.version;
2311
+ if (device.version && !device.firmware) {
2312
+ existingAccessory.context.FirmwareRevision = device.version;
2313
+ }
2216
2314
  existingAccessory.context.deviceType = `IR: ${device.remoteType}`;
2217
2315
  this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} DeviceID: ${device.deviceId}`);
2218
2316
  existingAccessory.context.connectionType = device.connectionType;
@@ -2238,7 +2336,9 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
2238
2336
  accessory.context.device = device;
2239
2337
  accessory.context.model = device.remoteType;
2240
2338
  accessory.context.deviceID = device.deviceId;
2241
- accessory.context.FirmwareRevision = device.version;
2339
+ if (device.version && !device.firmware) {
2340
+ accessory.context.FirmwareRevision = device.version;
2341
+ }
2242
2342
  accessory.context.deviceType = `IR: ${device.remoteType}`;
2243
2343
  accessory.context.connectionType = device.connectionType;
2244
2344
  // create the accessory handler for the newly create accessory
@@ -2268,7 +2368,9 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
2268
2368
  existingAccessory.context.model = device.remoteType;
2269
2369
  existingAccessory.context.deviceID = device.deviceId;
2270
2370
  existingAccessory.displayName = device.configDeviceName || device.deviceName;
2271
- existingAccessory.context.FirmwareRevision = device.version;
2371
+ if (device.version && !device.firmware) {
2372
+ existingAccessory.context.FirmwareRevision = device.version;
2373
+ }
2272
2374
  existingAccessory.context.deviceType = `IR: ${device.remoteType}`;
2273
2375
  this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} DeviceID: ${device.deviceId}`);
2274
2376
  existingAccessory.context.connectionType = device.connectionType;
@@ -2294,7 +2396,9 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
2294
2396
  accessory.context.device = device;
2295
2397
  accessory.context.model = device.remoteType;
2296
2398
  accessory.context.deviceID = device.deviceId;
2297
- accessory.context.FirmwareRevision = device.version;
2399
+ if (device.version && !device.firmware) {
2400
+ accessory.context.FirmwareRevision = device.version;
2401
+ }
2298
2402
  accessory.context.deviceType = `IR: ${device.remoteType}`;
2299
2403
  accessory.context.connectionType = device.connectionType;
2300
2404
  // create the accessory handler for the newly create accessory
@@ -2324,7 +2428,9 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
2324
2428
  existingAccessory.context.model = device.remoteType;
2325
2429
  existingAccessory.context.deviceID = device.deviceId;
2326
2430
  existingAccessory.displayName = device.configDeviceName || device.deviceName;
2327
- existingAccessory.context.FirmwareRevision = device.version;
2431
+ if (device.version && !device.firmware) {
2432
+ existingAccessory.context.FirmwareRevision = device.version;
2433
+ }
2328
2434
  existingAccessory.context.deviceType = `IR: ${device.remoteType}`;
2329
2435
  this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} DeviceID: ${device.deviceId}`);
2330
2436
  existingAccessory.context.connectionType = device.connectionType;
@@ -2350,7 +2456,9 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
2350
2456
  accessory.context.device = device;
2351
2457
  accessory.context.model = device.remoteType;
2352
2458
  accessory.context.deviceID = device.deviceId;
2353
- accessory.context.FirmwareRevision = device.version;
2459
+ if (device.version && !device.firmware) {
2460
+ accessory.context.FirmwareRevision = device.version;
2461
+ }
2354
2462
  accessory.context.deviceType = `IR: ${device.remoteType}`;
2355
2463
  accessory.context.connectionType = device.connectionType;
2356
2464
  // create the accessory handler for the newly create accessory