@switchbot/homebridge-switchbot 2.9.1-beta.0 → 2.9.1-beta.2

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
@@ -46,7 +46,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
46
46
  // this is used to track restored cached accessories
47
47
  public readonly accessories: PlatformAccessory[] = [];
48
48
 
49
- version = process.env.npm_package_version || '2.1.1';
49
+ version = process.env.npm_package_version || '2.9.0';
50
50
  debugMode!: boolean;
51
51
  platformLogging?: string;
52
52
 
@@ -604,7 +604,9 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
604
604
  existingAccessory.context.model = device.deviceType;
605
605
  existingAccessory.context.deviceID = device.deviceId;
606
606
  existingAccessory.displayName = device.configDeviceName || device.deviceName;
607
- existingAccessory.context.firmwareRevision = device.firmware;
607
+ if (device.firmware) {
608
+ existingAccessory.context.FirmwareRevision = device.firmware;
609
+ }
608
610
  existingAccessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
609
611
  this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} DeviceID: ${device.deviceId}`);
610
612
  existingAccessory.context.connectionType = await this.connectionType(device);
@@ -630,7 +632,9 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
630
632
  accessory.context.device = device;
631
633
  accessory.context.model = device.deviceType;
632
634
  accessory.context.deviceID = device.deviceId;
633
- accessory.context.firmwareRevision = device.firmware;
635
+ if (device.firmware) {
636
+ accessory.context.FirmwareRevision = device.firmware;
637
+ }
634
638
  accessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
635
639
  accessory.context.connectionType = await this.connectionType(device);
636
640
  // create the accessory handler for the newly create accessory
@@ -660,7 +664,9 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
660
664
  existingAccessory.context.model = device.deviceType;
661
665
  existingAccessory.context.deviceID = device.deviceId;
662
666
  existingAccessory.displayName = device.configDeviceName || device.deviceName;
663
- existingAccessory.context.firmwareRevision = device.firmware;
667
+ if (device.firmware) {
668
+ existingAccessory.context.FirmwareRevision = device.firmware;
669
+ }
664
670
  existingAccessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
665
671
  this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} DeviceID: ${device.deviceId}`);
666
672
  existingAccessory.context.connectionType = await this.connectionType(device);
@@ -686,10 +692,12 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
686
692
  accessory.context.device = device;
687
693
  accessory.context.model = device.deviceType;
688
694
  accessory.context.deviceID = device.deviceId;
689
- accessory.context.firmwareRevision = device.firmware;
695
+ if (device.firmware) {
696
+ accessory.context.FirmwareRevision = device.firmware;
697
+ }
690
698
  accessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
691
699
  accessory.context.connectionType = await this.connectionType(device);
692
- // accessory.context.firmwareRevision = findaccessories.accessoryAttribute.softwareRevision;
700
+ // accessory.context.FirmwareRevision = findaccessories.accessoryAttribute.softwareRevision;
693
701
  // create the accessory handler for the newly create accessory
694
702
  // this is imported from `platformAccessory.ts`
695
703
  new Bot(this, accessory, device);
@@ -717,7 +725,9 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
717
725
  existingAccessory.context.model = device.deviceType;
718
726
  existingAccessory.context.deviceID = device.deviceId;
719
727
  existingAccessory.displayName = device.configDeviceName || device.deviceName;
720
- existingAccessory.context.firmwareRevision = device.firmware;
728
+ if (device.firmware) {
729
+ existingAccessory.context.FirmwareRevision = device.firmware;
730
+ }
721
731
  existingAccessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
