@switchbot/homebridge-switchbot 1.3.1-beta.0 → 1.3.1-beta.4

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
@@ -422,6 +422,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
422
422
  existingAccessory.context.deviceID = device.deviceId;
423
423
  existingAccessory.displayName = device.deviceName;
424
424
  existingAccessory.context.firmwareRevision = this.version;
425
+ existingAccessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
425
426
  await this.connectionTypeExistingAccessory(device, existingAccessory);
426
427
  this.api.updatePlatformAccessories([existingAccessory]);
427
428
  // create the accessory handler for the restored accessory
@@ -444,6 +445,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
444
445
  accessory.context.model = device.deviceType;
445
446
  accessory.context.deviceID = device.deviceId;
446
447
  accessory.context.firmwareRevision = this.version;
448
+ accessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
447
449
  await this.connectionTypeNewAccessory(device, accessory);
448
450
  // create the accessory handler for the newly create accessory
449
451
  // this is imported from `platformAccessory.ts`
@@ -477,6 +479,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
477
479
  existingAccessory.context.deviceID = device.deviceId;
478
480
  existingAccessory.displayName = device.deviceName;
479
481
  existingAccessory.context.firmwareRevision = this.version;
482
+ existingAccessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
480
483
  await this.connectionTypeExistingAccessory(device, existingAccessory);
481
484
  this.api.updatePlatformAccessories([existingAccessory]);
482
485
  // create the accessory handler for the restored accessory
@@ -501,6 +504,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
501
504
  accessory.context.model = device.deviceType;
502
505
  accessory.context.deviceID = device.deviceId;
503
506
  accessory.context.firmwareRevision = this.version;
507
+ accessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
504
508
  await this.connectionTypeNewAccessory(device, accessory);
505
509
  // accessory.context.firmwareRevision = findaccessories.accessoryAttribute.softwareRevision;
506
510
  // create the accessory handler for the newly create accessory
@@ -533,6 +537,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
533
537
  existingAccessory.context.deviceID = device.deviceId;
534
538
  existingAccessory.displayName = device.deviceName;
535
539
  existingAccessory.context.firmwareRevision = this.version;
540
+ existingAccessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
536
541
  await this.connectionTypeExistingAccessory(device, existingAccessory);
537
542
  this.api.updatePlatformAccessories([existingAccessory]);
538
543
  // create the accessory handler for the restored accessory
@@ -555,6 +560,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
555
560
  accessory.context.model = device.deviceType;
556
561
  accessory.context.deviceID = device.deviceId;
557
562
  accessory.context.firmwareRevision = this.version;
563
+ accessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
558
564
  await this.connectionTypeNewAccessory(device, accessory);
559
565
  // create the accessory handler for the newly create accessory
560
566
  // this is imported from `platformAccessory.ts`
@@ -586,6 +592,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
586
592
  existingAccessory.context.deviceID = device.deviceId;
587
593
  existingAccessory.displayName = device.deviceName;
588
594
  existingAccessory.context.firmwareRevision = this.version;
595
+ existingAccessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
589
596
  await this.connectionTypeExistingAccessory(device, existingAccessory);
590
597
  this.api.updatePlatformAccessories([existingAccessory]);
591
598
  // create the accessory handler for the restored accessory
@@ -608,6 +615,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
608
615
  accessory.context.model = device.deviceType;
609
616
  accessory.context.deviceID = device.deviceId;
610
617
  accessory.context.firmwareRevision = this.version;
618
+ accessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
611
619
  await this.connectionTypeNewAccessory(device, accessory);
612
620
  // create the accessory handler for the newly create accessory
613
621
  // this is imported from `platformAccessory.ts`
@@ -639,6 +647,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
639
647
  existingAccessory.context.deviceID = device.deviceId;
640
648
  existingAccessory.displayName = device.deviceName;
641
649
  existingAccessory.context.firmwareRevision = this.version;
650
+ existingAccessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
642
651
  await this.connectionTypeExistingAccessory(device, existingAccessory);
643
652
  this.api.updatePlatformAccessories([existingAccessory]);
644
653
  // create the accessory handler for the restored accessory
@@ -661,6 +670,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
661
670
  accessory.context.model = device.deviceType;
