@switchbot/homebridge-switchbot 2.0.0-beta.19 → 2.0.0-beta.20
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/CHANGELOG.md +6 -1
- package/README.md +1 -2
- package/config.schema.json +51 -32
- package/dist/device/bot.d.ts +32 -29
- package/dist/device/bot.d.ts.map +1 -1
- package/dist/device/bot.js +549 -575
- package/dist/device/bot.js.map +1 -1
- package/dist/device/colorbulb.d.ts +33 -15
- package/dist/device/colorbulb.d.ts.map +1 -1
- package/dist/device/colorbulb.js +426 -341
- package/dist/device/colorbulb.js.map +1 -1
- package/dist/device/contact.d.ts +16 -9
- package/dist/device/contact.d.ts.map +1 -1
- package/dist/device/contact.js +246 -208
- package/dist/device/contact.js.map +1 -1
- package/dist/device/curtain.d.ts +21 -18
- package/dist/device/curtain.d.ts.map +1 -1
- package/dist/device/curtain.js +449 -449
- package/dist/device/curtain.js.map +1 -1
- package/dist/device/humidifier.d.ts +22 -20
- package/dist/device/humidifier.d.ts.map +1 -1
- package/dist/device/humidifier.js +346 -324
- package/dist/device/humidifier.js.map +1 -1
- package/dist/device/lock.d.ts +22 -10
- package/dist/device/lock.d.ts.map +1 -1
- package/dist/device/lock.js +257 -178
- package/dist/device/lock.js.map +1 -1
- package/dist/device/meter.d.ts +21 -14
- package/dist/device/meter.d.ts.map +1 -1
- package/dist/device/meter.js +287 -239
- package/dist/device/meter.js.map +1 -1
- package/dist/device/meterplus.d.ts +23 -10
- package/dist/device/meterplus.d.ts.map +1 -1
- package/dist/device/meterplus.js +308 -190
- package/dist/device/meterplus.js.map +1 -1
- package/dist/device/motion.d.ts +17 -10
- package/dist/device/motion.d.ts.map +1 -1
- package/dist/device/motion.js +225 -193
- package/dist/device/motion.js.map +1 -1
- package/dist/device/plug.d.ts +24 -17
- package/dist/device/plug.d.ts.map +1 -1
- package/dist/device/plug.js +270 -267
- package/dist/device/plug.js.map +1 -1
- package/dist/device/striplight.d.ts +36 -14
- package/dist/device/striplight.d.ts.map +1 -1
- package/dist/device/striplight.js +447 -299
- package/dist/device/striplight.js.map +1 -1
- package/dist/irdevice/airconditioner.d.ts +7 -14
- package/dist/irdevice/airconditioner.d.ts.map +1 -1
- package/dist/irdevice/airconditioner.js +177 -169
- package/dist/irdevice/airconditioner.js.map +1 -1
- package/dist/irdevice/airpurifier.d.ts +3 -5
- package/dist/irdevice/airpurifier.d.ts.map +1 -1
- package/dist/irdevice/airpurifier.js +72 -57
- package/dist/irdevice/airpurifier.js.map +1 -1
- package/dist/irdevice/camera.d.ts +3 -4
- package/dist/irdevice/camera.d.ts.map +1 -1
- package/dist/irdevice/camera.js +47 -33
- package/dist/irdevice/camera.js.map +1 -1
- package/dist/irdevice/fan.d.ts +3 -4
- package/dist/irdevice/fan.d.ts.map +1 -1
- package/dist/irdevice/fan.js +66 -48
- package/dist/irdevice/fan.js.map +1 -1
- package/dist/irdevice/light.d.ts +3 -4
- package/dist/irdevice/light.d.ts.map +1 -1
- package/dist/irdevice/light.js +48 -47
- package/dist/irdevice/light.js.map +1 -1
- package/dist/irdevice/other.d.ts +3 -4
- package/dist/irdevice/other.d.ts.map +1 -1
- package/dist/irdevice/other.js +47 -33
- package/dist/irdevice/other.js.map +1 -1
- package/dist/irdevice/tv.d.ts +10 -11
- package/dist/irdevice/tv.d.ts.map +1 -1
- package/dist/irdevice/tv.js +64 -48
- package/dist/irdevice/tv.js.map +1 -1
- package/dist/irdevice/vacuumcleaner.d.ts +7 -12
- package/dist/irdevice/vacuumcleaner.d.ts.map +1 -1
- package/dist/irdevice/vacuumcleaner.js +52 -41
- package/dist/irdevice/vacuumcleaner.js.map +1 -1
- package/dist/irdevice/waterheater.d.ts +6 -11
- package/dist/irdevice/waterheater.d.ts.map +1 -1
- package/dist/irdevice/waterheater.js +52 -42
- package/dist/irdevice/waterheater.js.map +1 -1
- package/dist/platform.d.ts +0 -4
- package/dist/platform.d.ts.map +1 -1
- package/dist/platform.js +44 -66
- package/dist/platform.js.map +1 -1
- package/dist/settings.d.ts +3 -3
- package/dist/settings.d.ts.map +1 -1
- package/package.json +7 -6
- package/src/device/bot.ts +551 -589
- package/src/device/colorbulb.ts +441 -375
- package/src/device/contact.ts +249 -213
- package/src/device/curtain.ts +452 -461
- package/src/device/humidifier.ts +358 -365
- package/src/device/lock.ts +263 -179
- package/src/device/meter.ts +302 -253
- package/src/device/meterplus.ts +319 -194
- package/src/device/motion.ts +230 -199
- package/src/device/plug.ts +273 -274
- package/src/device/striplight.ts +460 -316
- package/src/irdevice/airconditioner.ts +181 -183
- package/src/irdevice/airpurifier.ts +70 -60
- package/src/irdevice/camera.ts +46 -36
- package/src/irdevice/fan.ts +64 -49
- package/src/irdevice/light.ts +47 -51
- package/src/irdevice/other.ts +46 -36
- package/src/irdevice/tv.ts +64 -51
- package/src/irdevice/vacuumcleaner.ts +52 -45
- package/src/irdevice/waterheater.ts +50 -45
- package/src/platform.ts +44 -68
- package/src/settings.ts +3 -3
package/dist/platform.js
CHANGED
|
@@ -153,7 +153,7 @@ class SwitchBotPlatform {
|
|
|
153
153
|
if (!deviceConfig.deviceId) {
|
|
154
154
|
throw new Error('The devices config section is missing the *Device ID* in the config. Please check your config.');
|
|
155
155
|
}
|
|
156
|
-
if (!deviceConfig.configDeviceType && deviceConfig.
|
|
156
|
+
if (!deviceConfig.configDeviceType && deviceConfig.connectionType) {
|
|
157
157
|
throw new Error('The devices config section is missing the *Device Type* in the config. Please check your config.');
|
|
158
158
|
}
|
|
159
159
|
}
|
|
@@ -595,7 +595,7 @@ class SwitchBotPlatform {
|
|
|
595
595
|
existingAccessory.context.firmwareRevision = device.firmware;
|
|
596
596
|
existingAccessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
|
|
597
597
|
this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} DeviceID: ${device.deviceId}`);
|
|
598
|
-
|
|
598
|
+
existingAccessory.context.connectionType = device.connectionType || 'OpenAPI';
|
|
599
599
|
this.api.updatePlatformAccessories([existingAccessory]);
|
|
600
600
|
// create the accessory handler for the restored accessory
|
|
601
601
|
// this is imported from `platformAccessory.ts`
|
|
@@ -618,7 +618,7 @@ class SwitchBotPlatform {
|
|
|
618
618
|
accessory.context.deviceID = device.deviceId;
|
|
619
619
|
accessory.context.firmwareRevision = device.firmware;
|
|
620
620
|
accessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
|
|
621
|
-
|
|
621
|
+
accessory.context.connectionType = device.connectionType || 'OpenAPI';
|
|
622
622
|
// create the accessory handler for the newly create accessory
|
|
623
623
|
// this is imported from `platformAccessory.ts`
|
|
624
624
|
new humidifier_1.Humidifier(this, accessory, device);
|
|
@@ -647,7 +647,7 @@ class SwitchBotPlatform {
|
|
|
647
647
|
existingAccessory.context.firmwareRevision = device.firmware;
|
|
648
648
|
existingAccessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
|
|
649
649
|
this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} DeviceID: ${device.deviceId}`);
|
|
650
|
-
|
|
650
|
+
existingAccessory.context.connectionType = device.connectionType || 'OpenAPI';
|
|
651
651
|
this.api.updatePlatformAccessories([existingAccessory]);
|
|
652
652
|
// create the accessory handler for the restored accessory
|
|
653
653
|
// this is imported from `platformAccessory.ts`
|
|
@@ -671,7 +671,7 @@ class SwitchBotPlatform {
|
|
|
671
671
|
accessory.context.deviceID = device.deviceId;
|
|
672
672
|
accessory.context.firmwareRevision = device.firmware;
|
|
673
673
|
accessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
|
|
674
|
-
|
|
674
|
+
accessory.context.connectionType = device.connectionType || 'OpenAPI';
|
|
675
675
|
// accessory.context.firmwareRevision = findaccessories.accessoryAttribute.softwareRevision;
|
|
676
676
|
// create the accessory handler for the newly create accessory
|
|
677
677
|
// this is imported from `platformAccessory.ts`
|
|
@@ -700,7 +700,7 @@ class SwitchBotPlatform {
|
|
|
700
700
|
existingAccessory.context.firmwareRevision = device.firmware;
|
|
701
701
|
existingAccessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
|
|
702
702
|
this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} DeviceID: ${device.deviceId}`);
|
|
703
|
-
|
|
703
|
+
existingAccessory.context.connectionType = device.connectionType || 'OpenAPI';
|
|
704
704
|
this.api.updatePlatformAccessories([existingAccessory]);
|
|
705
705
|
// create the accessory handler for the restored accessory
|
|
706
706
|
// this is imported from `platformAccessory.ts`
|
|
@@ -723,7 +723,7 @@ class SwitchBotPlatform {
|
|
|
723
723
|
accessory.context.deviceID = device.deviceId;
|
|
724
724
|
accessory.context.firmwareRevision = device.firmware;
|
|
725
725
|
accessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
|
|
726
|
-
|
|
726
|
+
accessory.context.connectionType = device.connectionType || 'OpenAPI';
|
|
727
727
|
// create the accessory handler for the newly create accessory
|
|
728
728
|
// this is imported from `platformAccessory.ts`
|
|
729
729
|
new meter_1.Meter(this, accessory, device);
|
|
@@ -751,7 +751,7 @@ class SwitchBotPlatform {
|
|
|
751
751
|
existingAccessory.context.firmwareRevision = device.firmware;
|
|
752
752
|
existingAccessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
|
|
753
753
|
this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} DeviceID: ${device.deviceId}`);
|
|
754
|
-
|
|
754
|
+
existingAccessory.context.connectionType = device.connectionType || 'OpenAPI';
|
|
755
755
|
this.api.updatePlatformAccessories([existingAccessory]);
|
|
756
756
|
// create the accessory handler for the restored accessory
|
|
757
757
|
// this is imported from `platformAccessory.ts`
|
|
@@ -774,7 +774,7 @@ class SwitchBotPlatform {
|
|
|
774
774
|
accessory.context.deviceID = device.deviceId;
|
|
775
775
|
accessory.context.firmwareRevision = device.firmware;
|
|
776
776
|
accessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
|
|
777
|
-
|
|
777
|
+
accessory.context.connectionType = device.connectionType || 'OpenAPI';
|
|
778
778
|
// create the accessory handler for the newly create accessory
|
|
779
779
|
// this is imported from `platformAccessory.ts`
|
|
780
780
|
new meterplus_1.MeterPlus(this, accessory, device);
|
|
@@ -802,7 +802,7 @@ class SwitchBotPlatform {
|
|
|
802
802
|
existingAccessory.context.firmwareRevision = device.firmware;
|
|
803
803
|
existingAccessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
|
|
804
804
|
this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} DeviceID: ${device.deviceId}`);
|
|
805
|
-
|
|
805
|
+
existingAccessory.context.connectionType = device.connectionType || 'OpenAPI';
|
|
806
806
|
this.api.updatePlatformAccessories([existingAccessory]);
|
|
807
807
|
// create the accessory handler for the restored accessory
|
|
808
808
|
// this is imported from `platformAccessory.ts`
|
|
@@ -825,7 +825,7 @@ class SwitchBotPlatform {
|
|
|
825
825
|
accessory.context.deviceID = device.deviceId;
|
|
826
826
|
accessory.context.firmwareRevision = device.firmware;
|
|
827
827
|
accessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
|
|
828
|
-
|
|
828
|
+
accessory.context.connectionType = device.connectionType || 'OpenAPI';
|
|
829
829
|
// create the accessory handler for the newly create accessory
|
|
830
830
|
// this is imported from `platformAccessory.ts`
|
|
831
831
|
new motion_1.Motion(this, accessory, device);
|
|
@@ -853,7 +853,7 @@ class SwitchBotPlatform {
|
|
|
853
853
|
existingAccessory.context.firmwareRevision = device.firmware;
|
|
854
854
|
existingAccessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
|
|
855
855
|
this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} DeviceID: ${device.deviceId}`);
|
|
856
|
-
|
|
856
|
+
existingAccessory.context.connectionType = device.connectionType || 'OpenAPI';
|
|
857
857
|
this.api.updatePlatformAccessories([existingAccessory]);
|
|
858
858
|
// create the accessory handler for the restored accessory
|
|
859
859
|
// this is imported from `platformAccessory.ts`
|
|
@@ -876,7 +876,7 @@ class SwitchBotPlatform {
|
|
|
876
876
|
accessory.context.deviceID = device.deviceId;
|
|
877
877
|
accessory.context.firmwareRevision = device.firmware;
|
|
878
878
|
accessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
|
|
879
|
-
|
|
879
|
+
accessory.context.connectionType = device.connectionType || 'OpenAPI';
|
|
880
880
|
// create the accessory handler for the newly create accessory
|
|
881
881
|
// this is imported from `platformAccessory.ts`
|
|
882
882
|
new contact_1.Contact(this, accessory, device);
|
|
@@ -904,7 +904,7 @@ class SwitchBotPlatform {
|
|
|
904
904
|
existingAccessory.context.firmwareRevision = device.firmware;
|
|
905
905
|
existingAccessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
|
|
906
906
|
this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} DeviceID: ${device.deviceId}`);
|
|
907
|
-
|
|
907
|
+
existingAccessory.context.connectionType = device.connectionType || 'OpenAPI';
|
|
908
908
|
this.api.updatePlatformAccessories([existingAccessory]);
|
|
909
909
|
// create the accessory handler for the restored accessory
|
|
910
910
|
// this is imported from `platformAccessory.ts`
|
|
@@ -939,7 +939,7 @@ class SwitchBotPlatform {
|
|
|
939
939
|
accessory.context.deviceID = device.deviceId;
|
|
940
940
|
accessory.context.firmwareRevision = device.firmware;
|
|
941
941
|
accessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
|
|
942
|
-
|
|
942
|
+
accessory.context.connectionType = device.connectionType || 'OpenAPI';
|
|
943
943
|
// create the accessory handler for the newly create accessory
|
|
944
944
|
// this is imported from `platformAccessory.ts`
|
|
945
945
|
new curtain_1.Curtain(this, accessory, device);
|
|
@@ -979,7 +979,7 @@ class SwitchBotPlatform {
|
|
|
979
979
|
existingAccessory.context.firmwareRevision = device.firmware;
|
|
980
980
|
existingAccessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
|
|
981
981
|
this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} DeviceID: ${device.deviceId}`);
|
|
982
|
-
|
|
982
|
+
existingAccessory.context.connectionType = device.connectionType || 'OpenAPI';
|
|
983
983
|
this.api.updatePlatformAccessories([existingAccessory]);
|
|
984
984
|
// create the accessory handler for the restored accessory
|
|
985
985
|
// this is imported from `platformAccessory.ts`
|
|
@@ -1002,7 +1002,7 @@ class SwitchBotPlatform {
|
|
|
1002
1002
|
accessory.context.deviceID = device.deviceId;
|
|
1003
1003
|
accessory.context.firmwareRevision = device.firmware;
|
|
1004
1004
|
accessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
|
|
1005
|
-
|
|
1005
|
+
accessory.context.connectionType = device.connectionType || 'OpenAPI';
|
|
1006
1006
|
// create the accessory handler for the newly create accessory
|
|
1007
1007
|
// this is imported from `platformAccessory.ts`
|
|
1008
1008
|
new plug_1.Plug(this, accessory, device);
|
|
@@ -1030,7 +1030,7 @@ class SwitchBotPlatform {
|
|
|
1030
1030
|
existingAccessory.context.firmwareRevision = device.firmware;
|
|
1031
1031
|
existingAccessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
|
|
1032
1032
|
this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} DeviceID: ${device.deviceId}`);
|
|
1033
|
-
|
|
1033
|
+
existingAccessory.context.connectionType = device.connectionType || 'OpenAPI';
|
|
1034
1034
|
this.api.updatePlatformAccessories([existingAccessory]);
|
|
1035
1035
|
// create the accessory handler for the restored accessory
|
|
1036
1036
|
// this is imported from `platformAccessory.ts`
|
|
@@ -1053,7 +1053,7 @@ class SwitchBotPlatform {
|
|
|
1053
1053
|
accessory.context.deviceID = device.deviceId;
|
|
1054
1054
|
accessory.context.firmwareRevision = device.firmware;
|
|
1055
1055
|
accessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
|
|
1056
|
-
|
|
1056
|
+
accessory.context.connectionType = device.connectionType || 'OpenAPI';
|
|
1057
1057
|
// create the accessory handler for the newly create accessory
|
|
1058
1058
|
// this is imported from `platformAccessory.ts`
|
|
1059
1059
|
new lock_1.Lock(this, accessory, device);
|
|
@@ -1081,7 +1081,7 @@ class SwitchBotPlatform {
|
|
|
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
|
-
|
|
1084
|
+
existingAccessory.context.connectionType = device.connectionType || 'OpenAPI';
|
|
1085
1085
|
this.api.updatePlatformAccessories([existingAccessory]);
|
|
1086
1086
|
// create the accessory handler for the restored accessory
|
|
1087
1087
|
// this is imported from `platformAccessory.ts`
|
|
@@ -1104,7 +1104,7 @@ class SwitchBotPlatform {
|
|
|
1104
1104
|
accessory.context.deviceID = device.deviceId;
|
|
1105
1105
|
accessory.context.firmwareRevision = device.firmware;
|
|
1106
1106
|
accessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
|
|
1107
|
-
|
|
1107
|
+
accessory.context.connectionType = device.connectionType || 'OpenAPI';
|
|
1108
1108
|
// create the accessory handler for the newly create accessory
|
|
1109
1109
|
// this is imported from `platformAccessory.ts`
|
|
1110
1110
|
new colorbulb_1.ColorBulb(this, accessory, device);
|
|
@@ -1132,7 +1132,7 @@ class SwitchBotPlatform {
|
|
|
1132
1132
|
existingAccessory.context.firmwareRevision = device.firmware;
|
|
1133
1133
|
existingAccessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
|
|
1134
1134
|
this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} DeviceID: ${device.deviceId}`);
|
|
1135
|
-
|
|
1135
|
+
existingAccessory.context.connectionType = device.connectionType || 'OpenAPI';
|
|
1136
1136
|
this.api.updatePlatformAccessories([existingAccessory]);
|
|
1137
1137
|
// create the accessory handler for the restored accessory
|
|
1138
1138
|
// this is imported from `platformAccessory.ts`
|
|
@@ -1155,7 +1155,7 @@ class SwitchBotPlatform {
|
|
|
1155
1155
|
accessory.context.deviceID = device.deviceId;
|
|
1156
1156
|
accessory.context.firmwareRevision = device.firmware;
|
|
1157
1157
|
accessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
|
|
1158
|
-
|
|
1158
|
+
accessory.context.connectionType = device.connectionType || 'OpenAPI';
|
|
1159
1159
|
// create the accessory handler for the newly create accessory
|
|
1160
1160
|
// this is imported from `platformAccessory.ts`
|
|
1161
1161
|
new striplight_1.StripLight(this, accessory, device);
|
|
@@ -1181,7 +1181,7 @@ class SwitchBotPlatform {
|
|
|
1181
1181
|
existingAccessory.context.firmwareRevision = device.firmware;
|
|
1182
1182
|
existingAccessory.context.deviceType = `IR: ${device.remoteType}`;
|
|
1183
1183
|
this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} DeviceID: ${device.deviceId}`);
|
|
1184
|
-
|
|
1184
|
+
existingAccessory.context.connectionType = device.connectionType || 'OpenAPI';
|
|
1185
1185
|
this.api.updatePlatformAccessories([existingAccessory]);
|
|
1186
1186
|
// create the accessory handler for the restored accessory
|
|
1187
1187
|
// this is imported from `platformAccessory.ts`
|
|
@@ -1200,7 +1200,7 @@ class SwitchBotPlatform {
|
|
|
1200
1200
|
accessory.context.deviceID = device.deviceId;
|
|
1201
1201
|
accessory.context.firmwareRevision = device.firmware;
|
|
1202
1202
|
accessory.context.deviceType = `IR: ${device.remoteType}`;
|
|
1203
|
-
|
|
1203
|
+
accessory.context.connectionType = device.connectionType || 'OpenAPI';
|
|
1204
1204
|
// create the accessory handler for the newly create accessory
|
|
1205
1205
|
// this is imported from `platformAccessory.ts`
|
|
1206
1206
|
new tv_1.TV(this, accessory, device);
|
|
@@ -1232,7 +1232,7 @@ class SwitchBotPlatform {
|
|
|
1232
1232
|
existingAccessory.context.firmwareRevision = device.firmware;
|
|
1233
1233
|
existingAccessory.context.deviceType = `IR: ${device.remoteType}`;
|
|
1234
1234
|
this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} DeviceID: ${device.deviceId}`);
|
|
1235
|
-
|
|
1235
|
+
existingAccessory.context.connectionType = device.connectionType || 'OpenAPI';
|
|
1236
1236
|
this.api.updatePlatformAccessories([existingAccessory]);
|
|
1237
1237
|
// create the accessory handler for the restored accessory
|
|
1238
1238
|
// this is imported from `platformAccessory.ts`
|
|
@@ -1255,7 +1255,7 @@ class SwitchBotPlatform {
|
|
|
1255
1255
|
accessory.context.deviceID = device.deviceId;
|
|
1256
1256
|
accessory.context.firmwareRevision = device.firmware;
|
|
1257
1257
|
accessory.context.deviceType = `IR: ${device.remoteType}`;
|
|
1258
|
-
|
|
1258
|
+
accessory.context.connectionType = device.connectionType || 'OpenAPI';
|
|
1259
1259
|
// create the accessory handler for the newly create accessory
|
|
1260
1260
|
// this is imported from `platformAccessory.ts`
|
|
1261
1261
|
new fan_1.Fan(this, accessory, device);
|
|
@@ -1283,7 +1283,7 @@ class SwitchBotPlatform {
|
|
|
1283
1283
|
existingAccessory.context.firmwareRevision = device.firmware;
|
|
1284
1284
|
existingAccessory.context.deviceType = `IR: ${device.remoteType}`;
|
|
1285
1285
|
this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} DeviceID: ${device.deviceId}`);
|
|
1286
|
-
|
|
1286
|
+
existingAccessory.context.connectionType = device.connectionType || 'OpenAPI';
|
|
1287
1287
|
this.api.updatePlatformAccessories([existingAccessory]);
|
|
1288
1288
|
// create the accessory handler for the restored accessory
|
|
1289
1289
|
// this is imported from `platformAccessory.ts`
|
|
@@ -1306,7 +1306,7 @@ class SwitchBotPlatform {
|
|
|
1306
1306
|
accessory.context.deviceID = device.deviceId;
|
|
1307
1307
|
accessory.context.firmwareRevision = device.firmware;
|
|
1308
1308
|
accessory.context.deviceType = `IR: ${device.remoteType}`;
|
|
1309
|
-
|
|
1309
|
+
accessory.context.connectionType = device.connectionType || 'OpenAPI';
|
|
1310
1310
|
// create the accessory handler for the newly create accessory
|
|
1311
1311
|
// this is imported from `platformAccessory.ts`
|
|
1312
1312
|
new light_1.Light(this, accessory, device);
|
|
@@ -1334,7 +1334,7 @@ class SwitchBotPlatform {
|
|
|
1334
1334
|
existingAccessory.context.firmwareRevision = device.firmware;
|
|
1335
1335
|
existingAccessory.context.deviceType = `IR: ${device.remoteType}`;
|
|
1336
1336
|
this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} DeviceID: ${device.deviceId}`);
|
|
1337
|
-
|
|
1337
|
+
existingAccessory.context.connectionType = device.connectionType || 'OpenAPI';
|
|
1338
1338
|
this.api.updatePlatformAccessories([existingAccessory]);
|
|
1339
1339
|
// create the accessory handler for the restored accessory
|
|
1340
1340
|
// this is imported from `platformAccessory.ts`
|
|
@@ -1357,7 +1357,7 @@ class SwitchBotPlatform {
|
|
|
1357
1357
|
accessory.context.deviceID = device.deviceId;
|
|
1358
1358
|
accessory.context.firmwareRevision = device.firmware;
|
|
1359
1359
|
accessory.context.deviceType = `IR: ${device.remoteType}`;
|
|
1360
|
-
|
|
1360
|
+
accessory.context.connectionType = device.connectionType || 'OpenAPI';
|
|
1361
1361
|
// create the accessory handler for the newly create accessory
|
|
1362
1362
|
// this is imported from `platformAccessory.ts`
|
|
1363
1363
|
new airconditioner_1.AirConditioner(this, accessory, device);
|
|
@@ -1385,7 +1385,7 @@ class SwitchBotPlatform {
|
|
|
1385
1385
|
existingAccessory.context.firmwareRevision = device.firmware;
|
|
1386
1386
|
existingAccessory.context.deviceType = `IR: ${device.remoteType}`;
|
|
1387
1387
|
this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} DeviceID: ${device.deviceId}`);
|
|
1388
|
-
|
|
1388
|
+
existingAccessory.context.connectionType = device.connectionType || 'OpenAPI';
|
|
1389
1389
|
this.api.updatePlatformAccessories([existingAccessory]);
|
|
1390
1390
|
// create the accessory handler for the restored accessory
|
|
1391
1391
|
// this is imported from `platformAccessory.ts`
|
|
@@ -1408,7 +1408,7 @@ class SwitchBotPlatform {
|
|
|
1408
1408
|
accessory.context.deviceID = device.deviceId;
|
|
1409
1409
|
accessory.context.firmwareRevision = device.firmware;
|
|
1410
1410
|
accessory.context.deviceType = `IR: ${device.remoteType}`;
|
|
1411
|
-
|
|
1411
|
+
accessory.context.connectionType = device.connectionType || 'OpenAPI';
|
|
1412
1412
|
// create the accessory handler for the newly create accessory
|
|
1413
1413
|
// this is imported from `platformAccessory.ts`
|
|
1414
1414
|
new airpurifier_1.AirPurifier(this, accessory, device);
|
|
@@ -1436,7 +1436,7 @@ class SwitchBotPlatform {
|
|
|
1436
1436
|
existingAccessory.context.firmwareRevision = device.firmware;
|
|
1437
1437
|
existingAccessory.context.deviceType = `IR: ${device.remoteType}`;
|
|
1438
1438
|
this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} DeviceID: ${device.deviceId}`);
|
|
1439
|
-
|
|
1439
|
+
existingAccessory.context.connectionType = device.connectionType || 'OpenAPI';
|
|
1440
1440
|
this.api.updatePlatformAccessories([existingAccessory]);
|
|
1441
1441
|
// create the accessory handler for the restored accessory
|
|
1442
1442
|
// this is imported from `platformAccessory.ts`
|
|
@@ -1459,7 +1459,7 @@ class SwitchBotPlatform {
|
|
|
1459
1459
|
accessory.context.deviceID = device.deviceId;
|
|
1460
1460
|
accessory.context.firmwareRevision = device.firmware;
|
|
1461
1461
|
accessory.context.deviceType = `IR: ${device.remoteType}`;
|
|
1462
|
-
|
|
1462
|
+
accessory.context.connectionType = device.connectionType || 'OpenAPI';
|
|
1463
1463
|
// create the accessory handler for the newly create accessory
|
|
1464
1464
|
// this is imported from `platformAccessory.ts`
|
|
1465
1465
|
new waterheater_1.WaterHeater(this, accessory, device);
|
|
@@ -1487,7 +1487,7 @@ class SwitchBotPlatform {
|
|
|
1487
1487
|
existingAccessory.context.firmwareRevision = device.firmware;
|
|
1488
1488
|
existingAccessory.context.deviceType = `IR: ${device.remoteType}`;
|
|
1489
1489
|
this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} DeviceID: ${device.deviceId}`);
|
|
1490
|
-
|
|
1490
|
+
existingAccessory.context.connectionType = device.connectionType || 'OpenAPI';
|
|
1491
1491
|
this.api.updatePlatformAccessories([existingAccessory]);
|
|
1492
1492
|
// create the accessory handler for the restored accessory
|
|
1493
1493
|
// this is imported from `platformAccessory.ts`
|
|
@@ -1510,7 +1510,7 @@ class SwitchBotPlatform {
|
|
|
1510
1510
|
accessory.context.deviceID = device.deviceId;
|
|
1511
1511
|
accessory.context.firmwareRevision = device.firmware;
|
|
1512
1512
|
accessory.context.deviceType = `IR: ${device.remoteType}`;
|
|
1513
|
-
|
|
1513
|
+
accessory.context.connectionType = device.connectionType || 'OpenAPI';
|
|
1514
1514
|
// create the accessory handler for the newly create accessory
|
|
1515
1515
|
// this is imported from `platformAccessory.ts`
|
|
1516
1516
|
new vacuumcleaner_1.VacuumCleaner(this, accessory, device);
|
|
@@ -1538,7 +1538,7 @@ class SwitchBotPlatform {
|
|
|
1538
1538
|
existingAccessory.context.firmwareRevision = device.firmware;
|
|
1539
1539
|
existingAccessory.context.deviceType = `IR: ${device.remoteType}`;
|
|
1540
1540
|
this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} DeviceID: ${device.deviceId}`);
|
|
1541
|
-
|
|
1541
|
+
existingAccessory.context.connectionType = device.connectionType || 'OpenAPI';
|
|
1542
1542
|
this.api.updatePlatformAccessories([existingAccessory]);
|
|
1543
1543
|
// create the accessory handler for the restored accessory
|
|
1544
1544
|
// this is imported from `platformAccessory.ts`
|
|
@@ -1561,7 +1561,7 @@ class SwitchBotPlatform {
|
|
|
1561
1561
|
accessory.context.deviceID = device.deviceId;
|
|
1562
1562
|
accessory.context.firmwareRevision = device.firmware;
|
|
1563
1563
|
accessory.context.deviceType = `IR: ${device.remoteType}`;
|
|
1564
|
-
|
|
1564
|
+
accessory.context.connectionType = device.connectionType || 'OpenAPI';
|
|
1565
1565
|
// create the accessory handler for the newly create accessory
|
|
1566
1566
|
// this is imported from `platformAccessory.ts`
|
|
1567
1567
|
new camera_1.Camera(this, accessory, device);
|
|
@@ -1589,7 +1589,7 @@ class SwitchBotPlatform {
|
|
|
1589
1589
|
existingAccessory.context.firmwareRevision = device.firmware;
|
|
1590
1590
|
existingAccessory.context.deviceType = `IR: ${device.remoteType}`;
|
|
1591
1591
|
this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} DeviceID: ${device.deviceId}`);
|
|
1592
|
-
|
|
1592
|
+
existingAccessory.context.connectionType = device.connectionType || 'OpenAPI';
|
|
1593
1593
|
this.api.updatePlatformAccessories([existingAccessory]);
|
|
1594
1594
|
// create the accessory handler for the restored accessory
|
|
1595
1595
|
// this is imported from `platformAccessory.ts`
|
|
@@ -1612,7 +1612,7 @@ class SwitchBotPlatform {
|
|
|
1612
1612
|
accessory.context.deviceID = device.deviceId;
|
|
1613
1613
|
accessory.context.firmwareRevision = device.firmware;
|
|
1614
1614
|
accessory.context.deviceType = `IR: ${device.remoteType}`;
|
|
1615
|
-
|
|
1615
|
+
accessory.context.connectionType = device.connectionType || 'OpenAPI';
|
|
1616
1616
|
// create the accessory handler for the newly create accessory
|
|
1617
1617
|
// this is imported from `platformAccessory.ts`
|
|
1618
1618
|
new other_1.Others(this, accessory, device);
|
|
@@ -1626,16 +1626,16 @@ class SwitchBotPlatform {
|
|
|
1626
1626
|
}
|
|
1627
1627
|
}
|
|
1628
1628
|
registerDevice(device) {
|
|
1629
|
-
if (!device.hide_device && device.enableCloudService && device.
|
|
1629
|
+
if (!device.hide_device && device.enableCloudService && device.connectionType === 'Both') {
|
|
1630
1630
|
this.registeringDevice = true;
|
|
1631
1631
|
this.debugLog(`Device: ${device.deviceName} Both OpenAPI and BLE Connections Enabled`);
|
|
1632
1632
|
}
|
|
1633
1633
|
else if (!device.hide_device && device.deviceId && device.configDeviceType && device.configDeviceName
|
|
1634
|
-
&& !device.enableCloudService) {
|
|
1634
|
+
&& !device.enableCloudService && device.connectionType === 'BLE') {
|
|
1635
1635
|
this.registeringDevice = true;
|
|
1636
1636
|
this.debugLog(`Device: ${device.deviceName} BLE Connection Enabled`);
|
|
1637
1637
|
}
|
|
1638
|
-
else if (!device.hide_device && device.enableCloudService &&
|
|
1638
|
+
else if (!device.hide_device && device.enableCloudService && device.connectionType === 'OpenAPI') {
|
|
1639
1639
|
this.registeringDevice = true;
|
|
1640
1640
|
this.debugLog(`Device: ${device.deviceName} OpenAPI Connection Enabled`);
|
|
1641
1641
|
}
|
|
@@ -1658,28 +1658,6 @@ class SwitchBotPlatform {
|
|
|
1658
1658
|
async externalAccessory(accessory) {
|
|
1659
1659
|
this.api.publishExternalAccessories(settings_1.PLUGIN_NAME, [accessory]);
|
|
1660
1660
|
}
|
|
1661
|
-
async connectionTypeNewAccessory(device, accessory) {
|
|
1662
|
-
if (device.ble) {
|
|
1663
|
-
accessory.context.connectionType = 'BLE';
|
|
1664
|
-
}
|
|
1665
|
-
else {
|
|
1666
|
-
accessory.context.connectionType = 'OpenAPI';
|
|
1667
|
-
}
|
|
1668
|
-
}
|
|
1669
|
-
async connectionTypeExistingAccessory(device, existingAccessory) {
|
|
1670
|
-
if (device.ble) {
|
|
1671
|
-
existingAccessory.context.connectionType = 'BLE';
|
|
1672
|
-
}
|
|
1673
|
-
else {
|
|
1674
|
-
existingAccessory.context.connectionType = 'OpenAPI';
|
|
1675
|
-
}
|
|
1676
|
-
}
|
|
1677
|
-
async connectionTypeNewIRAccessory(accessory) {
|
|
1678
|
-
accessory.context.connectionType = 'IR wirth OpenAPI';
|
|
1679
|
-
}
|
|
1680
|
-
async connectionTypeExistingIRAccessory(existingAccessory) {
|
|
1681
|
-
existingAccessory.context.connectionType = 'IR with OpenAPI';
|
|
1682
|
-
}
|
|
1683
1661
|
unregisterPlatformAccessories(existingAccessory) {
|
|
1684
1662
|
// remove platform accessories when no longer present
|
|
1685
1663
|
this.api.unregisterPlatformAccessories(settings_1.PLUGIN_NAME, settings_1.PLATFORM_NAME, [existingAccessory]);
|