722
732
  this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} DeviceID: ${device.deviceId}`);
723
733
  existingAccessory.context.connectionType = await this.connectionType(device);
@@ -743,7 +753,9 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
743
753
  accessory.context.device = device;
744
754
  accessory.context.model = device.deviceType;
745
755
  accessory.context.deviceID = device.deviceId;
746
- accessory.context.firmwareRevision = device.firmware;
756
+ if (device.firmware) {
757
+ accessory.context.FirmwareRevision = device.firmware;
758
+ }
747
759
  accessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
748
760
  accessory.context.connectionType = await this.connectionType(device);
749
761
  // create the accessory handler for the newly create accessory
@@ -774,7 +786,9 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
774
786
  existingAccessory.context.model = device.deviceType;
775
787
  existingAccessory.context.deviceID = device.deviceId;
776
788
  existingAccessory.displayName = device.configDeviceName || device.deviceName;
777
- existingAccessory.context.firmwareRevision = device.firmware;
789
+ if (device.firmware) {
790
+ existingAccessory.context.FirmwareRevision = device.firmware;
791
+ }
778
792
  existingAccessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
779
793
  this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} DeviceID: ${device.deviceId}`);
780
794
  existingAccessory.context.connectionType = await this.connectionType(device);
@@ -800,7 +814,9 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
800
814
  accessory.context.device = device;
801
815
  accessory.context.model = device.deviceType;
802
816
  accessory.context.deviceID = device.deviceId;
803
- accessory.context.firmwareRevision = device.firmware;
817
+ if (device.firmware) {
818
+ accessory.context.FirmwareRevision = device.firmware;
819
+ }
804
820
  accessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
805
821
  accessory.context.connectionType = await this.connectionType(device);
806
822
  // create the accessory handler for the newly create accessory
@@ -831,7 +847,9 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
831
847
  existingAccessory.context.model = device.deviceType;
832
848
  existingAccessory.context.deviceID = device.deviceId;
833
849
  existingAccessory.displayName = device.configDeviceName || device.deviceName;
834
- existingAccessory.context.firmwareRevision = device.firmware;
850
+ if (device.firmware) {
851
+ existingAccessory.context.FirmwareRevision = device.firmware;
852
+ }
835
853
  existingAccessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
836
854
  this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} DeviceID: ${device.deviceId}`);
837
855
  existingAccessory.context.connectionType = await this.connectionType(device);
@@ -857,7 +875,9 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
857
875
  accessory.context.device = device;
858
876
  accessory.context.model = device.deviceType;
859
877
  accessory.context.deviceID = device.deviceId;
860
- accessory.context.firmwareRevision = device.firmware;
878
+ if (device.firmware) {
879
+ accessory.context.FirmwareRevision = device.firmware;
880
+ }
861
881
  accessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
862
882
  accessory.context.connectionType = await this.connectionType(device);
863
883
  // create the accessory handler for the newly create accessory
@@ -887,7 +907,9 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
887
907
  existingAccessory.context.model = device.deviceType;
888
908
  existingAccessory.context.deviceID = device.deviceId;
889
909
  existingAccessory.displayName = device.configDeviceName || device.deviceName;
890
- existingAccessory.context.firmwareRevision = device.firmware;
910
+ if (device.firmware) {
911
+ existingAccessory.context.FirmwareRevision = device.firmware;
912
+ }
891
913
  existingAccessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
892
914
  this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} DeviceID: ${device.deviceId}`);
893
915
  existingAccessory.context.connectionType = await this.connectionType(device);
@@ -913,7 +935,9 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
913
935
  accessory.context.device = device;
914
936
  accessory.context.model = device.deviceType;
915
937
  accessory.context.deviceID = device.deviceId;
916
- accessory.context.firmwareRevision = device.firmware;
938
+ if (device.firmware) {
939
+ accessory.context.FirmwareRevision = device.firmware;
940
+ }
917
941
  accessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
918
942
  accessory.context.connectionType = await this.connectionType(device);
919
943
  // create the accessory handler for the newly create accessory
@@ -943,7 +967,9 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
943
967
  existingAccessory.context.model = device.deviceType;
944
968
  existingAccessory.context.deviceID = device.deviceId;
945
969
  existingAccessory.displayName = device.configDeviceName || device.deviceName;