662
671
  accessory.context.deviceID = device.deviceId;
663
672
  accessory.context.firmwareRevision = this.version;
673
+ accessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
664
674
  await this.connectionTypeNewAccessory(device, accessory);
665
675
  // create the accessory handler for the newly create accessory
666
676
  // this is imported from `platformAccessory.ts`
@@ -692,6 +702,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
692
702
  existingAccessory.context.deviceID = device.deviceId;
693
703
  existingAccessory.displayName = device.deviceName;
694
704
  existingAccessory.context.firmwareRevision = this.version;
705
+ existingAccessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
695
706
  await this.connectionTypeExistingAccessory(device, existingAccessory);
696
707
  this.api.updatePlatformAccessories([existingAccessory]);
697
708
  // create the accessory handler for the restored accessory
@@ -724,6 +735,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
724
735
  accessory.context.model = device.deviceType;
725
736
  accessory.context.deviceID = device.deviceId;
726
737
  accessory.context.firmwareRevision = this.version;
738
+ accessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
727
739
  await this.connectionTypeNewAccessory(device, accessory);
728
740
  // create the accessory handler for the newly create accessory
729
741
  // this is imported from `platformAccessory.ts`
@@ -768,6 +780,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
768
780
  existingAccessory.context.deviceID = device.deviceId;
769
781
  existingAccessory.displayName = device.deviceName;
770
782
  existingAccessory.context.firmwareRevision = this.version;
783
+ existingAccessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
771
784
  await this.connectionTypeExistingAccessory(device, existingAccessory);
772
785
  this.api.updatePlatformAccessories([existingAccessory]);
773
786
  // create the accessory handler for the restored accessory
@@ -790,6 +803,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
790
803
  accessory.context.model = device.deviceType;
791
804
  accessory.context.deviceID = device.deviceId;
792
805
  accessory.context.firmwareRevision = this.version;
806
+ accessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
793
807
  await this.connectionTypeNewAccessory(device, accessory);
794
808
  // create the accessory handler for the newly create accessory
795
809
  // this is imported from `platformAccessory.ts`
@@ -821,6 +835,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
821
835
  existingAccessory.context.deviceID = device.deviceId;
822
836
  existingAccessory.displayName = device.deviceName;
823
837
  existingAccessory.context.firmwareRevision = this.version;
838
+ existingAccessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
824
839
  await this.connectionTypeExistingAccessory(device, existingAccessory);
825
840
  this.api.updatePlatformAccessories([existingAccessory]);
826
841
  // create the accessory handler for the restored accessory
@@ -843,6 +858,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
843
858
  accessory.context.model = device.deviceType;
844
859
  accessory.context.deviceID = device.deviceId;
845
860
  accessory.context.firmwareRevision = this.version;
861
+ accessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
846
862
  await this.connectionTypeNewAccessory(device, accessory);
847
863
  // create the accessory handler for the newly create accessory
848
864
  // this is imported from `platformAccessory.ts`
@@ -874,6 +890,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
874
890
  existingAccessory.context.deviceID = device.deviceId;
875
891
  existingAccessory.displayName = device.deviceName;
876
892
  existingAccessory.context.firmwareRevision = this.version;
893
+ existingAccessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
877
894
  await this.connectionTypeExistingAccessory(device, existingAccessory);
878
895
  this.api.updatePlatformAccessories([existingAccessory]);
879
896
  // create the accessory handler for the restored accessory
@@ -896,6 +913,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
896
913
  accessory.context.model = device.deviceType;
897
914
  accessory.context.deviceID = device.deviceId;
898
915
  accessory.context.firmwareRevision = this.version;
916
+ accessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
899
917
  await this.connectionTypeNewAccessory(device, accessory);
900
918
  // create the accessory handler for the newly create accessory
901
919
  // this is imported from `platformAccessory.ts`
@@ -925,7 +943,8 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
925
943
  existingAccessory.context.deviceID = device.deviceId;
926
944
  existingAccessory.displayName = device.deviceName;
927
945
  existingAccessory.context.firmwareRevision = this.version;
