@switchbot/homebridge-switchbot 3.5.0-beta.30 → 3.5.0-beta.32

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