946
- existingAccessory.context.firmwareRevision = device.firmware;
970
+ if (device.firmware) {
971
+ existingAccessory.context.FirmwareRevision = device.firmware;
972
+ }
947
973
  existingAccessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
948
974
  this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} DeviceID: ${device.deviceId}`);
949
975
  existingAccessory.context.connectionType = await this.connectionType(device);
@@ -969,7 +995,9 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
969
995
  accessory.context.device = device;
970
996
  accessory.context.model = device.deviceType;
971
997
  accessory.context.deviceID = device.deviceId;
972
- accessory.context.firmwareRevision = device.firmware;
998
+ if (device.firmware) {
999
+ accessory.context.FirmwareRevision = device.firmware;
1000
+ }
973
1001
  accessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
974
1002
  accessory.context.connectionType = await this.connectionType(device);
975
1003
  // create the accessory handler for the newly create accessory
@@ -999,7 +1027,9 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
999
1027
  existingAccessory.context.model = device.deviceType;
1000
1028
  existingAccessory.context.deviceID = device.deviceId;
1001
1029
  existingAccessory.displayName = device.configDeviceName || device.deviceName;
1002
- existingAccessory.context.firmwareRevision = device.firmware;
1030
+ if (device.firmware) {
1031
+ existingAccessory.context.FirmwareRevision = device.firmware;
1032
+ }
1003
1033
  existingAccessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
1004
1034
  this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} DeviceID: ${device.deviceId}`);
1005
1035
  existingAccessory.context.connectionType = await this.connectionType(device);
@@ -1025,7 +1055,9 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
1025
1055
  accessory.context.device = device;
1026
1056
  accessory.context.model = device.deviceType;
1027
1057
  accessory.context.deviceID = device.deviceId;
1028
- accessory.context.firmwareRevision = device.firmware;
1058
+ if (device.firmware) {
1059
+ accessory.context.FirmwareRevision = device.firmware;
1060
+ }
1029
1061
  accessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
1030
1062
  accessory.context.connectionType = await this.connectionType(device);
1031
1063
  // create the accessory handler for the newly create accessory
@@ -1055,7 +1087,9 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
1055
1087
  existingAccessory.context.model = device.deviceType;
1056
1088
  existingAccessory.context.deviceID = device.deviceId;
1057
1089
  existingAccessory.displayName = device.configDeviceName || device.deviceName;
1058
- existingAccessory.context.firmwareRevision = device.firmware;
1090
+ if (device.firmware) {
1091
+ existingAccessory.context.FirmwareRevision = device.firmware;
1092
+ }
1059
1093
  existingAccessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
1060
1094
  this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} DeviceID: ${device.deviceId}`);
1061
1095
  existingAccessory.context.connectionType = await this.connectionType(device);
@@ -1094,7 +1128,9 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
1094
1128
  accessory.context.device = device;
1095
1129
  accessory.context.model = device.deviceType;
1096
1130
  accessory.context.deviceID = device.deviceId;
1097
- accessory.context.firmwareRevision = device.firmware;
1131
+ if (device.firmware) {
1132
+ accessory.context.FirmwareRevision = device.firmware;
1133
+ }
1098
1134
  accessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
1099
1135
  accessory.context.connectionType = await this.connectionType(device);
1100
1136
  // create the accessory handler for the newly create accessory
@@ -1124,7 +1160,9 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
1124
1160
  existingAccessory.context.model = device.deviceType;
1125
1161
  existingAccessory.context.deviceID = device.deviceId;
1126
1162
  existingAccessory.displayName = device.configDeviceName || device.deviceName;
1127
- existingAccessory.context.firmwareRevision = device.firmware;
1163
+ if (device.firmware) {
1164
+ existingAccessory.context.FirmwareRevision = device.firmware;
1165
+ }
1128
1166
  existingAccessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
1129
1167
  this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} DeviceID: ${device.deviceId}`);
1130
1168
  existingAccessory.context.connectionType = await this.connectionType(device);
