@switchbot/homebridge-switchbot 2.9.0 → 2.9.1-beta.1
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/.github/npm-version-script.js +81 -0
- package/dist/platform.d.ts.map +1 -1
- package/dist/platform.js +153 -55
- package/dist/platform.js.map +1 -1
- package/package.json +1 -1
- package/src/platform.ts +153 -55
package/dist/platform.js
CHANGED
|
@@ -336,6 +336,10 @@ class SwitchBotPlatform {
|
|
|
336
336
|
const devices = mergeBydeviceId(deviceLists, deviceConfigs);
|
|
337
337
|
this.debugLog(`SwitchBot Devices: ${JSON.stringify(devices)}`);
|
|
338
338
|
for (const device of devices) {
|
|
339
|
+
if (!device.deviceType) {
|
|
340
|
+
device.deviceType = device.configDeviceType;
|
|
341
|
+
this.errorLog(`API has displaying no deviceType: ${device.deviceType}, So using configDeviceType: ${device.configDeviceType}`);
|
|
342
|
+
}
|
|
339
343
|
if (device.deviceType) {
|
|
340
344
|
if (device.configDeviceName) {
|
|
341
345
|
device.deviceName = device.configDeviceName;
|
|
@@ -402,10 +406,6 @@ class SwitchBotPlatform {
|
|
|
402
406
|
for (const device of devices) {
|
|
403
407
|
device.deviceType = device.configDeviceType;
|
|
404
408
|
device.deviceName = device.configDeviceName;
|
|
405
|
-
if (!device.deviceType) {
|
|
406
|
-
device.deviceType = device.configDeviceType;
|
|
407
|
-
this.errorLog(`API has displaying no deviceType: ${device.deviceType}, So using configDeviceType: ${device.configDeviceType}`);
|
|
408
|
-
}
|
|
409
409
|
if (device.deviceType) {
|
|
410
410
|
this.createDevice(device);
|
|
411
411
|
}
|
|
@@ -588,7 +588,9 @@ class SwitchBotPlatform {
|
|
|
588
588
|
existingAccessory.context.model = device.deviceType;
|
|
589
589
|
existingAccessory.context.deviceID = device.deviceId;
|
|
590
590
|
existingAccessory.displayName = device.configDeviceName || device.deviceName;
|
|
591
|
-
|
|
591
|
+
if (device.firmware) {
|
|
592
|
+
existingAccessory.context.FirmwareRevision = device.firmware;
|
|
593
|
+
}
|
|
592
594
|
existingAccessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
|
|
593
595
|
this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} DeviceID: ${device.deviceId}`);
|
|
594
596
|
existingAccessory.context.connectionType = await this.connectionType(device);
|
|
@@ -614,7 +616,9 @@ class SwitchBotPlatform {
|
|
|
614
616
|
accessory.context.device = device;
|
|
615
617
|
accessory.context.model = device.deviceType;
|
|
616
618
|
accessory.context.deviceID = device.deviceId;
|
|
617
|
-
|
|
619
|
+
if (device.firmware) {
|
|
620
|
+
accessory.context.FirmwareRevision = device.firmware;
|
|
621
|
+
}
|
|
618
622
|
accessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
|
|
619
623
|
accessory.context.connectionType = await this.connectionType(device);
|
|
620
624
|
// create the accessory handler for the newly create accessory
|
|
@@ -641,7 +645,9 @@ class SwitchBotPlatform {
|
|
|
641
645
|
existingAccessory.context.model = device.deviceType;
|
|
642
646
|
existingAccessory.context.deviceID = device.deviceId;
|
|
643
647
|
existingAccessory.displayName = device.configDeviceName || device.deviceName;
|
|
644
|
-
|
|
648
|
+
if (device.firmware) {
|
|
649
|
+
existingAccessory.context.FirmwareRevision = device.firmware;
|
|
650
|
+
}
|
|
645
651
|
existingAccessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
|
|
646
652
|
this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} DeviceID: ${device.deviceId}`);
|
|
647
653
|
existingAccessory.context.connectionType = await this.connectionType(device);
|
|
@@ -667,10 +673,12 @@ class SwitchBotPlatform {
|
|
|
667
673
|
accessory.context.device = device;
|
|
668
674
|
accessory.context.model = device.deviceType;
|
|
669
675
|
accessory.context.deviceID = device.deviceId;
|
|
670
|
-
|
|
676
|
+
if (device.firmware) {
|
|
677
|
+
accessory.context.FirmwareRevision = device.firmware;
|
|
678
|
+
}
|
|
671
679
|
accessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
|
|
672
680
|
accessory.context.connectionType = await this.connectionType(device);
|
|
673
|
-
// accessory.context.
|
|
681
|
+
// accessory.context.FirmwareRevision = findaccessories.accessoryAttribute.softwareRevision;
|
|
674
682
|
// create the accessory handler for the newly create accessory
|
|
675
683
|
// this is imported from `platformAccessory.ts`
|
|
676
684
|
new bot_1.Bot(this, accessory, device);
|
|
@@ -695,7 +703,9 @@ class SwitchBotPlatform {
|
|
|
695
703
|
existingAccessory.context.model = device.deviceType;
|
|
696
704
|
existingAccessory.context.deviceID = device.deviceId;
|
|
697
705
|
existingAccessory.displayName = device.configDeviceName || device.deviceName;
|
|
698
|
-
|
|
706
|
+
if (device.firmware) {
|
|
707
|
+
existingAccessory.context.FirmwareRevision = device.firmware;
|
|
708
|
+
}
|
|
699
709
|
existingAccessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
|
|
700
710
|
this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} DeviceID: ${device.deviceId}`);
|
|
701
711
|
existingAccessory.context.connectionType = await this.connectionType(device);
|
|
@@ -721,7 +731,9 @@ class SwitchBotPlatform {
|
|
|
721
731
|
accessory.context.device = device;
|
|
722
732
|
accessory.context.model = device.deviceType;
|
|
723
733
|
accessory.context.deviceID = device.deviceId;
|
|
724
|
-
|
|
734
|
+
if (device.firmware) {
|
|
735
|
+
accessory.context.FirmwareRevision = device.firmware;
|
|
736
|
+
}
|
|
725
737
|
accessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
|
|
726
738
|
accessory.context.connectionType = await this.connectionType(device);
|
|
727
739
|
// create the accessory handler for the newly create accessory
|
|
@@ -749,7 +761,9 @@ class SwitchBotPlatform {
|
|
|
749
761
|
existingAccessory.context.model = device.deviceType;
|
|
750
762
|
existingAccessory.context.deviceID = device.deviceId;
|
|
751
763
|
existingAccessory.displayName = device.configDeviceName || device.deviceName;
|
|
752
|
-
|
|
764
|
+
if (device.firmware) {
|
|
765
|
+
existingAccessory.context.FirmwareRevision = device.firmware;
|
|
766
|
+
}
|
|
753
767
|
existingAccessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
|
|
754
768
|
this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} DeviceID: ${device.deviceId}`);
|
|
755
769
|
existingAccessory.context.connectionType = await this.connectionType(device);
|
|
@@ -775,7 +789,9 @@ class SwitchBotPlatform {
|
|
|
775
789
|
accessory.context.device = device;
|
|
776
790
|
accessory.context.model = device.deviceType;
|
|
777
791
|
accessory.context.deviceID = device.deviceId;
|
|
778
|
-
|
|
792
|
+
if (device.firmware) {
|
|
793
|
+
accessory.context.FirmwareRevision = device.firmware;
|
|
794
|
+
}
|
|
779
795
|
accessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
|
|
780
796
|
accessory.context.connectionType = await this.connectionType(device);
|
|
781
797
|
// create the accessory handler for the newly create accessory
|
|
@@ -803,7 +819,9 @@ class SwitchBotPlatform {
|
|
|
803
819
|
existingAccessory.context.model = device.deviceType;
|
|
804
820
|
existingAccessory.context.deviceID = device.deviceId;
|
|
805
821
|
existingAccessory.displayName = device.configDeviceName || device.deviceName;
|
|
806
|
-
|
|
822
|
+
if (device.firmware) {
|
|
823
|
+
existingAccessory.context.FirmwareRevision = device.firmware;
|
|
824
|
+
}
|
|
807
825
|
existingAccessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
|
|
808
826
|
this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} DeviceID: ${device.deviceId}`);
|
|
809
827
|
existingAccessory.context.connectionType = await this.connectionType(device);
|
|
@@ -829,7 +847,9 @@ class SwitchBotPlatform {
|
|
|
829
847
|
accessory.context.device = device;
|
|
830
848
|
accessory.context.model = device.deviceType;
|
|
831
849
|
accessory.context.deviceID = device.deviceId;
|
|
832
|
-
|
|
850
|
+
if (device.firmware) {
|
|
851
|
+
accessory.context.FirmwareRevision = device.firmware;
|
|
852
|
+
}
|
|
833
853
|
accessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
|
|
834
854
|
accessory.context.connectionType = await this.connectionType(device);
|
|
835
855
|
// create the accessory handler for the newly create accessory
|
|
@@ -856,7 +876,9 @@ class SwitchBotPlatform {
|
|
|
856
876
|
existingAccessory.context.model = device.deviceType;
|
|
857
877
|
existingAccessory.context.deviceID = device.deviceId;
|
|
858
878
|
existingAccessory.displayName = device.configDeviceName || device.deviceName;
|
|
859
|
-
|
|
879
|
+
if (device.firmware) {
|
|
880
|
+
existingAccessory.context.FirmwareRevision = device.firmware;
|
|
881
|
+
}
|
|
860
882
|
existingAccessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
|
|
861
883
|
this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} DeviceID: ${device.deviceId}`);
|
|
862
884
|
existingAccessory.context.connectionType = await this.connectionType(device);
|
|
@@ -882,7 +904,9 @@ class SwitchBotPlatform {
|
|
|
882
904
|
accessory.context.device = device;
|
|
883
905
|
accessory.context.model = device.deviceType;
|
|
884
906
|
accessory.context.deviceID = device.deviceId;
|
|
885
|
-
|
|
907
|
+
if (device.firmware) {
|
|
908
|
+
accessory.context.FirmwareRevision = device.firmware;
|
|
909
|
+
}
|
|
886
910
|
accessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
|
|
887
911
|
accessory.context.connectionType = await this.connectionType(device);
|
|
888
912
|
// create the accessory handler for the newly create accessory
|
|
@@ -909,7 +933,9 @@ class SwitchBotPlatform {
|
|
|
909
933
|
existingAccessory.context.model = device.deviceType;
|
|
910
934
|
existingAccessory.context.deviceID = device.deviceId;
|
|
911
935
|
existingAccessory.displayName = device.configDeviceName || device.deviceName;
|
|
912
|
-
|
|
936
|
+
if (device.firmware) {
|
|
937
|
+
existingAccessory.context.FirmwareRevision = device.firmware;
|
|
938
|
+
}
|
|
913
939
|
existingAccessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
|
|
914
940
|
this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} DeviceID: ${device.deviceId}`);
|
|
915
941
|
existingAccessory.context.connectionType = await this.connectionType(device);
|
|
@@ -935,7 +961,9 @@ class SwitchBotPlatform {
|
|
|
935
961
|
accessory.context.device = device;
|
|
936
962
|
accessory.context.model = device.deviceType;
|
|
937
963
|
accessory.context.deviceID = device.deviceId;
|
|
938
|
-
|
|
964
|
+
if (device.firmware) {
|
|
965
|
+
accessory.context.FirmwareRevision = device.firmware;
|
|
966
|
+
}
|
|
939
967
|
accessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
|
|
940
968
|
accessory.context.connectionType = await this.connectionType(device);
|
|
941
969
|
// create the accessory handler for the newly create accessory
|
|
@@ -962,7 +990,9 @@ class SwitchBotPlatform {
|
|
|
962
990
|
existingAccessory.context.model = device.deviceType;
|
|
963
991
|
existingAccessory.context.deviceID = device.deviceId;
|
|
964
992
|
existingAccessory.displayName = device.configDeviceName || device.deviceName;
|
|
965
|
-
|
|
993
|
+
if (device.firmware) {
|
|
994
|
+
existingAccessory.context.FirmwareRevision = device.firmware;
|
|
995
|
+
}
|
|
966
996
|
existingAccessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
|
|
967
997
|
this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} DeviceID: ${device.deviceId}`);
|
|
968
998
|
existingAccessory.context.connectionType = await this.connectionType(device);
|
|
@@ -988,7 +1018,9 @@ class SwitchBotPlatform {
|
|
|
988
1018
|
accessory.context.device = device;
|
|
989
1019
|
accessory.context.model = device.deviceType;
|
|
990
1020
|
accessory.context.deviceID = device.deviceId;
|
|
991
|
-
|
|
1021
|
+
if (device.firmware) {
|
|
1022
|
+
accessory.context.FirmwareRevision = device.firmware;
|
|
1023
|
+
}
|
|
992
1024
|
accessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
|
|
993
1025
|
accessory.context.connectionType = await this.connectionType(device);
|
|
994
1026
|
// create the accessory handler for the newly create accessory
|
|
@@ -1015,7 +1047,9 @@ class SwitchBotPlatform {
|
|
|
1015
1047
|
existingAccessory.context.model = device.deviceType;
|
|
1016
1048
|
existingAccessory.context.deviceID = device.deviceId;
|
|
1017
1049
|
existingAccessory.displayName = device.configDeviceName || device.deviceName;
|
|
1018
|
-
|
|
1050
|
+
if (device.firmware) {
|
|
1051
|
+
existingAccessory.context.FirmwareRevision = device.firmware;
|
|
1052
|
+
}
|
|
1019
1053
|
existingAccessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
|
|
1020
1054
|
this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} DeviceID: ${device.deviceId}`);
|
|
1021
1055
|
existingAccessory.context.connectionType = await this.connectionType(device);
|
|
@@ -1053,7 +1087,9 @@ class SwitchBotPlatform {
|
|
|
1053
1087
|
accessory.context.device = device;
|
|
1054
1088
|
accessory.context.model = device.deviceType;
|
|
1055
1089
|
accessory.context.deviceID = device.deviceId;
|
|
1056
|
-
|
|
1090
|
+
if (device.firmware) {
|
|
1091
|
+
accessory.context.FirmwareRevision = device.firmware;
|
|
1092
|
+
}
|
|
1057
1093
|
accessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
|
|
1058
1094
|
accessory.context.connectionType = await this.connectionType(device);
|
|
1059
1095
|
// create the accessory handler for the newly create accessory
|
|
@@ -1080,7 +1116,9 @@ class SwitchBotPlatform {
|
|
|
1080
1116
|
existingAccessory.context.model = device.deviceType;
|
|
1081
1117
|
existingAccessory.context.deviceID = device.deviceId;
|
|
1082
1118
|
existingAccessory.displayName = device.configDeviceName || device.deviceName;
|
|
1083
|
-
|
|
1119
|
+
if (device.firmware) {
|
|
1120
|
+
existingAccessory.context.FirmwareRevision = device.firmware;
|
|
1121
|
+
}
|
|
1084
1122
|
existingAccessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
|
|
1085
1123
|
this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} DeviceID: ${device.deviceId}`);
|
|
1086
1124
|
existingAccessory.context.connectionType = await this.connectionType(device);
|
|
@@ -1118,7 +1156,9 @@ class SwitchBotPlatform {
|
|
|
1118
1156
|
accessory.context.device = device;
|
|
1119
1157
|
accessory.context.model = device.deviceType;
|
|
1120
1158
|
accessory.context.deviceID = device.deviceId;
|
|
1121
|
-
|
|
1159
|
+
if (device.firmware) {
|
|
1160
|
+
accessory.context.FirmwareRevision = device.firmware;
|
|
1161
|
+
}
|
|
1122
1162
|
accessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
|
|
1123
1163
|
accessory.context.connectionType = await this.connectionType(device);
|
|
1124
1164
|
// create the accessory handler for the newly create accessory
|
|
@@ -1145,7 +1185,9 @@ class SwitchBotPlatform {
|
|
|
1145
1185
|
existingAccessory.context.model = device.deviceType;
|
|
1146
1186
|
existingAccessory.context.deviceID = device.deviceId;
|
|
1147
1187
|
existingAccessory.displayName = device.configDeviceName || device.deviceName;
|
|
1148
|
-
|
|
1188
|
+
if (device.firmware) {
|
|
1189
|
+
existingAccessory.context.FirmwareRevision = device.firmware;
|
|
1190
|
+
}
|
|
1149
1191
|
existingAccessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
|
|
1150
1192
|
this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} DeviceID: ${device.deviceId}`);
|
|
1151
1193
|
existingAccessory.context.connectionType = await this.connectionType(device);
|
|
@@ -1171,7 +1213,9 @@ class SwitchBotPlatform {
|
|
|
1171
1213
|
accessory.context.device = device;
|
|
1172
1214
|
accessory.context.model = device.deviceType;
|
|
1173
1215
|
accessory.context.deviceID = device.deviceId;
|
|
1174
|
-
|
|
1216
|
+
if (device.firmware) {
|
|
1217
|
+
accessory.context.FirmwareRevision = device.firmware;
|
|
1218
|
+
}
|
|
1175
1219
|
accessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
|
|
1176
1220
|
accessory.context.connectionType = await this.connectionType(device);
|
|
1177
1221
|
// create the accessory handler for the newly create accessory
|
|
@@ -1198,7 +1242,9 @@ class SwitchBotPlatform {
|
|
|
1198
1242
|
existingAccessory.context.model = device.deviceType;
|
|
1199
1243
|
existingAccessory.context.deviceID = device.deviceId;
|
|
1200
1244
|
existingAccessory.displayName = device.configDeviceName || device.deviceName;
|
|
1201
|
-
|
|
1245
|
+
if (device.firmware) {
|
|
1246
|
+
existingAccessory.context.FirmwareRevision = device.firmware;
|
|
1247
|
+
}
|
|
1202
1248
|
existingAccessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
|
|
1203
1249
|
this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} DeviceID: ${device.deviceId}`);
|
|
1204
1250
|
existingAccessory.context.connectionType = await this.connectionType(device);
|
|
@@ -1224,7 +1270,9 @@ class SwitchBotPlatform {
|
|
|
1224
1270
|
accessory.context.device = device;
|
|
1225
1271
|
accessory.context.model = device.deviceType;
|
|
1226
1272
|
accessory.context.deviceID = device.deviceId;
|
|
1227
|
-
|
|
1273
|
+
if (device.firmware) {
|
|
1274
|
+
accessory.context.FirmwareRevision = device.firmware;
|
|
1275
|
+
}
|
|
1228
1276
|
accessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
|
|
1229
1277
|
accessory.context.connectionType = await this.connectionType(device);
|
|
1230
1278
|
// create the accessory handler for the newly create accessory
|
|
@@ -1251,7 +1299,9 @@ class SwitchBotPlatform {
|
|
|
1251
1299
|
existingAccessory.context.model = device.deviceType;
|
|
1252
1300
|
existingAccessory.context.deviceID = device.deviceId;
|
|
1253
1301
|
existingAccessory.displayName = device.configDeviceName || device.deviceName;
|
|
1254
|
-
|
|
1302
|
+
if (device.firmware) {
|
|
1303
|
+
existingAccessory.context.FirmwareRevision = device.firmware;
|
|
1304
|
+
}
|
|
1255
1305
|
existingAccessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
|
|
1256
1306
|
this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} DeviceID: ${device.deviceId}`);
|
|
1257
1307
|
existingAccessory.context.connectionType = await this.connectionType(device);
|
|
@@ -1277,7 +1327,9 @@ class SwitchBotPlatform {
|
|
|
1277
1327
|
accessory.context.device = device;
|
|
1278
1328
|
accessory.context.model = device.deviceType;
|
|
1279
1329
|
accessory.context.deviceID = device.deviceId;
|
|
1280
|
-
|
|
1330
|
+
if (device.firmware) {
|
|
1331
|
+
accessory.context.FirmwareRevision = device.firmware;
|
|
1332
|
+
}
|
|
1281
1333
|
accessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
|
|
1282
1334
|
accessory.context.connectionType = await this.connectionType(device);
|
|
1283
1335
|
// create the accessory handler for the newly create accessory
|
|
@@ -1304,7 +1356,9 @@ class SwitchBotPlatform {
|
|
|
1304
1356
|
existingAccessory.context.model = device.deviceType;
|
|
1305
1357
|
existingAccessory.context.deviceID = device.deviceId;
|
|
1306
1358
|
existingAccessory.displayName = device.configDeviceName || device.deviceName;
|
|
1307
|
-
|
|
1359
|
+
if (device.firmware) {
|
|
1360
|
+
existingAccessory.context.FirmwareRevision = device.firmware;
|
|
1361
|
+
}
|
|
1308
1362
|
existingAccessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
|
|
1309
1363
|
this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} DeviceID: ${device.deviceId}`);
|
|
1310
1364
|
existingAccessory.context.connectionType = await this.connectionType(device);
|
|
@@ -1330,7 +1384,9 @@ class SwitchBotPlatform {
|
|
|
1330
1384
|
accessory.context.device = device;
|
|
1331
1385
|
accessory.context.model = device.deviceType;
|
|
1332
1386
|
accessory.context.deviceID = device.deviceId;
|
|
1333
|
-
|
|
1387
|
+
if (device.firmware) {
|
|
1388
|
+
accessory.context.FirmwareRevision = device.firmware;
|
|
1389
|
+
}
|
|
1334
1390
|
accessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
|
|
1335
1391
|
accessory.context.connectionType = await this.connectionType(device);
|
|
1336
1392
|
// create the accessory handler for the newly create accessory
|
|
@@ -1357,7 +1413,9 @@ class SwitchBotPlatform {
|
|
|
1357
1413
|
existingAccessory.context.model = device.deviceType;
|
|
1358
1414
|
existingAccessory.context.deviceID = device.deviceId;
|
|
1359
1415
|
existingAccessory.displayName = device.configDeviceName || device.deviceName;
|
|
1360
|
-
|
|
1416
|
+
if (device.firmware) {
|
|
1417
|
+
existingAccessory.context.FirmwareRevision = device.firmware;
|
|
1418
|
+
}
|
|
1361
1419
|
existingAccessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
|
|
1362
1420
|
this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} DeviceID: ${device.deviceId}`);
|
|
1363
1421
|
existingAccessory.context.connectionType = await this.connectionType(device);
|
|
@@ -1383,7 +1441,9 @@ class SwitchBotPlatform {
|
|
|
1383
1441
|
accessory.context.device = device;
|
|
1384
1442
|
accessory.context.model = device.deviceType;
|
|
1385
1443
|
accessory.context.deviceID = device.deviceId;
|
|
1386
|
-
|
|
1444
|
+
if (device.firmware) {
|
|
1445
|
+
accessory.context.FirmwareRevision = device.firmware;
|
|
1446
|
+
}
|
|
1387
1447
|
accessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
|
|
1388
1448
|
accessory.context.connectionType = await this.connectionType(device);
|
|
1389
1449
|
// create the accessory handler for the newly create accessory
|
|
@@ -1410,7 +1470,9 @@ class SwitchBotPlatform {
|
|
|
1410
1470
|
existingAccessory.context.model = device.deviceType;
|
|
1411
1471
|
existingAccessory.context.deviceID = device.deviceId;
|
|
1412
1472
|
existingAccessory.displayName = device.configDeviceName || device.deviceName;
|
|
1413
|
-
|
|
1473
|
+
if (device.firmware) {
|
|
1474
|
+
existingAccessory.context.FirmwareRevision = device.firmware;
|
|
1475
|
+
}
|
|
1414
1476
|
existingAccessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
|
|
1415
1477
|
this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} DeviceID: ${device.deviceId}`);
|
|
1416
1478
|
existingAccessory.context.connectionType = await this.connectionType(device);
|
|
@@ -1436,7 +1498,9 @@ class SwitchBotPlatform {
|
|
|
1436
1498
|
accessory.context.device = device;
|
|
1437
1499
|
accessory.context.model = device.deviceType;
|
|
1438
1500
|
accessory.context.deviceID = device.deviceId;
|
|
1439
|
-
|
|
1501
|
+
if (device.firmware) {
|
|
1502
|
+
accessory.context.FirmwareRevision = device.firmware;
|
|
1503
|
+
}
|
|
1440
1504
|
accessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
|
|
1441
1505
|
accessory.context.connectionType = await this.connectionType(device);
|
|
1442
1506
|
// create the accessory handler for the newly create accessory
|
|
@@ -1461,7 +1525,7 @@ class SwitchBotPlatform {
|
|
|
1461
1525
|
existingAccessory.context.model = device.remoteType;
|
|
1462
1526
|
existingAccessory.context.deviceID = device.deviceId;
|
|
1463
1527
|
existingAccessory.displayName = device.configDeviceName || device.deviceName;
|
|
1464
|
-
existingAccessory.context.
|
|
1528
|
+
existingAccessory.context.FirmwareRevision = device.firmware;
|
|
1465
1529
|
existingAccessory.context.deviceType = `IR: ${device.remoteType}`;
|
|
1466
1530
|
this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} DeviceID: ${device.deviceId}`);
|
|
1467
1531
|
existingAccessory.context.connectionType = device.connectionType;
|
|
@@ -1483,7 +1547,9 @@ class SwitchBotPlatform {
|
|
|
1483
1547
|
accessory.context.device = device;
|
|
1484
1548
|
accessory.context.model = device.remoteType;
|
|
1485
1549
|
accessory.context.deviceID = device.deviceId;
|
|
1486
|
-
|
|
1550
|
+
if (device.firmware) {
|
|
1551
|
+
accessory.context.FirmwareRevision = device.firmware;
|
|
1552
|
+
}
|
|
1487
1553
|
accessory.context.deviceType = `IR: ${device.remoteType}`;
|
|
1488
1554
|
accessory.context.connectionType = device.connectionType;
|
|
1489
1555
|
// create the accessory handler for the newly create accessory
|
|
@@ -1509,7 +1575,9 @@ class SwitchBotPlatform {
|
|
|
1509
1575
|
existingAccessory.context.model = device.remoteType;
|
|
1510
1576
|
existingAccessory.context.deviceID = device.deviceId;
|
|
1511
1577
|
existingAccessory.displayName = device.configDeviceName || device.deviceName;
|
|
1512
|
-
|
|
1578
|
+
if (device.firmware) {
|
|
1579
|
+
existingAccessory.context.FirmwareRevision = device.firmware;
|
|
1580
|
+
}
|
|
1513
1581
|
existingAccessory.context.deviceType = `IR: ${device.remoteType}`;
|
|
1514
1582
|
this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} DeviceID: ${device.deviceId}`);
|
|
1515
1583
|
existingAccessory.context.connectionType = device.connectionType;
|
|
@@ -1535,7 +1603,9 @@ class SwitchBotPlatform {
|
|
|
1535
1603
|
accessory.context.device = device;
|
|
1536
1604
|
accessory.context.model = device.remoteType;
|
|
1537
1605
|
accessory.context.deviceID = device.deviceId;
|
|
1538
|
-
|
|
1606
|
+
if (device.firmware) {
|
|
1607
|
+
accessory.context.FirmwareRevision = device.firmware;
|
|
1608
|
+
}
|
|
1539
1609
|
accessory.context.deviceType = `IR: ${device.remoteType}`;
|
|
1540
1610
|
accessory.context.connectionType = device.connectionType;
|
|
1541
1611
|
// create the accessory handler for the newly create accessory
|
|
@@ -1562,7 +1632,9 @@ class SwitchBotPlatform {
|
|
|
1562
1632
|
existingAccessory.context.model = device.remoteType;
|
|
1563
1633
|
existingAccessory.context.deviceID = device.deviceId;
|
|
1564
1634
|
existingAccessory.displayName = device.configDeviceName || device.deviceName;
|
|
1565
|
-
|
|
1635
|
+
if (device.firmware) {
|
|
1636
|
+
existingAccessory.context.FirmwareRevision = device.firmware;
|
|
1637
|
+
}
|
|
1566
1638
|
existingAccessory.context.deviceType = `IR: ${device.remoteType}`;
|
|
1567
1639
|
this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} DeviceID: ${device.deviceId}`);
|
|
1568
1640
|
existingAccessory.context.connectionType = device.connectionType;
|
|
@@ -1588,7 +1660,9 @@ class SwitchBotPlatform {
|
|
|
1588
1660
|
accessory.context.device = device;
|
|
1589
1661
|
accessory.context.model = device.remoteType;
|
|
1590
1662
|
accessory.context.deviceID = device.deviceId;
|
|
1591
|
-
|
|
1663
|
+
if (device.firmware) {
|
|
1664
|
+
accessory.context.FirmwareRevision = device.firmware;
|
|
1665
|
+
}
|
|
1592
1666
|
accessory.context.deviceType = `IR: ${device.remoteType}`;
|
|
1593
1667
|
accessory.context.connectionType = device.connectionType;
|
|
1594
1668
|
// create the accessory handler for the newly create accessory
|
|
@@ -1615,7 +1689,9 @@ class SwitchBotPlatform {
|
|
|
1615
1689
|
existingAccessory.context.model = device.remoteType;
|
|
1616
1690
|
existingAccessory.context.deviceID = device.deviceId;
|
|
1617
1691
|
existingAccessory.displayName = device.configDeviceName || device.deviceName;
|
|
1618
|
-
|
|
1692
|
+
if (device.firmware) {
|
|
1693
|
+
existingAccessory.context.FirmwareRevision = device.firmware;
|
|
1694
|
+
}
|
|
1619
1695
|
existingAccessory.context.deviceType = `IR: ${device.remoteType}`;
|
|
1620
1696
|
this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} DeviceID: ${device.deviceId}`);
|
|
1621
1697
|
existingAccessory.context.connectionType = device.connectionType;
|
|
@@ -1641,7 +1717,9 @@ class SwitchBotPlatform {
|
|
|
1641
1717
|
accessory.context.device = device;
|
|
1642
1718
|
accessory.context.model = device.remoteType;
|
|
1643
1719
|
accessory.context.deviceID = device.deviceId;
|
|
1644
|
-
|
|
1720
|
+
if (device.firmware) {
|
|
1721
|
+
accessory.context.FirmwareRevision = device.firmware;
|
|
1722
|
+
}
|
|
1645
1723
|
accessory.context.deviceType = `IR: ${device.remoteType}`;
|
|
1646
1724
|
accessory.context.connectionType = device.connectionType;
|
|
1647
1725
|
// create the accessory handler for the newly create accessory
|
|
@@ -1668,7 +1746,9 @@ class SwitchBotPlatform {
|
|
|
1668
1746
|
existingAccessory.context.model = device.remoteType;
|
|
1669
1747
|
existingAccessory.context.deviceID = device.deviceId;
|
|
1670
1748
|
existingAccessory.displayName = device.configDeviceName || device.deviceName;
|
|
1671
|
-
|
|
1749
|
+
if (device.firmware) {
|
|
1750
|
+
existingAccessory.context.FirmwareRevision = device.firmware;
|
|
1751
|
+
}
|
|
1672
1752
|
existingAccessory.context.deviceType = `IR: ${device.remoteType}`;
|
|
1673
1753
|
this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} DeviceID: ${device.deviceId}`);
|
|
1674
1754
|
existingAccessory.context.connectionType = device.connectionType;
|
|
@@ -1694,7 +1774,9 @@ class SwitchBotPlatform {
|
|
|
1694
1774
|
accessory.context.device = device;
|
|
1695
1775
|
accessory.context.model = device.remoteType;
|
|
1696
1776
|
accessory.context.deviceID = device.deviceId;
|
|
1697
|
-
|
|
1777
|
+
if (device.firmware) {
|
|
1778
|
+
accessory.context.FirmwareRevision = device.firmware;
|
|
1779
|
+
}
|
|
1698
1780
|
accessory.context.deviceType = `IR: ${device.remoteType}`;
|
|
1699
1781
|
accessory.context.connectionType = device.connectionType;
|
|
1700
1782
|
// create the accessory handler for the newly create accessory
|
|
@@ -1721,7 +1803,9 @@ class SwitchBotPlatform {
|
|
|
1721
1803
|
existingAccessory.context.model = device.remoteType;
|
|
1722
1804
|
existingAccessory.context.deviceID = device.deviceId;
|
|
1723
1805
|
existingAccessory.displayName = device.configDeviceName || device.deviceName;
|
|
1724
|
-
|
|
1806
|
+
if (device.firmware) {
|
|
1807
|
+
existingAccessory.context.FirmwareRevision = device.firmware;
|
|
1808
|
+
}
|
|
1725
1809
|
existingAccessory.context.deviceType = `IR: ${device.remoteType}`;
|
|
1726
1810
|
this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} DeviceID: ${device.deviceId}`);
|
|
1727
1811
|
existingAccessory.context.connectionType = device.connectionType;
|
|
@@ -1747,7 +1831,9 @@ class SwitchBotPlatform {
|
|
|
1747
1831
|
accessory.context.device = device;
|
|
1748
1832
|
accessory.context.model = device.remoteType;
|
|
1749
1833
|
accessory.context.deviceID = device.deviceId;
|
|
1750
|
-
|
|
1834
|
+
if (device.firmware) {
|
|
1835
|
+
accessory.context.FirmwareRevision = device.firmware;
|
|
1836
|
+
}
|
|
1751
1837
|
accessory.context.deviceType = `IR: ${device.remoteType}`;
|
|
1752
1838
|
accessory.context.connectionType = device.connectionType;
|
|
1753
1839
|
// create the accessory handler for the newly create accessory
|
|
@@ -1774,7 +1860,9 @@ class SwitchBotPlatform {
|
|
|
1774
1860
|
existingAccessory.context.model = device.remoteType;
|
|
1775
1861
|
existingAccessory.context.deviceID = device.deviceId;
|
|
1776
1862
|
existingAccessory.displayName = device.configDeviceName || device.deviceName;
|
|
1777
|
-
|
|
1863
|
+
if (device.firmware) {
|
|
1864
|
+
existingAccessory.context.FirmwareRevision = device.firmware;
|
|
1865
|
+
}
|
|
1778
1866
|
existingAccessory.context.deviceType = `IR: ${device.remoteType}`;
|
|
1779
1867
|
this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} DeviceID: ${device.deviceId}`);
|
|
1780
1868
|
existingAccessory.context.connectionType = device.connectionType;
|
|
@@ -1800,7 +1888,9 @@ class SwitchBotPlatform {
|
|
|
1800
1888
|
accessory.context.device = device;
|
|
1801
1889
|
accessory.context.model = device.remoteType;
|
|
1802
1890
|
accessory.context.deviceID = device.deviceId;
|
|
1803
|
-
|
|
1891
|
+
if (device.firmware) {
|
|
1892
|
+
accessory.context.FirmwareRevision = device.firmware;
|
|
1893
|
+
}
|
|
1804
1894
|
accessory.context.deviceType = `IR: ${device.remoteType}`;
|
|
1805
1895
|
accessory.context.connectionType = device.connectionType;
|
|
1806
1896
|
// create the accessory handler for the newly create accessory
|
|
@@ -1827,7 +1917,9 @@ class SwitchBotPlatform {
|
|
|
1827
1917
|
existingAccessory.context.model = device.remoteType;
|
|
1828
1918
|
existingAccessory.context.deviceID = device.deviceId;
|
|
1829
1919
|
existingAccessory.displayName = device.configDeviceName || device.deviceName;
|
|
1830
|
-
|
|
1920
|
+
if (device.firmware) {
|
|
1921
|
+
existingAccessory.context.FirmwareRevision = device.firmware;
|
|
1922
|
+
}
|
|
1831
1923
|
existingAccessory.context.deviceType = `IR: ${device.remoteType}`;
|
|
1832
1924
|
this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} DeviceID: ${device.deviceId}`);
|
|
1833
1925
|
existingAccessory.context.connectionType = device.connectionType;
|
|
@@ -1853,7 +1945,9 @@ class SwitchBotPlatform {
|
|
|
1853
1945
|
accessory.context.device = device;
|
|
1854
1946
|
accessory.context.model = device.remoteType;
|
|
1855
1947
|
accessory.context.deviceID = device.deviceId;
|
|
1856
|
-
|
|
1948
|
+
if (device.firmware) {
|
|
1949
|
+
accessory.context.FirmwareRevision = device.firmware;
|
|
1950
|
+
}
|
|
1857
1951
|
accessory.context.deviceType = `IR: ${device.remoteType}`;
|
|
1858
1952
|
accessory.context.connectionType = device.connectionType;
|
|
1859
1953
|
// create the accessory handler for the newly create accessory
|
|
@@ -1880,7 +1974,9 @@ class SwitchBotPlatform {
|
|
|
1880
1974
|
existingAccessory.context.model = device.remoteType;
|
|
1881
1975
|
existingAccessory.context.deviceID = device.deviceId;
|
|
1882
1976
|
existingAccessory.displayName = device.configDeviceName || device.deviceName;
|
|
1883
|
-
|
|
1977
|
+
if (device.firmware) {
|
|
1978
|
+
existingAccessory.context.FirmwareRevision = device.firmware;
|
|
1979
|
+
}
|
|
1884
1980
|
existingAccessory.context.deviceType = `IR: ${device.remoteType}`;
|
|
1885
1981
|
this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} DeviceID: ${device.deviceId}`);
|
|
1886
1982
|
existingAccessory.context.connectionType = device.connectionType;
|
|
@@ -1906,7 +2002,9 @@ class SwitchBotPlatform {
|
|
|
1906
2002
|
accessory.context.device = device;
|
|
1907
2003
|
accessory.context.model = device.remoteType;
|
|
1908
2004
|
accessory.context.deviceID = device.deviceId;
|
|
1909
|
-
|
|
2005
|
+
if (device.firmware) {
|
|
2006
|
+
accessory.context.FirmwareRevision = device.firmware;
|
|
2007
|
+
}
|
|
1910
2008
|
accessory.context.deviceType = `IR: ${device.remoteType}`;
|
|
1911
2009
|
accessory.context.connectionType = device.connectionType;
|
|
1912
2010
|
// create the accessory handler for the newly create accessory
|