@switchbot/homebridge-switchbot 1.3.0 → 1.3.1-beta.3
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/config.schema.json +3 -3
- package/dist/devices/bots.d.ts.map +1 -1
- package/dist/devices/bots.js +24 -15
- package/dist/devices/bots.js.map +1 -1
- package/dist/devices/colorbulb.js +1 -1
- package/dist/devices/colorbulb.js.map +1 -1
- package/dist/devices/curtains.js +2 -2
- package/dist/devices/curtains.js.map +1 -1
- package/dist/devices/humidifiers.js +2 -2
- package/dist/devices/humidifiers.js.map +1 -1
- package/dist/devices/indoorcam.d.ts +32 -3
- package/dist/devices/indoorcam.d.ts.map +1 -1
- package/dist/devices/indoorcam.js +92 -45
- package/dist/devices/indoorcam.js.map +1 -1
- package/dist/devices/plugs.js +1 -1
- package/dist/devices/plugs.js.map +1 -1
- package/dist/irdevices/airconditioners.js +1 -1
- package/dist/irdevices/airconditioners.js.map +1 -1
- package/dist/irdevices/airpurifiers.js +1 -1
- package/dist/irdevices/airpurifiers.js.map +1 -1
- package/dist/irdevices/cameras.js +1 -1
- package/dist/irdevices/cameras.js.map +1 -1
- package/dist/irdevices/fans.js +1 -1
- package/dist/irdevices/fans.js.map +1 -1
- package/dist/irdevices/lights.js +1 -1
- package/dist/irdevices/lights.js.map +1 -1
- package/dist/irdevices/others.js +1 -1
- package/dist/irdevices/others.js.map +1 -1
- package/dist/irdevices/tvs.js +1 -1
- package/dist/irdevices/tvs.js.map +1 -1
- package/dist/irdevices/vacuumcleaners.js +1 -1
- package/dist/irdevices/vacuumcleaners.js.map +1 -1
- package/dist/irdevices/waterheaters.js +1 -1
- package/dist/irdevices/waterheaters.js.map +1 -1
- package/dist/platform.d.ts +2 -0
- package/dist/platform.d.ts.map +1 -1
- package/dist/platform.js +63 -21
- package/dist/platform.js.map +1 -1
- package/homebridge-ui/public/index.html +5 -1
- package/package.json +66 -66
- package/src/devices/bots.ts +34 -27
- package/src/devices/colorbulb.ts +1 -1
- package/src/devices/curtains.ts +2 -2
- package/src/devices/humidifiers.ts +2 -2
- package/src/devices/indoorcam.ts +117 -49
- package/src/devices/plugs.ts +1 -1
- package/src/irdevices/airconditioners.ts +1 -1
- package/src/irdevices/airpurifiers.ts +1 -1
- package/src/irdevices/cameras.ts +1 -1
- package/src/irdevices/fans.ts +1 -1
- package/src/irdevices/lights.ts +1 -1
- package/src/irdevices/others.ts +1 -1
- package/src/irdevices/tvs.ts +1 -1
- package/src/irdevices/vacuumcleaners.ts +1 -1
- package/src/irdevices/waterheaters.ts +1 -1
- package/src/platform.ts +72 -21
|
@@ -153,7 +153,7 @@ export class WaterHeater {
|
|
|
153
153
|
this.platform.log.error(`Water Heater: ${this.accessory.displayName} Device is offline.`);
|
|
154
154
|
break;
|
|
155
155
|
case 171:
|
|
156
|
-
this.platform.log.error(`Water Heater: ${this.accessory.displayName} Hub Device is offline
|
|
156
|
+
this.platform.log.error(`Water Heater: ${this.accessory.displayName} Hub Device is offline. Hub: ${this.device.hubDeviceId}`);
|
|
157
157
|
break;
|
|
158
158
|
case 190:
|
|
159
159
|
this.platform.log.error(`Water Heater: ${this.accessory.displayName} Device internal error due to device states not synchronized`
|
package/src/platform.ts
CHANGED
|
@@ -204,7 +204,8 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
204
204
|
|
|
205
205
|
const mergeBydeviceId = (a1: { deviceId: string; }[], a2: any[]) =>
|
|
206
206
|
a1.map((itm: { deviceId: string; }) => ({
|
|
207
|
-
...a2.find((item: { deviceId: string; }) => (
|
|
207
|
+
...a2.find((item: { deviceId: string; }) => (
|
|
208
|
+
item.deviceId.toUpperCase().replace(/[^A-Z0-9]+/g, '') === itm.deviceId.toUpperCase().replace(/[^A-Z0-9]+/g, '')) && item),
|
|
208
209
|
...itm,
|
|
209
210
|
}));
|
|
210
211
|
|
|
@@ -238,7 +239,8 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
238
239
|
|
|
239
240
|
const mergeIRBydeviceId = (a1: { deviceId: string; }[], a2: any[]) =>
|
|
240
241
|
a1.map((itm: { deviceId: string; }) => ({
|
|
241
|
-
...a2.find((item: { deviceId: string; }) => (
|
|
242
|
+
...a2.find((item: { deviceId: string; }) => (
|
|
243
|
+
item.deviceId.toUpperCase().replace(/[^A-Z0-9]+/g, '') === itm.deviceId.toUpperCase().replace(/[^A-Z0-9]+/g, '')) && item),
|
|
242
244
|
...itm,
|
|
243
245
|
}));
|
|
244
246
|
|
|
@@ -310,7 +312,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
310
312
|
this.debug(`Discovered ${device.deviceType}: ${device.deviceId}`);
|
|
311
313
|
this.createColorBulb(device);
|
|
312
314
|
break;
|
|
313
|
-
case '
|
|
315
|
+
case 'Indoor Cam':
|
|
314
316
|
this.debug(`Discovered ${device.deviceType}: ${device.deviceId}`);
|
|
315
317
|
this.createIndoorCam(device);
|
|
316
318
|
break;
|
|
@@ -420,6 +422,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
420
422
|
existingAccessory.context.deviceID = device.deviceId;
|
|
421
423
|
existingAccessory.displayName = device.deviceName;
|
|
422
424
|
existingAccessory.context.firmwareRevision = this.version;
|
|
425
|
+
existingAccessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
|
|
423
426
|
await this.connectionTypeExistingAccessory(device, existingAccessory);
|
|
424
427
|
this.api.updatePlatformAccessories([existingAccessory]);
|
|
425
428
|
// create the accessory handler for the restored accessory
|
|
@@ -442,6 +445,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
442
445
|
accessory.context.model = device.deviceType;
|
|
443
446
|
accessory.context.deviceID = device.deviceId;
|
|
444
447
|
accessory.context.firmwareRevision = this.version;
|
|
448
|
+
accessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
|
|
445
449
|
await this.connectionTypeNewAccessory(device, accessory);
|
|
446
450
|
// create the accessory handler for the newly create accessory
|
|
447
451
|
// this is imported from `platformAccessory.ts`
|
|
@@ -475,6 +479,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
475
479
|
existingAccessory.context.deviceID = device.deviceId;
|
|
476
480
|
existingAccessory.displayName = device.deviceName;
|
|
477
481
|
existingAccessory.context.firmwareRevision = this.version;
|
|
482
|
+
existingAccessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
|
|
478
483
|
await this.connectionTypeExistingAccessory(device, existingAccessory);
|
|
479
484
|
this.api.updatePlatformAccessories([existingAccessory]);
|
|
480
485
|
// create the accessory handler for the restored accessory
|
|
@@ -499,6 +504,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
499
504
|
accessory.context.model = device.deviceType;
|
|
500
505
|
accessory.context.deviceID = device.deviceId;
|
|
501
506
|
accessory.context.firmwareRevision = this.version;
|
|
507
|
+
accessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
|
|
502
508
|
await this.connectionTypeNewAccessory(device, accessory);
|
|
503
509
|
// accessory.context.firmwareRevision = findaccessories.accessoryAttribute.softwareRevision;
|
|
504
510
|
// create the accessory handler for the newly create accessory
|
|
@@ -531,6 +537,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
531
537
|
existingAccessory.context.deviceID = device.deviceId;
|
|
532
538
|
existingAccessory.displayName = device.deviceName;
|
|
533
539
|
existingAccessory.context.firmwareRevision = this.version;
|
|
540
|
+
existingAccessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
|
|
534
541
|
await this.connectionTypeExistingAccessory(device, existingAccessory);
|
|
535
542
|
this.api.updatePlatformAccessories([existingAccessory]);
|
|
536
543
|
// create the accessory handler for the restored accessory
|
|
@@ -553,6 +560,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
553
560
|
accessory.context.model = device.deviceType;
|
|
554
561
|
accessory.context.deviceID = device.deviceId;
|
|
555
562
|
accessory.context.firmwareRevision = this.version;
|
|
563
|
+
accessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
|
|
556
564
|
await this.connectionTypeNewAccessory(device, accessory);
|
|
557
565
|
// create the accessory handler for the newly create accessory
|
|
558
566
|
// this is imported from `platformAccessory.ts`
|
|
@@ -584,6 +592,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
584
592
|
existingAccessory.context.deviceID = device.deviceId;
|
|
585
593
|
existingAccessory.displayName = device.deviceName;
|
|
586
594
|
existingAccessory.context.firmwareRevision = this.version;
|
|
595
|
+
existingAccessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
|
|
587
596
|
await this.connectionTypeExistingAccessory(device, existingAccessory);
|
|
588
597
|
this.api.updatePlatformAccessories([existingAccessory]);
|
|
589
598
|
// create the accessory handler for the restored accessory
|
|
@@ -606,6 +615,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
606
615
|
accessory.context.model = device.deviceType;
|
|
607
616
|
accessory.context.deviceID = device.deviceId;
|
|
608
617
|
accessory.context.firmwareRevision = this.version;
|
|
618
|
+
accessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
|
|
609
619
|
await this.connectionTypeNewAccessory(device, accessory);
|
|
610
620
|
// create the accessory handler for the newly create accessory
|
|
611
621
|
// this is imported from `platformAccessory.ts`
|
|
@@ -637,6 +647,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
637
647
|
existingAccessory.context.deviceID = device.deviceId;
|
|
638
648
|
existingAccessory.displayName = device.deviceName;
|
|
639
649
|
existingAccessory.context.firmwareRevision = this.version;
|
|
650
|
+
existingAccessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
|
|
640
651
|
await this.connectionTypeExistingAccessory(device, existingAccessory);
|
|
641
652
|
this.api.updatePlatformAccessories([existingAccessory]);
|
|
642
653
|
// create the accessory handler for the restored accessory
|
|
@@ -659,6 +670,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
659
670
|
accessory.context.model = device.deviceType;
|
|
660
671
|
accessory.context.deviceID = device.deviceId;
|
|
661
672
|
accessory.context.firmwareRevision = this.version;
|
|
673
|
+
accessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
|
|
662
674
|
await this.connectionTypeNewAccessory(device, accessory);
|
|
663
675
|
// create the accessory handler for the newly create accessory
|
|
664
676
|
// this is imported from `platformAccessory.ts`
|
|
@@ -690,6 +702,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
690
702
|
existingAccessory.context.deviceID = device.deviceId;
|
|
691
703
|
existingAccessory.displayName = device.deviceName;
|
|
692
704
|
existingAccessory.context.firmwareRevision = this.version;
|
|
705
|
+
existingAccessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
|
|
693
706
|
await this.connectionTypeExistingAccessory(device, existingAccessory);
|
|
694
707
|
this.api.updatePlatformAccessories([existingAccessory]);
|
|
695
708
|
// create the accessory handler for the restored accessory
|
|
@@ -722,6 +735,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
722
735
|
accessory.context.model = device.deviceType;
|
|
723
736
|
accessory.context.deviceID = device.deviceId;
|
|
724
737
|
accessory.context.firmwareRevision = this.version;
|
|
738
|
+
accessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
|
|
725
739
|
await this.connectionTypeNewAccessory(device, accessory);
|
|
726
740
|
// create the accessory handler for the newly create accessory
|
|
727
741
|
// this is imported from `platformAccessory.ts`
|
|
@@ -766,6 +780,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
766
780
|
existingAccessory.context.deviceID = device.deviceId;
|
|
767
781
|
existingAccessory.displayName = device.deviceName;
|
|
768
782
|
existingAccessory.context.firmwareRevision = this.version;
|
|
783
|
+
existingAccessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
|
|
769
784
|
await this.connectionTypeExistingAccessory(device, existingAccessory);
|
|
770
785
|
this.api.updatePlatformAccessories([existingAccessory]);
|
|
771
786
|
// create the accessory handler for the restored accessory
|
|
@@ -788,6 +803,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
788
803
|
accessory.context.model = device.deviceType;
|
|
789
804
|
accessory.context.deviceID = device.deviceId;
|
|
790
805
|
accessory.context.firmwareRevision = this.version;
|
|
806
|
+
accessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
|
|
791
807
|
await this.connectionTypeNewAccessory(device, accessory);
|
|
792
808
|
// create the accessory handler for the newly create accessory
|
|
793
809
|
// this is imported from `platformAccessory.ts`
|
|
@@ -819,6 +835,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
819
835
|
existingAccessory.context.deviceID = device.deviceId;
|
|
820
836
|
existingAccessory.displayName = device.deviceName;
|
|
821
837
|
existingAccessory.context.firmwareRevision = this.version;
|
|
838
|
+
existingAccessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
|
|
822
839
|
await this.connectionTypeExistingAccessory(device, existingAccessory);
|
|
823
840
|
this.api.updatePlatformAccessories([existingAccessory]);
|
|
824
841
|
// create the accessory handler for the restored accessory
|
|
@@ -841,6 +858,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
841
858
|
accessory.context.model = device.deviceType;
|
|
842
859
|
accessory.context.deviceID = device.deviceId;
|
|
843
860
|
accessory.context.firmwareRevision = this.version;
|
|
861
|
+
accessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
|
|
844
862
|
await this.connectionTypeNewAccessory(device, accessory);
|
|
845
863
|
// create the accessory handler for the newly create accessory
|
|
846
864
|
// this is imported from `platformAccessory.ts`
|
|
@@ -872,6 +890,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
872
890
|
existingAccessory.context.deviceID = device.deviceId;
|
|
873
891
|
existingAccessory.displayName = device.deviceName;
|
|
874
892
|
existingAccessory.context.firmwareRevision = this.version;
|
|
893
|
+
existingAccessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
|
|
875
894
|
await this.connectionTypeExistingAccessory(device, existingAccessory);
|
|
876
895
|
this.api.updatePlatformAccessories([existingAccessory]);
|
|
877
896
|
// create the accessory handler for the restored accessory
|
|
@@ -894,6 +913,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
894
913
|
accessory.context.model = device.deviceType;
|
|
895
914
|
accessory.context.deviceID = device.deviceId;
|
|
896
915
|
accessory.context.firmwareRevision = this.version;
|
|
916
|
+
accessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
|
|
897
917
|
await this.connectionTypeNewAccessory(device, accessory);
|
|
898
918
|
// create the accessory handler for the newly create accessory
|
|
899
919
|
// this is imported from `platformAccessory.ts`
|
|
@@ -923,7 +943,8 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
923
943
|
existingAccessory.context.deviceID = device.deviceId;
|
|
924
944
|
existingAccessory.displayName = device.deviceName;
|
|
925
945
|
existingAccessory.context.firmwareRevision = this.version;
|
|
926
|
-
|
|
946
|
+
existingAccessory.context.deviceType = `IR: ${device.remoteType}`;
|
|
947
|
+
await this.connectionTypeExistingIRAccessory(device, existingAccessory);
|
|
927
948
|
this.api.updatePlatformAccessories([existingAccessory]);
|
|
928
949
|
// create the accessory handler for the restored accessory
|
|
929
950
|
// this is imported from `platformAccessory.ts`
|
|
@@ -942,7 +963,8 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
942
963
|
accessory.context.model = device.remoteType;
|
|
943
964
|
accessory.context.deviceID = device.deviceId;
|
|
944
965
|
accessory.context.firmwareRevision = this.version;
|
|
945
|
-
|
|
966
|
+
accessory.context.deviceType = `IR: ${device.remoteType}`;
|
|
967
|
+
await this.connectionTypeNewIRAccessory(device, accessory);
|
|
946
968
|
// create the accessory handler for the newly create accessory
|
|
947
969
|
// this is imported from `platformAccessory.ts`
|
|
948
970
|
new TV(this, accessory, device);
|
|
@@ -978,7 +1000,8 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
978
1000
|
existingAccessory.context.deviceID = device.deviceId;
|
|
979
1001
|
existingAccessory.displayName = device.deviceName;
|
|
980
1002
|
existingAccessory.context.firmwareRevision = this.version;
|
|
981
|
-
|
|
1003
|
+
existingAccessory.context.deviceType = `IR: ${device.remoteType}`;
|
|
1004
|
+
await this.connectionTypeExistingIRAccessory(device, existingAccessory);
|
|
982
1005
|
this.api.updatePlatformAccessories([existingAccessory]);
|
|
983
1006
|
// create the accessory handler for the restored accessory
|
|
984
1007
|
// this is imported from `platformAccessory.ts`
|
|
@@ -1000,7 +1023,8 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
1000
1023
|
accessory.context.model = device.remoteType;
|
|
1001
1024
|
accessory.context.deviceID = device.deviceId;
|
|
1002
1025
|
accessory.context.firmwareRevision = this.version;
|
|
1003
|
-
|
|
1026
|
+
accessory.context.deviceType = `IR: ${device.remoteType}`;
|
|
1027
|
+
await this.connectionTypeNewIRAccessory(device, accessory);
|
|
1004
1028
|
// create the accessory handler for the newly create accessory
|
|
1005
1029
|
// this is imported from `platformAccessory.ts`
|
|
1006
1030
|
new Fan(this, accessory, device);
|
|
@@ -1031,7 +1055,8 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
1031
1055
|
existingAccessory.context.deviceID = device.deviceId;
|
|
1032
1056
|
existingAccessory.displayName = device.deviceName;
|
|
1033
1057
|
existingAccessory.context.firmwareRevision = this.version;
|
|
1034
|
-
|
|
1058
|
+
existingAccessory.context.deviceType = `IR: ${device.remoteType}`;
|
|
1059
|
+
await this.connectionTypeExistingIRAccessory(device, existingAccessory);
|
|
1035
1060
|
this.api.updatePlatformAccessories([existingAccessory]);
|
|
1036
1061
|
// create the accessory handler for the restored accessory
|
|
1037
1062
|
// this is imported from `platformAccessory.ts`
|
|
@@ -1053,7 +1078,8 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
1053
1078
|
accessory.context.model = device.remoteType;
|
|
1054
1079
|
accessory.context.deviceID = device.deviceId;
|
|
1055
1080
|
accessory.context.firmwareRevision = this.version;
|
|
1056
|
-
|
|
1081
|
+
accessory.context.deviceType = `IR: ${device.remoteType}`;
|
|
1082
|
+
await this.connectionTypeNewIRAccessory(device, accessory);
|
|
1057
1083
|
// create the accessory handler for the newly create accessory
|
|
1058
1084
|
// this is imported from `platformAccessory.ts`
|
|
1059
1085
|
new Light(this, accessory, device);
|
|
@@ -1084,7 +1110,8 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
1084
1110
|
existingAccessory.context.deviceID = device.deviceId;
|
|
1085
1111
|
existingAccessory.displayName = device.deviceName;
|
|
1086
1112
|
existingAccessory.context.firmwareRevision = this.version;
|
|
1087
|
-
|
|
1113
|
+
existingAccessory.context.deviceType = `IR: ${device.remoteType}`;
|
|
1114
|
+
await this.connectionTypeExistingIRAccessory(device, existingAccessory);
|
|
1088
1115
|
this.api.updatePlatformAccessories([existingAccessory]);
|
|
1089
1116
|
// create the accessory handler for the restored accessory
|
|
1090
1117
|
// this is imported from `platformAccessory.ts`
|
|
@@ -1106,7 +1133,8 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
1106
1133
|
accessory.context.model = device.remoteType;
|
|
1107
1134
|
accessory.context.deviceID = device.deviceId;
|
|
1108
1135
|
accessory.context.firmwareRevision = this.version;
|
|
1109
|
-
|
|
1136
|
+
accessory.context.deviceType = `IR: ${device.remoteType}`;
|
|
1137
|
+
await this.connectionTypeNewIRAccessory(device, accessory);
|
|
1110
1138
|
// create the accessory handler for the newly create accessory
|
|
1111
1139
|
// this is imported from `platformAccessory.ts`
|
|
1112
1140
|
new AirConditioner(this, accessory, device);
|
|
@@ -1137,7 +1165,8 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
1137
1165
|
existingAccessory.context.deviceID = device.deviceId;
|
|
1138
1166
|
existingAccessory.displayName = device.deviceName;
|
|
1139
1167
|
existingAccessory.context.firmwareRevision = this.version;
|
|
1140
|
-
|
|
1168
|
+
existingAccessory.context.deviceType = `IR: ${device.remoteType}`;
|
|
1169
|
+
await this.connectionTypeExistingIRAccessory(device, existingAccessory);
|
|
1141
1170
|
this.api.updatePlatformAccessories([existingAccessory]);
|
|
1142
1171
|
// create the accessory handler for the restored accessory
|
|
1143
1172
|
// this is imported from `platformAccessory.ts`
|
|
@@ -1159,7 +1188,8 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
1159
1188
|
accessory.context.model = device.remoteType;
|
|
1160
1189
|
accessory.context.deviceID = device.deviceId;
|
|
1161
1190
|
accessory.context.firmwareRevision = this.version;
|
|
1162
|
-
|
|
1191
|
+
accessory.context.deviceType = `IR: ${device.remoteType}`;
|
|
1192
|
+
await this.connectionTypeNewIRAccessory(device, accessory);
|
|
1163
1193
|
// create the accessory handler for the newly create accessory
|
|
1164
1194
|
// this is imported from `platformAccessory.ts`
|
|
1165
1195
|
new AirPurifier(this, accessory, device);
|
|
@@ -1190,7 +1220,8 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
1190
1220
|
existingAccessory.context.deviceID = device.deviceId;
|
|
1191
1221
|
existingAccessory.displayName = device.deviceName;
|
|
1192
1222
|
existingAccessory.context.firmwareRevision = this.version;
|
|
1193
|
-
|
|
1223
|
+
existingAccessory.context.deviceType = `IR: ${device.remoteType}`;
|
|
1224
|
+
await this.connectionTypeExistingIRAccessory(device, existingAccessory);
|
|
1194
1225
|
this.api.updatePlatformAccessories([existingAccessory]);
|
|
1195
1226
|
// create the accessory handler for the restored accessory
|
|
1196
1227
|
// this is imported from `platformAccessory.ts`
|
|
@@ -1212,7 +1243,8 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
1212
1243
|
accessory.context.model = device.remoteType;
|
|
1213
1244
|
accessory.context.deviceID = device.deviceId;
|
|
1214
1245
|
accessory.context.firmwareRevision = this.version;
|
|
1215
|
-
|
|
1246
|
+
accessory.context.deviceType = `IR: ${device.remoteType}`;
|
|
1247
|
+
await this.connectionTypeNewIRAccessory(device, accessory);
|
|
1216
1248
|
// create the accessory handler for the newly create accessory
|
|
1217
1249
|
// this is imported from `platformAccessory.ts`
|
|
1218
1250
|
new WaterHeater(this, accessory, device);
|
|
@@ -1243,7 +1275,8 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
1243
1275
|
existingAccessory.context.deviceID = device.deviceId;
|
|
1244
1276
|
existingAccessory.displayName = device.deviceName;
|
|
1245
1277
|
existingAccessory.context.firmwareRevision = this.version;
|
|
1246
|
-
|
|
1278
|
+
existingAccessory.context.deviceType = `IR: ${device.remoteType}`;
|
|
1279
|
+
await this.connectionTypeExistingIRAccessory(device, existingAccessory);
|
|
1247
1280
|
this.api.updatePlatformAccessories([existingAccessory]);
|
|
1248
1281
|
// create the accessory handler for the restored accessory
|
|
1249
1282
|
// this is imported from `platformAccessory.ts`
|
|
@@ -1265,7 +1298,8 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
1265
1298
|
accessory.context.model = device.remoteType;
|
|
1266
1299
|
accessory.context.deviceID = device.deviceId;
|
|
1267
1300
|
accessory.context.firmwareRevision = this.version;
|
|
1268
|
-
|
|
1301
|
+
accessory.context.deviceType = `IR: ${device.remoteType}`;
|
|
1302
|
+
await this.connectionTypeNewIRAccessory(device, accessory);
|
|
1269
1303
|
// create the accessory handler for the newly create accessory
|
|
1270
1304
|
// this is imported from `platformAccessory.ts`
|
|
1271
1305
|
new VacuumCleaner(this, accessory, device);
|
|
@@ -1296,7 +1330,8 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
1296
1330
|
existingAccessory.context.deviceID = device.deviceId;
|
|
1297
1331
|
existingAccessory.displayName = device.deviceName;
|
|
1298
1332
|
existingAccessory.context.firmwareRevision = this.version;
|
|
1299
|
-
|
|
1333
|
+
existingAccessory.context.deviceType = `IR: ${device.remoteType}`;
|
|
1334
|
+
await this.connectionTypeExistingIRAccessory(device, existingAccessory);
|
|
1300
1335
|
this.api.updatePlatformAccessories([existingAccessory]);
|
|
1301
1336
|
// create the accessory handler for the restored accessory
|
|
1302
1337
|
// this is imported from `platformAccessory.ts`
|
|
@@ -1318,7 +1353,8 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
1318
1353
|
accessory.context.model = device.remoteType;
|
|
1319
1354
|
accessory.context.deviceID = device.deviceId;
|
|
1320
1355
|
accessory.context.firmwareRevision = this.version;
|
|
1321
|
-
|
|
1356
|
+
accessory.context.deviceType = `IR: ${device.remoteType}`;
|
|
1357
|
+
await this.connectionTypeNewIRAccessory(device, accessory);
|
|
1322
1358
|
// create the accessory handler for the newly create accessory
|
|
1323
1359
|
// this is imported from `platformAccessory.ts`
|
|
1324
1360
|
new Camera(this, accessory, device);
|
|
@@ -1349,7 +1385,8 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
1349
1385
|
existingAccessory.context.deviceID = device.deviceId;
|
|
1350
1386
|
existingAccessory.displayName = device.deviceName;
|
|
1351
1387
|
existingAccessory.context.firmwareRevision = this.version;
|
|
1352
|
-
|
|
1388
|
+
existingAccessory.context.deviceType = `IR: ${device.remoteType}`;
|
|
1389
|
+
await this.connectionTypeExistingIRAccessory(device, existingAccessory);
|
|
1353
1390
|
this.api.updatePlatformAccessories([existingAccessory]);
|
|
1354
1391
|
// create the accessory handler for the restored accessory
|
|
1355
1392
|
// this is imported from `platformAccessory.ts`
|
|
@@ -1371,7 +1408,8 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
1371
1408
|
accessory.context.model = device.remoteType;
|
|
1372
1409
|
accessory.context.deviceID = device.deviceId;
|
|
1373
1410
|
accessory.context.firmwareRevision = this.version;
|
|
1374
|
-
|
|
1411
|
+
accessory.context.deviceType = `IR: ${device.remoteType}`;
|
|
1412
|
+
await this.connectionTypeNewIRAccessory(device, accessory);
|
|
1375
1413
|
// create the accessory handler for the newly create accessory
|
|
1376
1414
|
// this is imported from `platformAccessory.ts`
|
|
1377
1415
|
new Others(this, accessory, device);
|
|
@@ -1406,6 +1444,19 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
1406
1444
|
}
|
|
1407
1445
|
}
|
|
1408
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
|
+
|
|
1409
1460
|
public unregisterPlatformAccessories(existingAccessory: PlatformAccessory) {
|
|
1410
1461
|
// remove platform accessories when no longer present
|
|
1411
1462
|
this.api.unregisterPlatformAccessories(PLUGIN_NAME, PLATFORM_NAME, [existingAccessory]);
|