@@ -1163,7 +1201,9 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
1163
1201
  accessory.context.device = device;
1164
1202
  accessory.context.model = device.deviceType;
1165
1203
  accessory.context.deviceID = device.deviceId;
1166
- accessory.context.firmwareRevision = device.firmware;
1204
+ if (device.firmware) {
1205
+ accessory.context.FirmwareRevision = device.firmware;
1206
+ }
1167
1207
  accessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
1168
1208
  accessory.context.connectionType = await this.connectionType(device);
1169
1209
  // create the accessory handler for the newly create accessory
@@ -1193,7 +1233,9 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
1193
1233
  existingAccessory.context.model = device.deviceType;
1194
1234
  existingAccessory.context.deviceID = device.deviceId;
1195
1235
  existingAccessory.displayName = device.configDeviceName || device.deviceName;
1196
- existingAccessory.context.firmwareRevision = device.firmware;
1236
+ if (device.firmware) {
1237
+ existingAccessory.context.FirmwareRevision = device.firmware;
1238
+ }
1197
1239
  existingAccessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
1198
1240
  this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} DeviceID: ${device.deviceId}`);
1199
1241
  existingAccessory.context.connectionType = await this.connectionType(device);
@@ -1219,7 +1261,9 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
1219
1261
  accessory.context.device = device;
1220
1262
  accessory.context.model = device.deviceType;
1221
1263
  accessory.context.deviceID = device.deviceId;
1222
- accessory.context.firmwareRevision = device.firmware;
1264
+ if (device.firmware) {
1265
+ accessory.context.FirmwareRevision = device.firmware;
1266
+ }
1223
1267
  accessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
1224
1268
  accessory.context.connectionType = await this.connectionType(device);
1225
1269
  // create the accessory handler for the newly create accessory
@@ -1249,7 +1293,9 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
1249
1293
  existingAccessory.context.model = device.deviceType;
1250
1294
  existingAccessory.context.deviceID = device.deviceId;
1251
1295
  existingAccessory.displayName = device.configDeviceName || device.deviceName;
1252
- existingAccessory.context.firmwareRevision = device.firmware;
1296
+ if (device.firmware) {
1297
+ existingAccessory.context.FirmwareRevision = device.firmware;
1298
+ }
1253
1299
  existingAccessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
1254
1300
  this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} DeviceID: ${device.deviceId}`);
1255
1301
  existingAccessory.context.connectionType = await this.connectionType(device);
@@ -1275,7 +1321,9 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
1275
1321
  accessory.context.device = device;
1276
1322
  accessory.context.model = device.deviceType;
1277
1323
  accessory.context.deviceID = device.deviceId;
1278
- accessory.context.firmwareRevision = device.firmware;
1324
+ if (device.firmware) {
1325
+ accessory.context.FirmwareRevision = device.firmware;
1326
+ }
1279
1327
  accessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
1280
1328
  accessory.context.connectionType = await this.connectionType(device);
1281
1329
  // create the accessory handler for the newly create accessory
@@ -1305,7 +1353,9 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
1305
1353
  existingAccessory.context.model = device.deviceType;
1306
1354
  existingAccessory.context.deviceID = device.deviceId;
1307
1355
  existingAccessory.displayName = device.configDeviceName || device.deviceName;
1308
- existingAccessory.context.firmwareRevision = device.firmware;
1356
+ if (device.firmware) {
1357
+ existingAccessory.context.FirmwareRevision = device.firmware;
1358
+ }
1309
1359
  existingAccessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