928
- await this.connectionTypeExistingAccessory(device, existingAccessory);
946
+ existingAccessory.context.deviceType = `IR: ${device.remoteType}`;
947
+ await this.connectionTypeExistingIRAccessory(device, existingAccessory);
929
948
  this.api.updatePlatformAccessories([existingAccessory]);
930
949
  // create the accessory handler for the restored accessory
931
950
  // this is imported from `platformAccessory.ts`
@@ -944,7 +963,8 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
944
963
  accessory.context.model = device.remoteType;
945
964
  accessory.context.deviceID = device.deviceId;
946
965
  accessory.context.firmwareRevision = this.version;
947
- await this.connectionTypeNewAccessory(device, accessory);
966
+ accessory.context.deviceType = `IR: ${device.remoteType}`;
967
+ await this.connectionTypeNewIRAccessory(device, accessory);
948
968
  // create the accessory handler for the newly create accessory
949
969
  // this is imported from `platformAccessory.ts`
950
970
  new TV(this, accessory, device);
@@ -980,7 +1000,8 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
980
1000
  existingAccessory.context.deviceID = device.deviceId;
981
1001
  existingAccessory.displayName = device.deviceName;
982
1002
  existingAccessory.context.firmwareRevision = this.version;
983
- await this.connectionTypeExistingAccessory(device, existingAccessory);
1003
+ existingAccessory.context.deviceType = `IR: ${device.remoteType}`;
1004
+ await this.connectionTypeExistingIRAccessory(device, existingAccessory);
984
1005
  this.api.updatePlatformAccessories([existingAccessory]);
985
1006
  // create the accessory handler for the restored accessory
986
1007
  // this is imported from `platformAccessory.ts`
@@ -1002,7 +1023,8 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
1002
1023
  accessory.context.model = device.remoteType;
1003
1024
  accessory.context.deviceID = device.deviceId;
1004
1025
  accessory.context.firmwareRevision = this.version;
1005
- await this.connectionTypeNewAccessory(device, accessory);
1026
+ accessory.context.deviceType = `IR: ${device.remoteType}`;
1027
+ await this.connectionTypeNewIRAccessory(device, accessory);
1006
1028
  // create the accessory handler for the newly create accessory
1007
1029
  // this is imported from `platformAccessory.ts`
1008
1030
  new Fan(this, accessory, device);
@@ -1033,7 +1055,8 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
1033
1055
  existingAccessory.context.deviceID = device.deviceId;
1034
1056
  existingAccessory.displayName = device.deviceName;
1035
1057
  existingAccessory.context.firmwareRevision = this.version;
1036
- await this.connectionTypeExistingAccessory(device, existingAccessory);
1058
+ existingAccessory.context.deviceType = `IR: ${device.remoteType}`;
1059
+ await this.connectionTypeExistingIRAccessory(device, existingAccessory);
1037
1060
  this.api.updatePlatformAccessories([existingAccessory]);
1038
1061
  // create the accessory handler for the restored accessory
1039
1062
  // this is imported from `platformAccessory.ts`
@@ -1055,7 +1078,8 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
1055
1078
  accessory.context.model = device.remoteType;
1056
1079
  accessory.context.deviceID = device.deviceId;
1057
1080
  accessory.context.firmwareRevision = this.version;
1058
- await this.connectionTypeNewAccessory(device, accessory);
1081
+ accessory.context.deviceType = `IR: ${device.remoteType}`;
1082
+ await this.connectionTypeNewIRAccessory(device, accessory);
1059
1083
  // create the accessory handler for the newly create accessory
1060
1084
  // this is imported from `platformAccessory.ts`
1061
1085
  new Light(this, accessory, device);
@@ -1086,7 +1110,8 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
1086
1110
  existingAccessory.context.deviceID = device.deviceId;
1087
1111
  existingAccessory.displayName = device.deviceName;
1088
1112
  existingAccessory.context.firmwareRevision = this.version;
1089
- await this.connectionTypeExistingAccessory(device, existingAccessory);
1113
+ existingAccessory.context.deviceType = `IR: ${device.remoteType}`;
1114
+ await this.connectionTypeExistingIRAccessory(device, existingAccessory);
1090
1115
  this.api.updatePlatformAccessories([existingAccessory]);
1091
1116
  // create the accessory handler for the restored accessory
