@switchbot/homebridge-switchbot 2.0.0-beta.21 → 2.0.0-beta.22
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 +4 -4
- package/dist/device/bot.d.ts +0 -1
- package/dist/device/bot.d.ts.map +1 -1
- package/dist/device/bot.js +8 -10
- package/dist/device/bot.js.map +1 -1
- package/dist/device/colorbulb.d.ts +0 -1
- package/dist/device/colorbulb.d.ts.map +1 -1
- package/dist/device/colorbulb.js +6 -9
- package/dist/device/colorbulb.js.map +1 -1
- package/dist/device/contact.d.ts +0 -1
- package/dist/device/contact.d.ts.map +1 -1
- package/dist/device/contact.js +6 -8
- package/dist/device/contact.js.map +1 -1
- package/dist/device/curtain.d.ts +0 -1
- package/dist/device/curtain.d.ts.map +1 -1
- package/dist/device/curtain.js +7 -9
- package/dist/device/curtain.js.map +1 -1
- package/dist/device/humidifier.d.ts +0 -1
- package/dist/device/humidifier.d.ts.map +1 -1
- package/dist/device/humidifier.js +7 -9
- package/dist/device/humidifier.js.map +1 -1
- package/dist/device/lock.d.ts +1 -0
- package/dist/device/lock.d.ts.map +1 -1
- package/dist/device/lock.js +26 -7
- package/dist/device/lock.js.map +1 -1
- package/dist/device/meter.d.ts +0 -1
- package/dist/device/meter.d.ts.map +1 -1
- package/dist/device/meter.js +6 -8
- package/dist/device/meter.js.map +1 -1
- package/dist/device/meterplus.d.ts +0 -1
- package/dist/device/meterplus.d.ts.map +1 -1
- package/dist/device/meterplus.js +4 -6
- package/dist/device/meterplus.js.map +1 -1
- package/dist/device/motion.d.ts +0 -1
- package/dist/device/motion.d.ts.map +1 -1
- package/dist/device/motion.js +6 -8
- package/dist/device/motion.js.map +1 -1
- package/dist/device/plug.d.ts +0 -1
- package/dist/device/plug.d.ts.map +1 -1
- package/dist/device/plug.js +7 -9
- package/dist/device/plug.js.map +1 -1
- package/dist/device/striplight.d.ts +2 -1
- package/dist/device/striplight.d.ts.map +1 -1
- package/dist/device/striplight.js +73 -68
- package/dist/device/striplight.js.map +1 -1
- package/dist/platform.d.ts +2 -3
- package/dist/platform.d.ts.map +1 -1
- package/dist/platform.js +68 -70
- package/dist/platform.js.map +1 -1
- package/package.json +2 -2
- package/src/device/bot.ts +8 -11
- package/src/device/colorbulb.ts +6 -10
- package/src/device/contact.ts +6 -9
- package/src/device/curtain.ts +7 -10
- package/src/device/humidifier.ts +7 -10
- package/src/device/lock.ts +27 -7
- package/src/device/meter.ts +6 -9
- package/src/device/meterplus.ts +4 -7
- package/src/device/motion.ts +6 -9
- package/src/device/plug.ts +7 -10
- package/src/device/striplight.ts +33 -24
- package/src/platform.ts +68 -71
package/src/platform.ts
CHANGED
|
@@ -610,7 +610,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
610
610
|
|
|
611
611
|
if (existingAccessory) {
|
|
612
612
|
// the accessory already exists
|
|
613
|
-
if (this.registerDevice(device)) {
|
|
613
|
+
if (await this.registerDevice(device)) {
|
|
614
614
|
// if you need to update the accessory.context then you should run `api.updatePlatformAccessories`. eg.:
|
|
615
615
|
existingAccessory.context.model = device.deviceType;
|
|
616
616
|
existingAccessory.context.deviceID = device.deviceId;
|
|
@@ -618,7 +618,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
618
618
|
existingAccessory.context.firmwareRevision = device.firmware;
|
|
619
619
|
existingAccessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
|
|
620
620
|
this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} DeviceID: ${device.deviceId}`);
|
|
621
|
-
existingAccessory.context.connectionType = await this.
|
|
621
|
+
existingAccessory.context.connectionType = await this.connectionType(device);
|
|
622
622
|
this.api.updatePlatformAccessories([existingAccessory]);
|
|
623
623
|
// create the accessory handler for the restored accessory
|
|
624
624
|
// this is imported from `platformAccessory.ts`
|
|
@@ -627,7 +627,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
627
627
|
} else {
|
|
628
628
|
this.unregisterPlatformAccessories(existingAccessory);
|
|
629
629
|
}
|
|
630
|
-
} else if (this.registerDevice(device)) {
|
|
630
|
+
} else if (await this.registerDevice(device)) {
|
|
631
631
|
// the accessory does not yet exist, so we need to create it
|
|
632
632
|
this.infoLog(`Adding new accessory: ${device.deviceName} ${device.deviceType} DeviceID: ${device.deviceId}`);
|
|
633
633
|
|
|
@@ -641,7 +641,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
641
641
|
accessory.context.deviceID = device.deviceId;
|
|
642
642
|
accessory.context.firmwareRevision = device.firmware;
|
|
643
643
|
accessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
|
|
644
|
-
accessory.context.connectionType = await this.
|
|
644
|
+
accessory.context.connectionType = await this.connectionType(device);
|
|
645
645
|
// create the accessory handler for the newly create accessory
|
|
646
646
|
// this is imported from `platformAccessory.ts`
|
|
647
647
|
new Humidifier(this, accessory, device);
|
|
@@ -664,7 +664,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
664
664
|
|
|
665
665
|
if (existingAccessory) {
|
|
666
666
|
// the accessory already exists
|
|
667
|
-
if (this.registerDevice(device)) {
|
|
667
|
+
if (await this.registerDevice(device)) {
|
|
668
668
|
|
|
669
669
|
this.debugLog(superStringify(device.bot?.mode));
|
|
670
670
|
// if you need to update the accessory.context then you should run `api.updatePlatformAccessories`. eg.:
|
|
@@ -674,7 +674,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
674
674
|
existingAccessory.context.firmwareRevision = device.firmware;
|
|
675
675
|
existingAccessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
|
|
676
676
|
this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} DeviceID: ${device.deviceId}`);
|
|
677
|
-
existingAccessory.context.connectionType = await this.
|
|
677
|
+
existingAccessory.context.connectionType = await this.connectionType(device);
|
|
678
678
|
this.api.updatePlatformAccessories([existingAccessory]);
|
|
679
679
|
// create the accessory handler for the restored accessory
|
|
680
680
|
// this is imported from `platformAccessory.ts`
|
|
@@ -683,7 +683,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
683
683
|
} else {
|
|
684
684
|
this.unregisterPlatformAccessories(existingAccessory);
|
|
685
685
|
}
|
|
686
|
-
} else if (this.registerDevice(device)) {
|
|
686
|
+
} else if (await this.registerDevice(device)) {
|
|
687
687
|
// the accessory does not yet exist, so we need to create it
|
|
688
688
|
this.infoLog(`Adding new accessory: ${device.deviceName} ${device.deviceType} DeviceID: ${device.deviceId}`);
|
|
689
689
|
|
|
@@ -699,7 +699,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
699
699
|
accessory.context.deviceID = device.deviceId;
|
|
700
700
|
accessory.context.firmwareRevision = device.firmware;
|
|
701
701
|
accessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
|
|
702
|
-
accessory.context.connectionType = await this.
|
|
702
|
+
accessory.context.connectionType = await this.connectionType(device);
|
|
703
703
|
// accessory.context.firmwareRevision = findaccessories.accessoryAttribute.softwareRevision;
|
|
704
704
|
// create the accessory handler for the newly create accessory
|
|
705
705
|
// this is imported from `platformAccessory.ts`
|
|
@@ -723,7 +723,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
723
723
|
|
|
724
724
|
if (existingAccessory) {
|
|
725
725
|
// the accessory already exists
|
|
726
|
-
if (this.registerDevice(device)) {
|
|
726
|
+
if (await this.registerDevice(device)) {
|
|
727
727
|
// if you need to update the accessory.context then you should run `api.updatePlatformAccessories`. eg.:
|
|
728
728
|
existingAccessory.context.model = device.deviceType;
|
|
729
729
|
existingAccessory.context.deviceID = device.deviceId;
|
|
@@ -731,7 +731,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
731
731
|
existingAccessory.context.firmwareRevision = device.firmware;
|
|
732
732
|
existingAccessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
|
|
733
733
|
this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} DeviceID: ${device.deviceId}`);
|
|
734
|
-
existingAccessory.context.connectionType = await this.
|
|
734
|
+
existingAccessory.context.connectionType = await this.connectionType(device);
|
|
735
735
|
this.api.updatePlatformAccessories([existingAccessory]);
|
|
736
736
|
// create the accessory handler for the restored accessory
|
|
737
737
|
// this is imported from `platformAccessory.ts`
|
|
@@ -740,7 +740,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
740
740
|
} else {
|
|
741
741
|
this.unregisterPlatformAccessories(existingAccessory);
|
|
742
742
|
}
|
|
743
|
-
} else if (this.registerDevice(device)) {
|
|
743
|
+
} else if (await this.registerDevice(device)) {
|
|
744
744
|
// the accessory does not yet exist, so we need to create it
|
|
745
745
|
this.infoLog(`Adding new accessory: ${device.deviceName} ${device.deviceType} DeviceID: ${device.deviceId}`);
|
|
746
746
|
|
|
@@ -754,7 +754,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
754
754
|
accessory.context.deviceID = device.deviceId;
|
|
755
755
|
accessory.context.firmwareRevision = device.firmware;
|
|
756
756
|
accessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
|
|
757
|
-
accessory.context.connectionType = await this.
|
|
757
|
+
accessory.context.connectionType = await this.connectionType(device);
|
|
758
758
|
// create the accessory handler for the newly create accessory
|
|
759
759
|
// this is imported from `platformAccessory.ts`
|
|
760
760
|
new Meter(this, accessory, device);
|
|
@@ -777,7 +777,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
777
777
|
|
|
778
778
|
if (existingAccessory) {
|
|
779
779
|
// the accessory already exists
|
|
780
|
-
if (this.registerDevice(device)) {
|
|
780
|
+
if (await this.registerDevice(device)) {
|
|
781
781
|
// if you need to update the accessory.context then you should run `api.updatePlatformAccessories`. eg.:
|
|
782
782
|
existingAccessory.context.model = device.deviceType;
|
|
783
783
|
existingAccessory.context.deviceID = device.deviceId;
|
|
@@ -785,7 +785,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
785
785
|
existingAccessory.context.firmwareRevision = device.firmware;
|
|
786
786
|
existingAccessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
|
|
787
787
|
this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} DeviceID: ${device.deviceId}`);
|
|
788
|
-
existingAccessory.context.connectionType = await this.
|
|
788
|
+
existingAccessory.context.connectionType = await this.connectionType(device);
|
|
789
789
|
this.api.updatePlatformAccessories([existingAccessory]);
|
|
790
790
|
// create the accessory handler for the restored accessory
|
|
791
791
|
// this is imported from `platformAccessory.ts`
|
|
@@ -794,7 +794,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
794
794
|
} else {
|
|
795
795
|
this.unregisterPlatformAccessories(existingAccessory);
|
|
796
796
|
}
|
|
797
|
-
} else if (this.registerDevice(device)) {
|
|
797
|
+
} else if (await this.registerDevice(device)) {
|
|
798
798
|
// the accessory does not yet exist, so we need to create it
|
|
799
799
|
this.infoLog(`Adding new accessory: ${device.deviceName} ${device.deviceType} DeviceID: ${device.deviceId}`);
|
|
800
800
|
|
|
@@ -808,7 +808,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
808
808
|
accessory.context.deviceID = device.deviceId;
|
|
809
809
|
accessory.context.firmwareRevision = device.firmware;
|
|
810
810
|
accessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
|
|
811
|
-
accessory.context.connectionType = await this.
|
|
811
|
+
accessory.context.connectionType = await this.connectionType(device);
|
|
812
812
|
// create the accessory handler for the newly create accessory
|
|
813
813
|
// this is imported from `platformAccessory.ts`
|
|
814
814
|
new MeterPlus(this, accessory, device);
|
|
@@ -831,7 +831,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
831
831
|
|
|
832
832
|
if (existingAccessory) {
|
|
833
833
|
// the accessory already exists
|
|
834
|
-
if (this.registerDevice(device)) {
|
|
834
|
+
if (await this.registerDevice(device)) {
|
|
835
835
|
// if you need to update the accessory.context then you should run `api.updatePlatformAccessories`. eg.:
|
|
836
836
|
existingAccessory.context.model = device.deviceType;
|
|
837
837
|
existingAccessory.context.deviceID = device.deviceId;
|
|
@@ -839,7 +839,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
839
839
|
existingAccessory.context.firmwareRevision = device.firmware;
|
|
840
840
|
existingAccessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
|
|
841
841
|
this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} DeviceID: ${device.deviceId}`);
|
|
842
|
-
existingAccessory.context.connectionType = await this.
|
|
842
|
+
existingAccessory.context.connectionType = await this.connectionType(device);
|
|
843
843
|
this.api.updatePlatformAccessories([existingAccessory]);
|
|
844
844
|
// create the accessory handler for the restored accessory
|
|
845
845
|
// this is imported from `platformAccessory.ts`
|
|
@@ -848,7 +848,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
848
848
|
} else {
|
|
849
849
|
this.unregisterPlatformAccessories(existingAccessory);
|
|
850
850
|
}
|
|
851
|
-
} else if (this.registerDevice(device)) {
|
|
851
|
+
} else if (await this.registerDevice(device)) {
|
|
852
852
|
// the accessory does not yet exist, so we need to create it
|
|
853
853
|
this.infoLog(`Adding new accessory: ${device.deviceName} ${device.deviceType} DeviceID: ${device.deviceId}`);
|
|
854
854
|
|
|
@@ -862,7 +862,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
862
862
|
accessory.context.deviceID = device.deviceId;
|
|
863
863
|
accessory.context.firmwareRevision = device.firmware;
|
|
864
864
|
accessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
|
|
865
|
-
accessory.context.connectionType = await this.
|
|
865
|
+
accessory.context.connectionType = await this.connectionType(device);
|
|
866
866
|
// create the accessory handler for the newly create accessory
|
|
867
867
|
// this is imported from `platformAccessory.ts`
|
|
868
868
|
new Motion(this, accessory, device);
|
|
@@ -885,7 +885,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
885
885
|
|
|
886
886
|
if (existingAccessory) {
|
|
887
887
|
// the accessory already exists
|
|
888
|
-
if (this.registerDevice(device)) {
|
|
888
|
+
if (await this.registerDevice(device)) {
|
|
889
889
|
// if you need to update the accessory.context then you should run `api.updatePlatformAccessories`. eg.:
|
|
890
890
|
existingAccessory.context.model = device.deviceType;
|
|
891
891
|
existingAccessory.context.deviceID = device.deviceId;
|
|
@@ -893,7 +893,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
893
893
|
existingAccessory.context.firmwareRevision = device.firmware;
|
|
894
894
|
existingAccessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
|
|
895
895
|
this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} DeviceID: ${device.deviceId}`);
|
|
896
|
-
existingAccessory.context.connectionType = await this.
|
|
896
|
+
existingAccessory.context.connectionType = await this.connectionType(device);
|
|
897
897
|
this.api.updatePlatformAccessories([existingAccessory]);
|
|
898
898
|
// create the accessory handler for the restored accessory
|
|
899
899
|
// this is imported from `platformAccessory.ts`
|
|
@@ -902,7 +902,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
902
902
|
} else {
|
|
903
903
|
this.unregisterPlatformAccessories(existingAccessory);
|
|
904
904
|
}
|
|
905
|
-
} else if (this.registerDevice(device)) {
|
|
905
|
+
} else if (await this.registerDevice(device)) {
|
|
906
906
|
// the accessory does not yet exist, so we need to create it
|
|
907
907
|
this.infoLog(`Adding new accessory: ${device.deviceName} ${device.deviceType} DeviceID: ${device.deviceId}`);
|
|
908
908
|
|
|
@@ -916,7 +916,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
916
916
|
accessory.context.deviceID = device.deviceId;
|
|
917
917
|
accessory.context.firmwareRevision = device.firmware;
|
|
918
918
|
accessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
|
|
919
|
-
accessory.context.connectionType = await this.
|
|
919
|
+
accessory.context.connectionType = await this.connectionType(device);
|
|
920
920
|
// create the accessory handler for the newly create accessory
|
|
921
921
|
// this is imported from `platformAccessory.ts`
|
|
922
922
|
new Contact(this, accessory, device);
|
|
@@ -947,7 +947,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
947
947
|
existingAccessory.context.firmwareRevision = device.firmware;
|
|
948
948
|
existingAccessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
|
|
949
949
|
this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} DeviceID: ${device.deviceId}`);
|
|
950
|
-
existingAccessory.context.connectionType = await this.
|
|
950
|
+
existingAccessory.context.connectionType = await this.connectionType(device);
|
|
951
951
|
this.api.updatePlatformAccessories([existingAccessory]);
|
|
952
952
|
// create the accessory handler for the restored accessory
|
|
953
953
|
// this is imported from `platformAccessory.ts`
|
|
@@ -981,7 +981,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
981
981
|
accessory.context.deviceID = device.deviceId;
|
|
982
982
|
accessory.context.firmwareRevision = device.firmware;
|
|
983
983
|
accessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
|
|
984
|
-
accessory.context.connectionType = await this.
|
|
984
|
+
accessory.context.connectionType = await this.connectionType(device);
|
|
985
985
|
// create the accessory handler for the newly create accessory
|
|
986
986
|
// this is imported from `platformAccessory.ts`
|
|
987
987
|
new Curtain(this, accessory, device);
|
|
@@ -1019,7 +1019,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
1019
1019
|
|
|
1020
1020
|
if (existingAccessory) {
|
|
1021
1021
|
// the accessory already exists
|
|
1022
|
-
if (this.registerDevice(device)) {
|
|
1022
|
+
if (await this.registerDevice(device)) {
|
|
1023
1023
|
// if you need to update the accessory.context then you should run `api.updatePlatformAccessories`. eg.:
|
|
1024
1024
|
existingAccessory.context.model = device.deviceType;
|
|
1025
1025
|
existingAccessory.context.deviceID = device.deviceId;
|
|
@@ -1027,7 +1027,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
1027
1027
|
existingAccessory.context.firmwareRevision = device.firmware;
|
|
1028
1028
|
existingAccessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
|
|
1029
1029
|
this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} DeviceID: ${device.deviceId}`);
|
|
1030
|
-
existingAccessory.context.connectionType = await this.
|
|
1030
|
+
existingAccessory.context.connectionType = await this.connectionType(device);
|
|
1031
1031
|
this.api.updatePlatformAccessories([existingAccessory]);
|
|
1032
1032
|
// create the accessory handler for the restored accessory
|
|
1033
1033
|
// this is imported from `platformAccessory.ts`
|
|
@@ -1036,7 +1036,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
1036
1036
|
} else {
|
|
1037
1037
|
this.unregisterPlatformAccessories(existingAccessory);
|
|
1038
1038
|
}
|
|
1039
|
-
} else if (this.registerDevice(device)) {
|
|
1039
|
+
} else if (await this.registerDevice(device)) {
|
|
1040
1040
|
// the accessory does not yet exist, so we need to create it
|
|
1041
1041
|
this.infoLog(`Adding new accessory: ${device.deviceName} ${device.deviceType} DeviceID: ${device.deviceId}`);
|
|
1042
1042
|
|
|
@@ -1050,7 +1050,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
1050
1050
|
accessory.context.deviceID = device.deviceId;
|
|
1051
1051
|
accessory.context.firmwareRevision = device.firmware;
|
|
1052
1052
|
accessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
|
|
1053
|
-
accessory.context.connectionType = await this.
|
|
1053
|
+
accessory.context.connectionType = await this.connectionType(device);
|
|
1054
1054
|
// create the accessory handler for the newly create accessory
|
|
1055
1055
|
// this is imported from `platformAccessory.ts`
|
|
1056
1056
|
new Plug(this, accessory, device);
|
|
@@ -1073,7 +1073,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
1073
1073
|
|
|
1074
1074
|
if (existingAccessory) {
|
|
1075
1075
|
// the accessory already exists
|
|
1076
|
-
if (this.registerDevice(device)) {
|
|
1076
|
+
if (await this.registerDevice(device)) {
|
|
1077
1077
|
// if you need to update the accessory.context then you should run `api.updatePlatformAccessories`. eg.:
|
|
1078
1078
|
existingAccessory.context.model = device.deviceType;
|
|
1079
1079
|
existingAccessory.context.deviceID = device.deviceId;
|
|
@@ -1081,7 +1081,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
1081
1081
|
existingAccessory.context.firmwareRevision = device.firmware;
|
|
1082
1082
|
existingAccessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
|
|
1083
1083
|
this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} DeviceID: ${device.deviceId}`);
|
|
1084
|
-
existingAccessory.context.connectionType = await this.
|
|
1084
|
+
existingAccessory.context.connectionType = await this.connectionType(device);
|
|
1085
1085
|
this.api.updatePlatformAccessories([existingAccessory]);
|
|
1086
1086
|
// create the accessory handler for the restored accessory
|
|
1087
1087
|
// this is imported from `platformAccessory.ts`
|
|
@@ -1090,7 +1090,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
1090
1090
|
} else {
|
|
1091
1091
|
this.unregisterPlatformAccessories(existingAccessory);
|
|
1092
1092
|
}
|
|
1093
|
-
} else if (this.registerDevice(device)) {
|
|
1093
|
+
} else if (await this.registerDevice(device)) {
|
|
1094
1094
|
// the accessory does not yet exist, so we need to create it
|
|
1095
1095
|
this.infoLog(`Adding new accessory: ${device.deviceName} ${device.deviceType} DeviceID: ${device.deviceId}`);
|
|
1096
1096
|
|
|
@@ -1104,7 +1104,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
1104
1104
|
accessory.context.deviceID = device.deviceId;
|
|
1105
1105
|
accessory.context.firmwareRevision = device.firmware;
|
|
1106
1106
|
accessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
|
|
1107
|
-
accessory.context.connectionType = await this.
|
|
1107
|
+
accessory.context.connectionType = await this.connectionType(device);
|
|
1108
1108
|
// create the accessory handler for the newly create accessory
|
|
1109
1109
|
// this is imported from `platformAccessory.ts`
|
|
1110
1110
|
new Lock(this, accessory, device);
|
|
@@ -1127,7 +1127,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
1127
1127
|
|
|
1128
1128
|
if (existingAccessory) {
|
|
1129
1129
|
// the accessory already exists
|
|
1130
|
-
if (this.registerDevice(device)) {
|
|
1130
|
+
if (await this.registerDevice(device)) {
|
|
1131
1131
|
// if you need to update the accessory.context then you should run `api.updatePlatformAccessories`. eg.:
|
|
1132
1132
|
existingAccessory.context.model = device.deviceType;
|
|
1133
1133
|
existingAccessory.context.deviceID = device.deviceId;
|
|
@@ -1135,7 +1135,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
1135
1135
|
existingAccessory.context.firmwareRevision = device.firmware;
|
|
1136
1136
|
existingAccessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
|
|
1137
1137
|
this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} DeviceID: ${device.deviceId}`);
|
|
1138
|
-
existingAccessory.context.connectionType = await this.
|
|
1138
|
+
existingAccessory.context.connectionType = await this.connectionType(device);
|
|
1139
1139
|
this.api.updatePlatformAccessories([existingAccessory]);
|
|
1140
1140
|
// create the accessory handler for the restored accessory
|
|
1141
1141
|
// this is imported from `platformAccessory.ts`
|
|
@@ -1144,7 +1144,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
1144
1144
|
} else {
|
|
1145
1145
|
this.unregisterPlatformAccessories(existingAccessory);
|
|
1146
1146
|
}
|
|
1147
|
-
} else if (this.registerDevice(device)) {
|
|
1147
|
+
} else if (await this.registerDevice(device)) {
|
|
1148
1148
|
// the accessory does not yet exist, so we need to create it
|
|
1149
1149
|
this.infoLog(`Adding new accessory: ${device.deviceName} ${device.deviceType} DeviceID: ${device.deviceId}`);
|
|
1150
1150
|
|
|
@@ -1158,7 +1158,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
1158
1158
|
accessory.context.deviceID = device.deviceId;
|
|
1159
1159
|
accessory.context.firmwareRevision = device.firmware;
|
|
1160
1160
|
accessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
|
|
1161
|
-
accessory.context.connectionType = await this.
|
|
1161
|
+
accessory.context.connectionType = await this.connectionType(device);
|
|
1162
1162
|
// create the accessory handler for the newly create accessory
|
|
1163
1163
|
// this is imported from `platformAccessory.ts`
|
|
1164
1164
|
new ColorBulb(this, accessory, device);
|
|
@@ -1181,7 +1181,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
1181
1181
|
|
|
1182
1182
|
if (existingAccessory) {
|
|
1183
1183
|
// the accessory already exists
|
|
1184
|
-
if (this.registerDevice(device)) {
|
|
1184
|
+
if (await this.registerDevice(device)) {
|
|
1185
1185
|
// if you need to update the accessory.context then you should run `api.updatePlatformAccessories`. eg.:
|
|
1186
1186
|
existingAccessory.context.model = device.deviceType;
|
|
1187
1187
|
existingAccessory.context.deviceID = device.deviceId;
|
|
@@ -1189,7 +1189,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
1189
1189
|
existingAccessory.context.firmwareRevision = device.firmware;
|
|
1190
1190
|
existingAccessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
|
|
1191
1191
|
this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} DeviceID: ${device.deviceId}`);
|
|
1192
|
-
existingAccessory.context.connectionType = await this.
|
|
1192
|
+
existingAccessory.context.connectionType = await this.connectionType(device);
|
|
1193
1193
|
this.api.updatePlatformAccessories([existingAccessory]);
|
|
1194
1194
|
// create the accessory handler for the restored accessory
|
|
1195
1195
|
// this is imported from `platformAccessory.ts`
|
|
@@ -1198,7 +1198,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
1198
1198
|
} else {
|
|
1199
1199
|
this.unregisterPlatformAccessories(existingAccessory);
|
|
1200
1200
|
}
|
|
1201
|
-
} else if (this.registerDevice(device)) {
|
|
1201
|
+
} else if (await this.registerDevice(device)) {
|
|
1202
1202
|
// the accessory does not yet exist, so we need to create it
|
|
1203
1203
|
this.infoLog(`Adding new accessory: ${device.deviceName} ${device.deviceType} DeviceID: ${device.deviceId}`);
|
|
1204
1204
|
|
|
@@ -1212,7 +1212,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
1212
1212
|
accessory.context.deviceID = device.deviceId;
|
|
1213
1213
|
accessory.context.firmwareRevision = device.firmware;
|
|
1214
1214
|
accessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
|
|
1215
|
-
accessory.context.connectionType = await this.
|
|
1215
|
+
accessory.context.connectionType = await this.connectionType(device);
|
|
1216
1216
|
// create the accessory handler for the newly create accessory
|
|
1217
1217
|
// this is imported from `platformAccessory.ts`
|
|
1218
1218
|
new StripLight(this, accessory, device);
|
|
@@ -1241,7 +1241,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
1241
1241
|
existingAccessory.context.firmwareRevision = device.firmware;
|
|
1242
1242
|
existingAccessory.context.deviceType = `IR: ${device.remoteType}`;
|
|
1243
1243
|
this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} DeviceID: ${device.deviceId}`);
|
|
1244
|
-
existingAccessory.context.connectionType = await this.
|
|
1244
|
+
existingAccessory.context.connectionType = await this.connectionType(device);
|
|
1245
1245
|
this.api.updatePlatformAccessories([existingAccessory]);
|
|
1246
1246
|
// create the accessory handler for the restored accessory
|
|
1247
1247
|
// this is imported from `platformAccessory.ts`
|
|
@@ -1261,7 +1261,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
1261
1261
|
accessory.context.deviceID = device.deviceId;
|
|
1262
1262
|
accessory.context.firmwareRevision = device.firmware;
|
|
1263
1263
|
accessory.context.deviceType = `IR: ${device.remoteType}`;
|
|
1264
|
-
accessory.context.connectionType = await this.
|
|
1264
|
+
accessory.context.connectionType = await this.connectionType(device);
|
|
1265
1265
|
// create the accessory handler for the newly create accessory
|
|
1266
1266
|
// this is imported from `platformAccessory.ts`
|
|
1267
1267
|
new TV(this, accessory, device);
|
|
@@ -1296,7 +1296,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
1296
1296
|
existingAccessory.context.firmwareRevision = device.firmware;
|
|
1297
1297
|
existingAccessory.context.deviceType = `IR: ${device.remoteType}`;
|
|
1298
1298
|
this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} DeviceID: ${device.deviceId}`);
|
|
1299
|
-
existingAccessory.context.connectionType = await this.
|
|
1299
|
+
existingAccessory.context.connectionType = await this.connectionType(device);
|
|
1300
1300
|
this.api.updatePlatformAccessories([existingAccessory]);
|
|
1301
1301
|
// create the accessory handler for the restored accessory
|
|
1302
1302
|
// this is imported from `platformAccessory.ts`
|
|
@@ -1319,7 +1319,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
1319
1319
|
accessory.context.deviceID = device.deviceId;
|
|
1320
1320
|
accessory.context.firmwareRevision = device.firmware;
|
|
1321
1321
|
accessory.context.deviceType = `IR: ${device.remoteType}`;
|
|
1322
|
-
accessory.context.connectionType = await this.
|
|
1322
|
+
accessory.context.connectionType = await this.connectionType(device);
|
|
1323
1323
|
// create the accessory handler for the newly create accessory
|
|
1324
1324
|
// this is imported from `platformAccessory.ts`
|
|
1325
1325
|
new Fan(this, accessory, device);
|
|
@@ -1350,7 +1350,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
1350
1350
|
existingAccessory.context.firmwareRevision = device.firmware;
|
|
1351
1351
|
existingAccessory.context.deviceType = `IR: ${device.remoteType}`;
|
|
1352
1352
|
this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} DeviceID: ${device.deviceId}`);
|
|
1353
|
-
existingAccessory.context.connectionType = await this.
|
|
1353
|
+
existingAccessory.context.connectionType = await this.connectionType(device);
|
|
1354
1354
|
this.api.updatePlatformAccessories([existingAccessory]);
|
|
1355
1355
|
// create the accessory handler for the restored accessory
|
|
1356
1356
|
// this is imported from `platformAccessory.ts`
|
|
@@ -1373,7 +1373,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
1373
1373
|
accessory.context.deviceID = device.deviceId;
|
|
1374
1374
|
accessory.context.firmwareRevision = device.firmware;
|
|
1375
1375
|
accessory.context.deviceType = `IR: ${device.remoteType}`;
|
|
1376
|
-
accessory.context.connectionType = await this.
|
|
1376
|
+
accessory.context.connectionType = await this.connectionType(device);
|
|
1377
1377
|
// create the accessory handler for the newly create accessory
|
|
1378
1378
|
// this is imported from `platformAccessory.ts`
|
|
1379
1379
|
new Light(this, accessory, device);
|
|
@@ -1404,7 +1404,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
1404
1404
|
existingAccessory.context.firmwareRevision = device.firmware;
|
|
1405
1405
|
existingAccessory.context.deviceType = `IR: ${device.remoteType}`;
|
|
1406
1406
|
this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} DeviceID: ${device.deviceId}`);
|
|
1407
|
-
existingAccessory.context.connectionType = await this.
|
|
1407
|
+
existingAccessory.context.connectionType = await this.connectionType(device);
|
|
1408
1408
|
this.api.updatePlatformAccessories([existingAccessory]);
|
|
1409
1409
|
// create the accessory handler for the restored accessory
|
|
1410
1410
|
// this is imported from `platformAccessory.ts`
|
|
@@ -1427,7 +1427,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
1427
1427
|
accessory.context.deviceID = device.deviceId;
|
|
1428
1428
|
accessory.context.firmwareRevision = device.firmware;
|
|
1429
1429
|
accessory.context.deviceType = `IR: ${device.remoteType}`;
|
|
1430
|
-
accessory.context.connectionType = await this.
|
|
1430
|
+
accessory.context.connectionType = await this.connectionType(device);
|
|
1431
1431
|
// create the accessory handler for the newly create accessory
|
|
1432
1432
|
// this is imported from `platformAccessory.ts`
|
|
1433
1433
|
new AirConditioner(this, accessory, device);
|
|
@@ -1458,7 +1458,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
1458
1458
|
existingAccessory.context.firmwareRevision = device.firmware;
|
|
1459
1459
|
existingAccessory.context.deviceType = `IR: ${device.remoteType}`;
|
|
1460
1460
|
this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} DeviceID: ${device.deviceId}`);
|
|
1461
|
-
existingAccessory.context.connectionType = await this.
|
|
1461
|
+
existingAccessory.context.connectionType = await this.connectionType(device);
|
|
1462
1462
|
this.api.updatePlatformAccessories([existingAccessory]);
|
|
1463
1463
|
// create the accessory handler for the restored accessory
|
|
1464
1464
|
// this is imported from `platformAccessory.ts`
|
|
@@ -1481,7 +1481,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
1481
1481
|
accessory.context.deviceID = device.deviceId;
|
|
1482
1482
|
accessory.context.firmwareRevision = device.firmware;
|
|
1483
1483
|
accessory.context.deviceType = `IR: ${device.remoteType}`;
|
|
1484
|
-
accessory.context.connectionType = await this.
|
|
1484
|
+
accessory.context.connectionType = await this.connectionType(device);
|
|
1485
1485
|
// create the accessory handler for the newly create accessory
|
|
1486
1486
|
// this is imported from `platformAccessory.ts`
|
|
1487
1487
|
new AirPurifier(this, accessory, device);
|
|
@@ -1512,7 +1512,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
1512
1512
|
existingAccessory.context.firmwareRevision = device.firmware;
|
|
1513
1513
|
existingAccessory.context.deviceType = `IR: ${device.remoteType}`;
|
|
1514
1514
|
this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} DeviceID: ${device.deviceId}`);
|
|
1515
|
-
existingAccessory.context.connectionType = await this.
|
|
1515
|
+
existingAccessory.context.connectionType = await this.connectionType(device);
|
|
1516
1516
|
this.api.updatePlatformAccessories([existingAccessory]);
|
|
1517
1517
|
// create the accessory handler for the restored accessory
|
|
1518
1518
|
// this is imported from `platformAccessory.ts`
|
|
@@ -1535,7 +1535,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
1535
1535
|
accessory.context.deviceID = device.deviceId;
|
|
1536
1536
|
accessory.context.firmwareRevision = device.firmware;
|
|
1537
1537
|
accessory.context.deviceType = `IR: ${device.remoteType}`;
|
|
1538
|
-
accessory.context.connectionType = await this.
|
|
1538
|
+
accessory.context.connectionType = await this.connectionType(device);
|
|
1539
1539
|
// create the accessory handler for the newly create accessory
|
|
1540
1540
|
// this is imported from `platformAccessory.ts`
|
|
1541
1541
|
new WaterHeater(this, accessory, device);
|
|
@@ -1566,7 +1566,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
1566
1566
|
existingAccessory.context.firmwareRevision = device.firmware;
|
|
1567
1567
|
existingAccessory.context.deviceType = `IR: ${device.remoteType}`;
|
|
1568
1568
|
this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} DeviceID: ${device.deviceId}`);
|
|
1569
|
-
existingAccessory.context.connectionType = await this.
|
|
1569
|
+
existingAccessory.context.connectionType = await this.connectionType(device);
|
|
1570
1570
|
this.api.updatePlatformAccessories([existingAccessory]);
|
|
1571
1571
|
// create the accessory handler for the restored accessory
|
|
1572
1572
|
// this is imported from `platformAccessory.ts`
|
|
@@ -1589,7 +1589,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
1589
1589
|
accessory.context.deviceID = device.deviceId;
|
|
1590
1590
|
accessory.context.firmwareRevision = device.firmware;
|
|
1591
1591
|
accessory.context.deviceType = `IR: ${device.remoteType}`;
|
|
1592
|
-
accessory.context.connectionType = await this.
|
|
1592
|
+
accessory.context.connectionType = await this.connectionType(device);
|
|
1593
1593
|
// create the accessory handler for the newly create accessory
|
|
1594
1594
|
// this is imported from `platformAccessory.ts`
|
|
1595
1595
|
new VacuumCleaner(this, accessory, device);
|
|
@@ -1620,7 +1620,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
1620
1620
|
existingAccessory.context.firmwareRevision = device.firmware;
|
|
1621
1621
|
existingAccessory.context.deviceType = `IR: ${device.remoteType}`;
|
|
1622
1622
|
this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} DeviceID: ${device.deviceId}`);
|
|
1623
|
-
existingAccessory.context.connectionType = await this.
|
|
1623
|
+
existingAccessory.context.connectionType = await this.connectionType(device);
|
|
1624
1624
|
this.api.updatePlatformAccessories([existingAccessory]);
|
|
1625
1625
|
// create the accessory handler for the restored accessory
|
|
1626
1626
|
// this is imported from `platformAccessory.ts`
|
|
@@ -1643,7 +1643,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
1643
1643
|
accessory.context.deviceID = device.deviceId;
|
|
1644
1644
|
accessory.context.firmwareRevision = device.firmware;
|
|
1645
1645
|
accessory.context.deviceType = `IR: ${device.remoteType}`;
|
|
1646
|
-
accessory.context.connectionType = await this.
|
|
1646
|
+
accessory.context.connectionType = await this.connectionType(device);
|
|
1647
1647
|
// create the accessory handler for the newly create accessory
|
|
1648
1648
|
// this is imported from `platformAccessory.ts`
|
|
1649
1649
|
new Camera(this, accessory, device);
|
|
@@ -1674,7 +1674,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
1674
1674
|
existingAccessory.context.firmwareRevision = device.firmware;
|
|
1675
1675
|
existingAccessory.context.deviceType = `IR: ${device.remoteType}`;
|
|
1676
1676
|
this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} DeviceID: ${device.deviceId}`);
|
|
1677
|
-
existingAccessory.context.connectionType = await this.
|
|
1677
|
+
existingAccessory.context.connectionType = await this.connectionType(device);
|
|
1678
1678
|
this.api.updatePlatformAccessories([existingAccessory]);
|
|
1679
1679
|
// create the accessory handler for the restored accessory
|
|
1680
1680
|
// this is imported from `platformAccessory.ts`
|
|
@@ -1697,7 +1697,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
1697
1697
|
accessory.context.deviceID = device.deviceId;
|
|
1698
1698
|
accessory.context.firmwareRevision = device.firmware;
|
|
1699
1699
|
accessory.context.deviceType = `IR: ${device.remoteType}`;
|
|
1700
|
-
accessory.context.connectionType = await this.
|
|
1700
|
+
accessory.context.connectionType = await this.connectionType(device);
|
|
1701
1701
|
// create the accessory handler for the newly create accessory
|
|
1702
1702
|
// this is imported from `platformAccessory.ts`
|
|
1703
1703
|
new Others(this, accessory, device);
|
|
@@ -1711,7 +1711,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
1711
1711
|
}
|
|
1712
1712
|
}
|
|
1713
1713
|
|
|
1714
|
-
|
|
1714
|
+
async connectionType(device: device & devicesConfig): Promise<any> {
|
|
1715
1715
|
let connectionType = '';
|
|
1716
1716
|
if (!device.connectionType && this.config.credentials?.token && this.config.credentials.secret) {
|
|
1717
1717
|
connectionType = 'OpenAPI';
|
|
@@ -1721,16 +1721,13 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
1721
1721
|
return connectionType;
|
|
1722
1722
|
}
|
|
1723
1723
|
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
private registerDevice(device: device & devicesConfig) {
|
|
1729
|
-
if (!device.hide_device && device.enableCloudService && device.connectionType === 'OpenAPI & BLE') {
|
|
1724
|
+
async registerDevice(device: device & devicesConfig) {
|
|
1725
|
+
device.connectionType = await this.connectionType(device);
|
|
1726
|
+
if (!device.hide_device && device.enableCloudService && device.connectionType === 'BLE/OpenAPI') {
|
|
1730
1727
|
this.registeringDevice = true;
|
|
1731
1728
|
this.debugLog(`Device: ${device.deviceName} Both OpenAPI and BLE Connections Enabled`);
|
|
1732
1729
|
} else if (!device.hide_device && device.deviceId && device.configDeviceType && device.configDeviceName
|
|
1733
|
-
&&
|
|
1730
|
+
&& device.connectionType === 'BLE') {
|
|
1734
1731
|
this.registeringDevice = true;
|
|
1735
1732
|
this.debugLog(`Device: ${device.deviceName} BLE Connection Enabled`);
|
|
1736
1733
|
} else if (!device.hide_device && device.enableCloudService && device.connectionType === 'OpenAPI') {
|
|
@@ -1741,13 +1738,13 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
1741
1738
|
this.debugLog(`Device: ${device.deviceName} Device connection Disabled, will continue to display in HomeKit`);
|
|
1742
1739
|
} else if (!device.connectionType){
|
|
1743
1740
|
this.registeringDevice = false;
|
|
1744
|
-
this.
|
|
1741
|
+
this.errorLog(`Device: ${device.deviceName} Connection Type not Set, will not display in HomeKit`);
|
|
1745
1742
|
} else if (device.hide_device){
|
|
1746
1743
|
this.registeringDevice = false;
|
|
1747
|
-
this.
|
|
1744
|
+
this.errorLog(`Device: ${device.deviceName} Device Set to Hidden, will not display in HomeKit`);
|
|
1748
1745
|
} else {
|
|
1749
1746
|
this.registeringDevice = false;
|
|
1750
|
-
this.
|
|
1747
|
+
this.errorLog(`Device: ${device.deviceName} OpenAPI or BLE Are Not Enabled`);
|
|
1751
1748
|
}
|
|
1752
1749
|
return this.registeringDevice;
|
|
1753
1750
|
}
|