1310
1360
  this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} DeviceID: ${device.deviceId}`);
1311
1361
  existingAccessory.context.connectionType = await this.connectionType(device);
@@ -1331,7 +1381,9 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
1331
1381
  accessory.context.device = device;
1332
1382
  accessory.context.model = device.deviceType;
1333
1383
  accessory.context.deviceID = device.deviceId;
1334
- accessory.context.firmwareRevision = device.firmware;
1384
+ if (device.firmware) {
1385
+ accessory.context.FirmwareRevision = device.firmware;
1386
+ }
1335
1387
  accessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
1336
1388
  accessory.context.connectionType = await this.connectionType(device);
1337
1389
  // create the accessory handler for the newly create accessory
@@ -1361,7 +1413,9 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
1361
1413
  existingAccessory.context.model = device.deviceType;
1362
1414
  existingAccessory.context.deviceID = device.deviceId;
1363
1415
  existingAccessory.displayName = device.configDeviceName || device.deviceName;
1364
- existingAccessory.context.firmwareRevision = device.firmware;
1416
+ if (device.firmware) {
1417
+ existingAccessory.context.FirmwareRevision = device.firmware;
1418
+ }
1365
1419
  existingAccessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
1366
1420
  this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} DeviceID: ${device.deviceId}`);
1367
1421
  existingAccessory.context.connectionType = await this.connectionType(device);
@@ -1387,7 +1441,9 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
1387
1441
  accessory.context.device = device;
1388
1442
  accessory.context.model = device.deviceType;
1389
1443
  accessory.context.deviceID = device.deviceId;
1390
- accessory.context.firmwareRevision = device.firmware;
1444
+ if (device.firmware) {
1445
+ accessory.context.FirmwareRevision = device.firmware;
1446
+ }
1391
1447
  accessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
1392
1448
  accessory.context.connectionType = await this.connectionType(device);
1393
1449
  // create the accessory handler for the newly create accessory
@@ -1417,7 +1473,9 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
1417
1473
  existingAccessory.context.model = device.deviceType;
1418
1474
  existingAccessory.context.deviceID = device.deviceId;
1419
1475
  existingAccessory.displayName = device.configDeviceName || device.deviceName;
1420
- existingAccessory.context.firmwareRevision = device.firmware;
1476
+ if (device.firmware) {
1477
+ existingAccessory.context.FirmwareRevision = device.firmware;
1478
+ }
1421
1479
  existingAccessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
1422
1480
  this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} DeviceID: ${device.deviceId}`);
1423
1481
  existingAccessory.context.connectionType = await this.connectionType(device);
@@ -1443,7 +1501,9 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
1443
1501
  accessory.context.device = device;
1444
1502
  accessory.context.model = device.deviceType;
1445
1503
  accessory.context.deviceID = device.deviceId;
1446
- accessory.context.firmwareRevision = device.firmware;
1504
+ if (device.firmware) {
1505
+ accessory.context.FirmwareRevision = device.firmware;
1506
+ }
1447
1507
  accessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
1448
1508
  accessory.context.connectionType = await this.connectionType(device);
1449
1509
  // create the accessory handler for the newly create accessory
@@ -1473,7 +1533,9 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
1473
1533
  existingAccessory.context.model = device.deviceType;
1474
1534
  existingAccessory.context.deviceID = device.deviceId;
1475
1535
  existingAccessory.displayName = device.configDeviceName || device.deviceName;
1476
- existingAccessory.context.firmwareRevision = device.firmware;
1536
+ if (device.firmware) {
1537
+ existingAccessory.context.FirmwareRevision = device.firmware;
1538
+ }
1477
1539
  existingAccessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
1478
1540
  this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} DeviceID: ${device.deviceId}`);
1479
1541
  existingAccessory.context.connectionType = await this.connectionType(device);
@@ -1499,7 +1561,9 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
1499
1561
  accessory.context.device = device;
1500
1562
  accessory.context.model = device.deviceType;
1501
1563
  accessory.context.deviceID = device.deviceId;
1502
- accessory.context.firmwareRevision = device.firmware;
1564
+ if (device.firmware) {
1565
+ accessory.context.FirmwareRevision = device.firmware;
1566
+ }
1503
1567
  accessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
1504
1568
  accessory.context.connectionType = await this.connectionType(device);
1505
1569
  // create the accessory handler for the newly create accessory