1092
1117
  // this is imported from `platformAccessory.ts`
@@ -1108,7 +1133,8 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
1108
1133
  accessory.context.model = device.remoteType;
1109
1134
  accessory.context.deviceID = device.deviceId;
1110
1135
  accessory.context.firmwareRevision = this.version;
1111
- await this.connectionTypeNewAccessory(device, accessory);
1136
+ accessory.context.deviceType = `IR: ${device.remoteType}`;
1137
+ await this.connectionTypeNewIRAccessory(device, accessory);
1112
1138
  // create the accessory handler for the newly create accessory
1113
1139
  // this is imported from `platformAccessory.ts`
1114
1140
  new AirConditioner(this, accessory, device);
@@ -1139,7 +1165,8 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
1139
1165
  existingAccessory.context.deviceID = device.deviceId;
1140
1166
  existingAccessory.displayName = device.deviceName;
1141
1167
  existingAccessory.context.firmwareRevision = this.version;
1142
- await this.connectionTypeExistingAccessory(device, existingAccessory);
1168
+ existingAccessory.context.deviceType = `IR: ${device.remoteType}`;
1169
+ await this.connectionTypeExistingIRAccessory(device, existingAccessory);
1143
1170
  this.api.updatePlatformAccessories([existingAccessory]);
1144
1171
  // create the accessory handler for the restored accessory
1145
1172
  // this is imported from `platformAccessory.ts`
@@ -1161,7 +1188,8 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
1161
1188
  accessory.context.model = device.remoteType;
1162
1189
  accessory.context.deviceID = device.deviceId;
1163
1190
  accessory.context.firmwareRevision = this.version;
1164
- await this.connectionTypeNewAccessory(device, accessory);
1191
+ accessory.context.deviceType = `IR: ${device.remoteType}`;
1192
+ await this.connectionTypeNewIRAccessory(device, accessory);
1165
1193
  // create the accessory handler for the newly create accessory
1166
1194
  // this is imported from `platformAccessory.ts`
1167
1195
  new AirPurifier(this, accessory, device);
@@ -1192,7 +1220,8 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
1192
1220
  existingAccessory.context.deviceID = device.deviceId;
1193
1221
  existingAccessory.displayName = device.deviceName;
1194
1222
  existingAccessory.context.firmwareRevision = this.version;
1195
- await this.connectionTypeExistingAccessory(device, existingAccessory);
1223
+ existingAccessory.context.deviceType = `IR: ${device.remoteType}`;
1224
+ await this.connectionTypeExistingIRAccessory(device, existingAccessory);
1196
1225
  this.api.updatePlatformAccessories([existingAccessory]);
1197
1226
  // create the accessory handler for the restored accessory
1198
1227
  // this is imported from `platformAccessory.ts`
@@ -1214,7 +1243,8 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
1214
1243
  accessory.context.model = device.remoteType;
1215
1244
  accessory.context.deviceID = device.deviceId;
1216
1245
  accessory.context.firmwareRevision = this.version;
1217
- await this.connectionTypeNewAccessory(device, accessory);
1246
+ accessory.context.deviceType = `IR: ${device.remoteType}`;
1247
+ await this.connectionTypeNewIRAccessory(device, accessory);
1218
1248
  // create the accessory handler for the newly create accessory
1219
1249
  // this is imported from `platformAccessory.ts`
1220
1250
  new WaterHeater(this, accessory, device);
@@ -1245,7 +1275,8 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
1245
1275
  existingAccessory.context.deviceID = device.deviceId;
1246
1276
  existingAccessory.displayName = device.deviceName;
1247
1277
  existingAccessory.context.firmwareRevision = this.version;
1248
- await this.connectionTypeExistingAccessory(device, existingAccessory);
1278
+ existingAccessory.context.deviceType = `IR: ${device.remoteType}`;
1279
+ await this.connectionTypeExistingIRAccessory(device, existingAccessory);
1249
1280
  this.api.updatePlatformAccessories([existingAccessory]);
1250
1281
  // create the accessory handler for the restored accessory
1251
1282
  // this is imported from `platformAccessory.ts`
@@ -1267,7 +1298,8 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
1267
1298
  accessory.context.model = device.remoteType;