@@ -1527,7 +1591,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
1527
1591
  existingAccessory.context.model = device.remoteType;
1528
1592
  existingAccessory.context.deviceID = device.deviceId;
1529
1593
  existingAccessory.displayName = device.configDeviceName || device.deviceName;
1530
- existingAccessory.context.firmwareRevision = device.firmware;
1594
+ existingAccessory.context.FirmwareRevision = device.firmware;
1531
1595
  existingAccessory.context.deviceType = `IR: ${device.remoteType}`;
1532
1596
  this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} DeviceID: ${device.deviceId}`);
1533
1597
  existingAccessory.context.connectionType = device.connectionType;
@@ -1550,7 +1614,9 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
1550
1614
  accessory.context.device = device;
1551
1615
  accessory.context.model = device.remoteType;
1552
1616
  accessory.context.deviceID = device.deviceId;
1553
- accessory.context.firmwareRevision = device.firmware;
1617
+ if (device.firmware) {
1618
+ accessory.context.FirmwareRevision = device.firmware;
1619
+ }
1554
1620
  accessory.context.deviceType = `IR: ${device.remoteType}`;
1555
1621
  accessory.context.connectionType = device.connectionType;
1556
1622
  // create the accessory handler for the newly create accessory
@@ -1579,7 +1645,9 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
1579
1645
  existingAccessory.context.model = device.remoteType;
1580
1646
  existingAccessory.context.deviceID = device.deviceId;
1581
1647
  existingAccessory.displayName = device.configDeviceName || device.deviceName;
1582
- existingAccessory.context.firmwareRevision = device.firmware;
1648
+ if (device.firmware) {
1649
+ existingAccessory.context.FirmwareRevision = device.firmware;
1650
+ }
1583
1651
  existingAccessory.context.deviceType = `IR: ${device.remoteType}`;
1584
1652
  this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} DeviceID: ${device.deviceId}`);
1585
1653
  existingAccessory.context.connectionType = device.connectionType;
@@ -1605,7 +1673,9 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
1605
1673
  accessory.context.device = device;
1606
1674
  accessory.context.model = device.remoteType;
1607
1675
  accessory.context.deviceID = device.deviceId;
1608
- accessory.context.firmwareRevision = device.firmware;
1676
+ if (device.firmware) {
1677
+ accessory.context.FirmwareRevision = device.firmware;
1678
+ }
1609
1679
  accessory.context.deviceType = `IR: ${device.remoteType}`;
1610
1680
  accessory.context.connectionType = device.connectionType;
1611
1681
  // create the accessory handler for the newly create accessory
@@ -1635,7 +1705,9 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
1635
1705
  existingAccessory.context.model = device.remoteType;
1636
1706
  existingAccessory.context.deviceID = device.deviceId;
1637
1707
  existingAccessory.displayName = device.configDeviceName || device.deviceName;
1638
- existingAccessory.context.firmwareRevision = device.firmware;
1708
+ if (device.firmware) {
1709
+ existingAccessory.context.FirmwareRevision = device.firmware;
1710
+ }
1639
1711
  existingAccessory.context.deviceType = `IR: ${device.remoteType}`;
1640
1712
  this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} DeviceID: ${device.deviceId}`);
1641
1713
  existingAccessory.context.connectionType = device.connectionType;
@@ -1661,7 +1733,9 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
1661
1733
  accessory.context.device = device;
1662
1734
  accessory.context.model = device.remoteType;
1663
1735
  accessory.context.deviceID = device.deviceId;
1664
- accessory.context.firmwareRevision = device.firmware;
1736
+ if (device.firmware) {
1737
+ accessory.context.FirmwareRevision = device.firmware;
1738
+ }
1665
1739
  accessory.context.deviceType = `IR: ${device.remoteType}`;
1666
1740
  accessory.context.connectionType = device.connectionType;
1667
1741
  // create the accessory handler for the newly create accessory
@@ -1691,7 +1765,9 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
1691
1765
  existingAccessory.context.model = device.remoteType;
1692
1766
  existingAccessory.context.deviceID = device.deviceId;
1693
1767
  existingAccessory.displayName = device.configDeviceName || device.deviceName;
1694
- existingAccessory.context.firmwareRevision = device.firmware;
1768
+ if (device.firmware) {
1769
+ existingAccessory.context.FirmwareRevision = device.firmware;
1770
+ }
1695
1771
  existingAccessory.context.deviceType = `IR: ${device.remoteType}`;
1696
1772
  this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} DeviceID: ${device.deviceId}`);
1697
1773
  existingAccessory.context.connectionType = device.connectionType;
@@ -1717,7 +1793,9 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
1717
1793
  accessory.context.device = device;
1718
1794
  accessory.context.model = device.remoteType;
1719
1795
  accessory.context.deviceID = device.deviceId;
1720
- accessory.context.firmwareRevision = device.firmware;
1796
+ if (device.firmware) {
1797
+ accessory.context.FirmwareRevision = device.firmware;
1798
+ }
1721
1799
  accessory.context.deviceType = `IR: ${device.remoteType}`;
1722
1800
  accessory.context.connectionType = device.connectionType;
1723
1801
  // create the accessory handler for the newly create accessory
@@ -1747,7 +1825,9 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
1747
1825
  existingAccessory.context.model = device.remoteType;
1748
1826
  existingAccessory.context.deviceID = device.deviceId;
1749
1827
  existingAccessory.displayName = device.configDeviceName || device.deviceName;
1750
- existingAccessory.context.firmwareRevision = device.firmware;
1828
+ if (device.firmware) {
1829
+ existingAccessory.context.FirmwareRevision = device.firmware;
1830
+ }
1751
1831
  existingAccessory.context.deviceType = `IR: ${device.remoteType}`;
1752
1832
  this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} DeviceID: ${device.deviceId}`);
1753
1833
  existingAccessory.context.connectionType = device.connectionType;
@@ -1773,7 +1853,9 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
1773
1853
  accessory.context.device = device;
1774
1854
  accessory.context.model = device.remoteType;
1775
1855
  accessory.context.deviceID = device.deviceId;
1776
- accessory.context.firmwareRevision = device.firmware;
1856
+ if (device.firmware) {
1857
+ accessory.context.FirmwareRevision = device.firmware;
1858
+ }
1777
1859
  accessory.context.deviceType = `IR: ${device.remoteType}`;
1778
1860
  accessory.context.connectionType = device.connectionType;
1779
1861
  // create the accessory handler for the newly create accessory
@@ -1803,7 +1885,9 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
1803
1885
  existingAccessory.context.model = device.remoteType;
1804
1886
  existingAccessory.context.deviceID = device.deviceId;
1805
1887
  existingAccessory.displayName = device.configDeviceName || device.deviceName;
1806
- existingAccessory.context.firmwareRevision = device.firmware;
1888
+ if (device.firmware) {
1889
+ existingAccessory.context.FirmwareRevision = device.firmware;
1890
+ }
1807
1891
  existingAccessory.context.deviceType = `IR: ${device.remoteType}`;
1808
1892
  this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} DeviceID: ${device.deviceId}`);
1809
1893
  existingAccessory.context.connectionType = device.connectionType;
@@ -1829,7 +1913,9 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
1829
1913
  accessory.context.device = device;
1830
1914
  accessory.context.model = device.remoteType;
1831
1915
  accessory.context.deviceID = device.deviceId;
1832
- accessory.context.firmwareRevision = device.firmware;
1916
+ if (device.firmware) {
1917
+ accessory.context.FirmwareRevision = device.firmware;
1918
+ }
1833
1919
  accessory.context.deviceType = `IR: ${device.remoteType}`;
1834
1920
  accessory.context.connectionType = device.connectionType;
1835
1921
  // create the accessory handler for the newly create accessory