1268
1299
  accessory.context.deviceID = device.deviceId;
1269
1300
  accessory.context.firmwareRevision = this.version;
1270
- await this.connectionTypeNewAccessory(device, accessory);
1301
+ accessory.context.deviceType = `IR: ${device.remoteType}`;
1302
+ await this.connectionTypeNewIRAccessory(device, accessory);
1271
1303
  // create the accessory handler for the newly create accessory
1272
1304
  // this is imported from `platformAccessory.ts`
1273
1305
  new VacuumCleaner(this, accessory, device);
@@ -1298,7 +1330,8 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
1298
1330
  existingAccessory.context.deviceID = device.deviceId;
1299
1331
  existingAccessory.displayName = device.deviceName;
1300
1332
  existingAccessory.context.firmwareRevision = this.version;
1301
- await this.connectionTypeExistingAccessory(device, existingAccessory);
1333
+ existingAccessory.context.deviceType = `IR: ${device.remoteType}`;
1334
+ await this.connectionTypeExistingIRAccessory(device, existingAccessory);
1302
1335
  this.api.updatePlatformAccessories([existingAccessory]);
1303
1336
  // create the accessory handler for the restored accessory
1304
1337
  // this is imported from `platformAccessory.ts`
@@ -1320,7 +1353,8 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
1320
1353
  accessory.context.model = device.remoteType;
1321
1354
  accessory.context.deviceID = device.deviceId;
1322
1355
  accessory.context.firmwareRevision = this.version;
1323
- await this.connectionTypeNewAccessory(device, accessory);
1356
+ accessory.context.deviceType = `IR: ${device.remoteType}`;
1357
+ await this.connectionTypeNewIRAccessory(device, accessory);
1324
1358
  // create the accessory handler for the newly create accessory
1325
1359
  // this is imported from `platformAccessory.ts`
1326
1360
  new Camera(this, accessory, device);
@@ -1351,7 +1385,8 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
1351
1385
  existingAccessory.context.deviceID = device.deviceId;
1352
1386
  existingAccessory.displayName = device.deviceName;
1353
1387
  existingAccessory.context.firmwareRevision = this.version;
1354
- await this.connectionTypeExistingAccessory(device, existingAccessory);
1388
+ existingAccessory.context.deviceType = `IR: ${device.remoteType}`;
1389
+ await this.connectionTypeExistingIRAccessory(device, existingAccessory);
1355
1390
  this.api.updatePlatformAccessories([existingAccessory]);
1356
1391
  // create the accessory handler for the restored accessory
1357
1392
  // this is imported from `platformAccessory.ts`
@@ -1373,7 +1408,8 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
1373
1408
  accessory.context.model = device.remoteType;
1374
1409
  accessory.context.deviceID = device.deviceId;
1375
1410
  accessory.context.firmwareRevision = this.version;
1376
- await this.connectionTypeNewAccessory(device, accessory);
1411
+ accessory.context.deviceType = `IR: ${device.remoteType}`;
1412
+ await this.connectionTypeNewIRAccessory(device, accessory);
1377
1413
  // create the accessory handler for the newly create accessory
1378
1414
  // this is imported from `platformAccessory.ts`
1379
1415
  new Others(this, accessory, device);
@@ -1408,6 +1444,19 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
1408
1444
  }
1409
1445
  }
1410
1446
 
1447
+ public async connectionTypeNewIRAccessory(
1448
+ device: irdevice & devicesConfig,
1449
+ accessory: PlatformAccessory) {
1450
+ accessory.context.connectionType = 'IR wirth OpenAPI';
1451
+ }
1452
+
1453
+ public async connectionTypeExistingIRAccessory(
1454
+ device: irdevice & devicesConfig,
1455
+ existingAccessory: PlatformAccessory,
1456
+ ) {
1457
+ existingAccessory.context.connectionType = 'IR with OpenAPI';
1458
+ }
1459
+
1411
1460
  public unregisterPlatformAccessories(existingAccessory: PlatformAccessory) {
1412
1461
  // remove platform accessories when no longer present
1413
1462
  this.api.unregisterPlatformAccessories(PLUGIN_NAME, PLATFORM_NAME, [existingAccessory]);