@@ -1859,7 +1945,9 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
1859
1945
  existingAccessory.context.model = device.remoteType;
1860
1946
  existingAccessory.context.deviceID = device.deviceId;
1861
1947
  existingAccessory.displayName = device.configDeviceName || device.deviceName;
1862
- existingAccessory.context.firmwareRevision = device.firmware;
1948
+ if (device.firmware) {
1949
+ existingAccessory.context.FirmwareRevision = device.firmware;
1950
+ }
1863
1951
  existingAccessory.context.deviceType = `IR: ${device.remoteType}`;
1864
1952
  this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} DeviceID: ${device.deviceId}`);
1865
1953
  existingAccessory.context.connectionType = device.connectionType;
@@ -1885,7 +1973,9 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
1885
1973
  accessory.context.device = device;
1886
1974
  accessory.context.model = device.remoteType;
1887
1975
  accessory.context.deviceID = device.deviceId;
1888
- accessory.context.firmwareRevision = device.firmware;
1976
+ if (device.firmware) {
1977
+ accessory.context.FirmwareRevision = device.firmware;
1978
+ }
1889
1979
  accessory.context.deviceType = `IR: ${device.remoteType}`;
1890
1980
  accessory.context.connectionType = device.connectionType;
1891
1981
  // create the accessory handler for the newly create accessory
@@ -1915,7 +2005,9 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
1915
2005
  existingAccessory.context.model = device.remoteType;
1916
2006
  existingAccessory.context.deviceID = device.deviceId;
1917
2007
  existingAccessory.displayName = device.configDeviceName || device.deviceName;
1918
- existingAccessory.context.firmwareRevision = device.firmware;
2008
+ if (device.firmware) {
2009
+ existingAccessory.context.FirmwareRevision = device.firmware;
2010
+ }
1919
2011
  existingAccessory.context.deviceType = `IR: ${device.remoteType}`;
1920
2012
  this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} DeviceID: ${device.deviceId}`);
1921
2013
  existingAccessory.context.connectionType = device.connectionType;
@@ -1941,7 +2033,9 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
1941
2033
  accessory.context.device = device;
1942
2034
  accessory.context.model = device.remoteType;
1943
2035
  accessory.context.deviceID = device.deviceId;
1944
- accessory.context.firmwareRevision = device.firmware;
2036
+ if (device.firmware) {
2037
+ accessory.context.FirmwareRevision = device.firmware;
2038
+ }
1945
2039
  accessory.context.deviceType = `IR: ${device.remoteType}`;
1946
2040
  accessory.context.connectionType = device.connectionType;
1947
2041
  // create the accessory handler for the newly create accessory
@@ -1971,7 +2065,9 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
1971
2065
  existingAccessory.context.model = device.remoteType;
1972
2066
  existingAccessory.context.deviceID = device.deviceId;
1973
2067
  existingAccessory.displayName = device.configDeviceName || device.deviceName;
1974
- existingAccessory.context.firmwareRevision = device.firmware;
2068
+ if (device.firmware) {
2069
+ existingAccessory.context.FirmwareRevision = device.firmware;
2070
+ }
1975
2071
  existingAccessory.context.deviceType = `IR: ${device.remoteType}`;
1976
2072
  this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} DeviceID: ${device.deviceId}`);
1977
2073
  existingAccessory.context.connectionType = device.connectionType;
@@ -1997,7 +2093,9 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
1997
2093
  accessory.context.device = device;
1998
2094
  accessory.context.model = device.remoteType;
1999
2095
  accessory.context.deviceID = device.deviceId;
2000
- accessory.context.firmwareRevision = device.firmware;
2096
+ if (device.firmware) {
2097
+ accessory.context.FirmwareRevision = device.firmware;
2098
+ }
2001
2099
  accessory.context.deviceType = `IR: ${device.remoteType}`;
2002
2100
  accessory.context.connectionType = device.connectionType;
2003
2101
  // create the accessory handler for the newly create accessory