@switchbot/homebridge-switchbot 1.12.9-beta.7 → 1.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/workflows/codeql-analysis.yml +3 -3
- package/.github/workflows/dependabot.yml +17 -0
- package/.github/workflows/nodejs-beta.yml +0 -3
- package/.github/workflows/nodejs.yml +0 -3
- package/CHANGELOG.md +3 -1
- package/config.schema.json +1 -1
- package/dist/device/bot.d.ts +3 -0
- package/dist/device/bot.d.ts.map +1 -1
- package/dist/device/bot.js +18 -1
- package/dist/device/bot.js.map +1 -1
- package/dist/device/colorbulb.d.ts +3 -0
- package/dist/device/colorbulb.d.ts.map +1 -1
- package/dist/device/colorbulb.js +18 -1
- package/dist/device/colorbulb.js.map +1 -1
- package/dist/device/contact.d.ts +3 -0
- package/dist/device/contact.d.ts.map +1 -1
- package/dist/device/contact.js +18 -1
- package/dist/device/contact.js.map +1 -1
- package/dist/device/curtain.d.ts +6 -0
- package/dist/device/curtain.d.ts.map +1 -1
- package/dist/device/curtain.js +57 -1
- package/dist/device/curtain.js.map +1 -1
- package/dist/device/humidifier.d.ts +3 -0
- package/dist/device/humidifier.d.ts.map +1 -1
- package/dist/device/humidifier.js +18 -1
- package/dist/device/humidifier.js.map +1 -1
- package/dist/device/lock.d.ts +3 -0
- package/dist/device/lock.d.ts.map +1 -1
- package/dist/device/lock.js +18 -1
- package/dist/device/lock.js.map +1 -1
- package/dist/device/meter.d.ts +9 -0
- package/dist/device/meter.d.ts.map +1 -1
- package/dist/device/meter.js +82 -6
- package/dist/device/meter.js.map +1 -1
- package/dist/device/meterplus.d.ts +3 -0
- package/dist/device/meterplus.d.ts.map +1 -1
- package/dist/device/meterplus.js +18 -1
- package/dist/device/meterplus.js.map +1 -1
- package/dist/device/motion.d.ts +3 -0
- package/dist/device/motion.d.ts.map +1 -1
- package/dist/device/motion.js +18 -1
- package/dist/device/motion.js.map +1 -1
- package/dist/device/plug.d.ts +3 -0
- package/dist/device/plug.d.ts.map +1 -1
- package/dist/device/plug.js +18 -1
- package/dist/device/plug.js.map +1 -1
- package/dist/device/striplight.d.ts +3 -0
- package/dist/device/striplight.d.ts.map +1 -1
- package/dist/device/striplight.js +18 -1
- package/dist/device/striplight.js.map +1 -1
- package/dist/irdevice/other.js +3 -3
- package/dist/irdevice/other.js.map +1 -1
- package/dist/platform.d.ts +1 -0
- package/dist/platform.d.ts.map +1 -1
- package/dist/platform.js +44 -41
- package/dist/platform.js.map +1 -1
- package/dist/settings.d.ts +5 -0
- package/dist/settings.d.ts.map +1 -1
- package/dist/settings.js.map +1 -1
- package/package.json +78 -76
- package/src/device/bot.ts +18 -1
- package/src/device/colorbulb.ts +18 -1
- package/src/device/contact.ts +18 -1
- package/src/device/curtain.ts +60 -1
- package/src/device/humidifier.ts +18 -1
- package/src/device/lock.ts +18 -1
- package/src/device/meter.ts +90 -6
- package/src/device/meterplus.ts +18 -1
- package/src/device/motion.ts +18 -1
- package/src/device/plug.ts +18 -1
- package/src/device/striplight.ts +18 -1
- package/src/irdevice/other.ts +3 -3
- package/src/platform.ts +47 -41
- package/src/settings.ts +5 -0
package/src/platform.ts
CHANGED
|
@@ -21,6 +21,7 @@ import { AirConditioner } from './irdevice/airconditioner';
|
|
|
21
21
|
import axios, { AxiosInstance, AxiosRequestConfig } from 'axios';
|
|
22
22
|
import { API, DynamicPlatformPlugin, Logger, PlatformAccessory, Service, Characteristic } from 'homebridge';
|
|
23
23
|
import { PLATFORM_NAME, PLUGIN_NAME, DeviceURL, irdevice, device, SwitchBotPlatformConfig, deviceResponses, devicesConfig } from './settings';
|
|
24
|
+
import fakegato from 'fakegato-history';
|
|
24
25
|
|
|
25
26
|
/**
|
|
26
27
|
* HomebridgePlatform
|
|
@@ -38,12 +39,14 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
38
39
|
responseType: 'json',
|
|
39
40
|
});
|
|
40
41
|
|
|
41
|
-
version = require('../package.json').version; // eslint-disable-line @typescript-eslint/no-var-requires
|
|
42
|
+
version = require('../package.json').version || '1.12.8'; // eslint-disable-line @typescript-eslint/no-var-requires
|
|
42
43
|
deviceStatus!: deviceResponses;
|
|
43
44
|
registeringDevice!: boolean;
|
|
44
45
|
debugMode!: boolean;
|
|
45
46
|
platformLogging?: string;
|
|
46
47
|
|
|
48
|
+
public readonly fakegatoAPI: any;
|
|
49
|
+
|
|
47
50
|
constructor(public readonly log: Logger, public readonly config: SwitchBotPlatformConfig, public readonly api: API) {
|
|
48
51
|
this.logs();
|
|
49
52
|
this.debugLog('Finished initializing platform:', this.config.name);
|
|
@@ -76,6 +79,9 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
76
79
|
return request;
|
|
77
80
|
});
|
|
78
81
|
|
|
82
|
+
// import fakegato-history module
|
|
83
|
+
this.fakegatoAPI = fakegato(api);
|
|
84
|
+
|
|
79
85
|
// When this event is fired it means Homebridge has restored all cached accessories from disk.
|
|
80
86
|
// Dynamic Platform plugins should only register new accessories after this event was fired,
|
|
81
87
|
// in order to ensure they weren't added to homebridge already. This event can also be used
|
|
@@ -525,7 +531,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
525
531
|
existingAccessory.context.model = device.deviceType;
|
|
526
532
|
existingAccessory.context.deviceID = device.deviceId;
|
|
527
533
|
existingAccessory.displayName = device.deviceName;
|
|
528
|
-
existingAccessory.context.firmwareRevision = device.firmware
|
|
534
|
+
existingAccessory.context.firmwareRevision = device.firmware;
|
|
529
535
|
existingAccessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
|
|
530
536
|
await this.connectionTypeExistingAccessory(device, existingAccessory);
|
|
531
537
|
this.api.updatePlatformAccessories([existingAccessory]);
|
|
@@ -548,7 +554,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
548
554
|
accessory.context.device = device;
|
|
549
555
|
accessory.context.model = device.deviceType;
|
|
550
556
|
accessory.context.deviceID = device.deviceId;
|
|
551
|
-
accessory.context.firmwareRevision = device.firmware
|
|
557
|
+
accessory.context.firmwareRevision = device.firmware;
|
|
552
558
|
accessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
|
|
553
559
|
await this.connectionTypeNewAccessory(device, accessory);
|
|
554
560
|
// create the accessory handler for the newly create accessory
|
|
@@ -582,7 +588,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
582
588
|
existingAccessory.context.model = device.deviceType;
|
|
583
589
|
existingAccessory.context.deviceID = device.deviceId;
|
|
584
590
|
existingAccessory.displayName = device.deviceName;
|
|
585
|
-
existingAccessory.context.firmwareRevision = device.firmware
|
|
591
|
+
existingAccessory.context.firmwareRevision = device.firmware;
|
|
586
592
|
existingAccessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
|
|
587
593
|
await this.connectionTypeExistingAccessory(device, existingAccessory);
|
|
588
594
|
this.api.updatePlatformAccessories([existingAccessory]);
|
|
@@ -607,7 +613,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
607
613
|
accessory.context.device = device;
|
|
608
614
|
accessory.context.model = device.deviceType;
|
|
609
615
|
accessory.context.deviceID = device.deviceId;
|
|
610
|
-
accessory.context.firmwareRevision = device.firmware
|
|
616
|
+
accessory.context.firmwareRevision = device.firmware;
|
|
611
617
|
accessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
|
|
612
618
|
await this.connectionTypeNewAccessory(device, accessory);
|
|
613
619
|
// accessory.context.firmwareRevision = findaccessories.accessoryAttribute.softwareRevision;
|
|
@@ -640,7 +646,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
640
646
|
existingAccessory.context.model = device.deviceType;
|
|
641
647
|
existingAccessory.context.deviceID = device.deviceId;
|
|
642
648
|
existingAccessory.displayName = device.deviceName;
|
|
643
|
-
existingAccessory.context.firmwareRevision = device.firmware
|
|
649
|
+
existingAccessory.context.firmwareRevision = device.firmware;
|
|
644
650
|
existingAccessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
|
|
645
651
|
await this.connectionTypeExistingAccessory(device, existingAccessory);
|
|
646
652
|
this.api.updatePlatformAccessories([existingAccessory]);
|
|
@@ -663,7 +669,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
663
669
|
accessory.context.device = device;
|
|
664
670
|
accessory.context.model = device.deviceType;
|
|
665
671
|
accessory.context.deviceID = device.deviceId;
|
|
666
|
-
accessory.context.firmwareRevision = device.firmware
|
|
672
|
+
accessory.context.firmwareRevision = device.firmware;
|
|
667
673
|
accessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
|
|
668
674
|
await this.connectionTypeNewAccessory(device, accessory);
|
|
669
675
|
// create the accessory handler for the newly create accessory
|
|
@@ -695,7 +701,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
695
701
|
existingAccessory.context.model = device.deviceType;
|
|
696
702
|
existingAccessory.context.deviceID = device.deviceId;
|
|
697
703
|
existingAccessory.displayName = device.deviceName;
|
|
698
|
-
existingAccessory.context.firmwareRevision = device.firmware
|
|
704
|
+
existingAccessory.context.firmwareRevision = device.firmware;
|
|
699
705
|
existingAccessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
|
|
700
706
|
await this.connectionTypeExistingAccessory(device, existingAccessory);
|
|
701
707
|
this.api.updatePlatformAccessories([existingAccessory]);
|
|
@@ -718,7 +724,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
718
724
|
accessory.context.device = device;
|
|
719
725
|
accessory.context.model = device.deviceType;
|
|
720
726
|
accessory.context.deviceID = device.deviceId;
|
|
721
|
-
accessory.context.firmwareRevision = device.firmware
|
|
727
|
+
accessory.context.firmwareRevision = device.firmware;
|
|
722
728
|
accessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
|
|
723
729
|
await this.connectionTypeNewAccessory(device, accessory);
|
|
724
730
|
// create the accessory handler for the newly create accessory
|
|
@@ -750,7 +756,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
750
756
|
existingAccessory.context.model = device.deviceType;
|
|
751
757
|
existingAccessory.context.deviceID = device.deviceId;
|
|
752
758
|
existingAccessory.displayName = device.deviceName;
|
|
753
|
-
existingAccessory.context.firmwareRevision = device.firmware
|
|
759
|
+
existingAccessory.context.firmwareRevision = device.firmware;
|
|
754
760
|
existingAccessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
|
|
755
761
|
await this.connectionTypeExistingAccessory(device, existingAccessory);
|
|
756
762
|
this.api.updatePlatformAccessories([existingAccessory]);
|
|
@@ -773,7 +779,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
773
779
|
accessory.context.device = device;
|
|
774
780
|
accessory.context.model = device.deviceType;
|
|
775
781
|
accessory.context.deviceID = device.deviceId;
|
|
776
|
-
accessory.context.firmwareRevision = device.firmware
|
|
782
|
+
accessory.context.firmwareRevision = device.firmware;
|
|
777
783
|
accessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
|
|
778
784
|
await this.connectionTypeNewAccessory(device, accessory);
|
|
779
785
|
// create the accessory handler for the newly create accessory
|
|
@@ -805,7 +811,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
805
811
|
existingAccessory.context.model = device.deviceType;
|
|
806
812
|
existingAccessory.context.deviceID = device.deviceId;
|
|
807
813
|
existingAccessory.displayName = device.deviceName;
|
|
808
|
-
existingAccessory.context.firmwareRevision = device.firmware
|
|
814
|
+
existingAccessory.context.firmwareRevision = device.firmware;
|
|
809
815
|
existingAccessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
|
|
810
816
|
await this.connectionTypeExistingAccessory(device, existingAccessory);
|
|
811
817
|
this.api.updatePlatformAccessories([existingAccessory]);
|
|
@@ -828,7 +834,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
828
834
|
accessory.context.device = device;
|
|
829
835
|
accessory.context.model = device.deviceType;
|
|
830
836
|
accessory.context.deviceID = device.deviceId;
|
|
831
|
-
accessory.context.firmwareRevision = device.firmware
|
|
837
|
+
accessory.context.firmwareRevision = device.firmware;
|
|
832
838
|
accessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
|
|
833
839
|
await this.connectionTypeNewAccessory(device, accessory);
|
|
834
840
|
// create the accessory handler for the newly create accessory
|
|
@@ -860,7 +866,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
860
866
|
existingAccessory.context.model = device.deviceType;
|
|
861
867
|
existingAccessory.context.deviceID = device.deviceId;
|
|
862
868
|
existingAccessory.displayName = device.deviceName;
|
|
863
|
-
existingAccessory.context.firmwareRevision = device.firmware
|
|
869
|
+
existingAccessory.context.firmwareRevision = device.firmware;
|
|
864
870
|
existingAccessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
|
|
865
871
|
await this.connectionTypeExistingAccessory(device, existingAccessory);
|
|
866
872
|
this.api.updatePlatformAccessories([existingAccessory]);
|
|
@@ -894,7 +900,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
894
900
|
accessory.context.device = device;
|
|
895
901
|
accessory.context.model = device.deviceType;
|
|
896
902
|
accessory.context.deviceID = device.deviceId;
|
|
897
|
-
accessory.context.firmwareRevision = device.firmware
|
|
903
|
+
accessory.context.firmwareRevision = device.firmware;
|
|
898
904
|
accessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
|
|
899
905
|
await this.connectionTypeNewAccessory(device, accessory);
|
|
900
906
|
// create the accessory handler for the newly create accessory
|
|
@@ -941,7 +947,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
941
947
|
existingAccessory.context.model = device.deviceType;
|
|
942
948
|
existingAccessory.context.deviceID = device.deviceId;
|
|
943
949
|
existingAccessory.displayName = device.deviceName;
|
|
944
|
-
existingAccessory.context.firmwareRevision = device.firmware
|
|
950
|
+
existingAccessory.context.firmwareRevision = device.firmware;
|
|
945
951
|
existingAccessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
|
|
946
952
|
await this.connectionTypeExistingAccessory(device, existingAccessory);
|
|
947
953
|
this.api.updatePlatformAccessories([existingAccessory]);
|
|
@@ -964,7 +970,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
964
970
|
accessory.context.device = device;
|
|
965
971
|
accessory.context.model = device.deviceType;
|
|
966
972
|
accessory.context.deviceID = device.deviceId;
|
|
967
|
-
accessory.context.firmwareRevision = device.firmware
|
|
973
|
+
accessory.context.firmwareRevision = device.firmware;
|
|
968
974
|
accessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
|
|
969
975
|
await this.connectionTypeNewAccessory(device, accessory);
|
|
970
976
|
// create the accessory handler for the newly create accessory
|
|
@@ -996,7 +1002,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
996
1002
|
existingAccessory.context.model = device.deviceType;
|
|
997
1003
|
existingAccessory.context.deviceID = device.deviceId;
|
|
998
1004
|
existingAccessory.displayName = device.deviceName;
|
|
999
|
-
existingAccessory.context.firmwareRevision = device.firmware
|
|
1005
|
+
existingAccessory.context.firmwareRevision = device.firmware;
|
|
1000
1006
|
existingAccessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
|
|
1001
1007
|
await this.connectionTypeExistingAccessory(device, existingAccessory);
|
|
1002
1008
|
this.api.updatePlatformAccessories([existingAccessory]);
|
|
@@ -1019,7 +1025,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
1019
1025
|
accessory.context.device = device;
|
|
1020
1026
|
accessory.context.model = device.deviceType;
|
|
1021
1027
|
accessory.context.deviceID = device.deviceId;
|
|
1022
|
-
accessory.context.firmwareRevision = device.firmware
|
|
1028
|
+
accessory.context.firmwareRevision = device.firmware;
|
|
1023
1029
|
accessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
|
|
1024
1030
|
await this.connectionTypeNewAccessory(device, accessory);
|
|
1025
1031
|
// create the accessory handler for the newly create accessory
|
|
@@ -1051,7 +1057,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
1051
1057
|
existingAccessory.context.model = device.deviceType;
|
|
1052
1058
|
existingAccessory.context.deviceID = device.deviceId;
|
|
1053
1059
|
existingAccessory.displayName = device.deviceName;
|
|
1054
|
-
existingAccessory.context.firmwareRevision = device.firmware
|
|
1060
|
+
existingAccessory.context.firmwareRevision = device.firmware;
|
|
1055
1061
|
existingAccessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
|
|
1056
1062
|
await this.connectionTypeExistingAccessory(device, existingAccessory);
|
|
1057
1063
|
this.api.updatePlatformAccessories([existingAccessory]);
|
|
@@ -1074,7 +1080,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
1074
1080
|
accessory.context.device = device;
|
|
1075
1081
|
accessory.context.model = device.deviceType;
|
|
1076
1082
|
accessory.context.deviceID = device.deviceId;
|
|
1077
|
-
accessory.context.firmwareRevision = device.firmware
|
|
1083
|
+
accessory.context.firmwareRevision = device.firmware;
|
|
1078
1084
|
accessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
|
|
1079
1085
|
await this.connectionTypeNewAccessory(device, accessory);
|
|
1080
1086
|
// create the accessory handler for the newly create accessory
|
|
@@ -1106,7 +1112,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
1106
1112
|
existingAccessory.context.model = device.deviceType;
|
|
1107
1113
|
existingAccessory.context.deviceID = device.deviceId;
|
|
1108
1114
|
existingAccessory.displayName = device.deviceName;
|
|
1109
|
-
existingAccessory.context.firmwareRevision = device.firmware
|
|
1115
|
+
existingAccessory.context.firmwareRevision = device.firmware;
|
|
1110
1116
|
existingAccessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
|
|
1111
1117
|
await this.connectionTypeExistingAccessory(device, existingAccessory);
|
|
1112
1118
|
this.api.updatePlatformAccessories([existingAccessory]);
|
|
@@ -1129,7 +1135,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
1129
1135
|
accessory.context.device = device;
|
|
1130
1136
|
accessory.context.model = device.deviceType;
|
|
1131
1137
|
accessory.context.deviceID = device.deviceId;
|
|
1132
|
-
accessory.context.firmwareRevision = device.firmware
|
|
1138
|
+
accessory.context.firmwareRevision = device.firmware;
|
|
1133
1139
|
accessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
|
|
1134
1140
|
await this.connectionTypeNewAccessory(device, accessory);
|
|
1135
1141
|
// create the accessory handler for the newly create accessory
|
|
@@ -1159,7 +1165,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
1159
1165
|
existingAccessory.context.model = device.remoteType;
|
|
1160
1166
|
existingAccessory.context.deviceID = device.deviceId;
|
|
1161
1167
|
existingAccessory.displayName = device.deviceName;
|
|
1162
|
-
existingAccessory.context.firmwareRevision = device.firmware
|
|
1168
|
+
existingAccessory.context.firmwareRevision = device.firmware;
|
|
1163
1169
|
existingAccessory.context.deviceType = `IR: ${device.remoteType}`;
|
|
1164
1170
|
await this.connectionTypeExistingIRAccessory(existingAccessory);
|
|
1165
1171
|
this.api.updatePlatformAccessories([existingAccessory]);
|
|
@@ -1179,7 +1185,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
1179
1185
|
accessory.context.device = device;
|
|
1180
1186
|
accessory.context.model = device.remoteType;
|
|
1181
1187
|
accessory.context.deviceID = device.deviceId;
|
|
1182
|
-
accessory.context.firmwareRevision = device.firmware
|
|
1188
|
+
accessory.context.firmwareRevision = device.firmware;
|
|
1183
1189
|
accessory.context.deviceType = `IR: ${device.remoteType}`;
|
|
1184
1190
|
await this.connectionTypeNewIRAccessory(accessory);
|
|
1185
1191
|
// create the accessory handler for the newly create accessory
|
|
@@ -1216,7 +1222,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
1216
1222
|
existingAccessory.context.model = device.remoteType;
|
|
1217
1223
|
existingAccessory.context.deviceID = device.deviceId;
|
|
1218
1224
|
existingAccessory.displayName = device.deviceName;
|
|
1219
|
-
existingAccessory.context.firmwareRevision = device.firmware
|
|
1225
|
+
existingAccessory.context.firmwareRevision = device.firmware;
|
|
1220
1226
|
existingAccessory.context.deviceType = `IR: ${device.remoteType}`;
|
|
1221
1227
|
await this.connectionTypeExistingIRAccessory(existingAccessory);
|
|
1222
1228
|
this.api.updatePlatformAccessories([existingAccessory]);
|
|
@@ -1239,7 +1245,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
1239
1245
|
accessory.context.device = device;
|
|
1240
1246
|
accessory.context.model = device.remoteType;
|
|
1241
1247
|
accessory.context.deviceID = device.deviceId;
|
|
1242
|
-
accessory.context.firmwareRevision = device.firmware
|
|
1248
|
+
accessory.context.firmwareRevision = device.firmware;
|
|
1243
1249
|
accessory.context.deviceType = `IR: ${device.remoteType}`;
|
|
1244
1250
|
await this.connectionTypeNewIRAccessory(accessory);
|
|
1245
1251
|
// create the accessory handler for the newly create accessory
|
|
@@ -1271,7 +1277,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
1271
1277
|
existingAccessory.context.model = device.remoteType;
|
|
1272
1278
|
existingAccessory.context.deviceID = device.deviceId;
|
|
1273
1279
|
existingAccessory.displayName = device.deviceName;
|
|
1274
|
-
existingAccessory.context.firmwareRevision = device.firmware
|
|
1280
|
+
existingAccessory.context.firmwareRevision = device.firmware;
|
|
1275
1281
|
existingAccessory.context.deviceType = `IR: ${device.remoteType}`;
|
|
1276
1282
|
await this.connectionTypeExistingIRAccessory(existingAccessory);
|
|
1277
1283
|
this.api.updatePlatformAccessories([existingAccessory]);
|
|
@@ -1294,7 +1300,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
1294
1300
|
accessory.context.device = device;
|
|
1295
1301
|
accessory.context.model = device.remoteType;
|
|
1296
1302
|
accessory.context.deviceID = device.deviceId;
|
|
1297
|
-
accessory.context.firmwareRevision = device.firmware
|
|
1303
|
+
accessory.context.firmwareRevision = device.firmware;
|
|
1298
1304
|
accessory.context.deviceType = `IR: ${device.remoteType}`;
|
|
1299
1305
|
await this.connectionTypeNewIRAccessory(accessory);
|
|
1300
1306
|
// create the accessory handler for the newly create accessory
|
|
@@ -1326,7 +1332,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
1326
1332
|
existingAccessory.context.model = device.remoteType;
|
|
1327
1333
|
existingAccessory.context.deviceID = device.deviceId;
|
|
1328
1334
|
existingAccessory.displayName = device.deviceName;
|
|
1329
|
-
existingAccessory.context.firmwareRevision = device.firmware
|
|
1335
|
+
existingAccessory.context.firmwareRevision = device.firmware;
|
|
1330
1336
|
existingAccessory.context.deviceType = `IR: ${device.remoteType}`;
|
|
1331
1337
|
await this.connectionTypeExistingIRAccessory(existingAccessory);
|
|
1332
1338
|
this.api.updatePlatformAccessories([existingAccessory]);
|
|
@@ -1349,7 +1355,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
1349
1355
|
accessory.context.device = device;
|
|
1350
1356
|
accessory.context.model = device.remoteType;
|
|
1351
1357
|
accessory.context.deviceID = device.deviceId;
|
|
1352
|
-
accessory.context.firmwareRevision = device.firmware
|
|
1358
|
+
accessory.context.firmwareRevision = device.firmware;
|
|
1353
1359
|
accessory.context.deviceType = `IR: ${device.remoteType}`;
|
|
1354
1360
|
await this.connectionTypeNewIRAccessory(accessory);
|
|
1355
1361
|
// create the accessory handler for the newly create accessory
|
|
@@ -1381,7 +1387,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
1381
1387
|
existingAccessory.context.model = device.remoteType;
|
|
1382
1388
|
existingAccessory.context.deviceID = device.deviceId;
|
|
1383
1389
|
existingAccessory.displayName = device.deviceName;
|
|
1384
|
-
existingAccessory.context.firmwareRevision = device.firmware
|
|
1390
|
+
existingAccessory.context.firmwareRevision = device.firmware;
|
|
1385
1391
|
existingAccessory.context.deviceType = `IR: ${device.remoteType}`;
|
|
1386
1392
|
await this.connectionTypeExistingIRAccessory(existingAccessory);
|
|
1387
1393
|
this.api.updatePlatformAccessories([existingAccessory]);
|
|
@@ -1404,7 +1410,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
1404
1410
|
accessory.context.device = device;
|
|
1405
1411
|
accessory.context.model = device.remoteType;
|
|
1406
1412
|
accessory.context.deviceID = device.deviceId;
|
|
1407
|
-
accessory.context.firmwareRevision = device.firmware
|
|
1413
|
+
accessory.context.firmwareRevision = device.firmware;
|
|
1408
1414
|
accessory.context.deviceType = `IR: ${device.remoteType}`;
|
|
1409
1415
|
await this.connectionTypeNewIRAccessory(accessory);
|
|
1410
1416
|
// create the accessory handler for the newly create accessory
|
|
@@ -1436,7 +1442,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
1436
1442
|
existingAccessory.context.model = device.remoteType;
|
|
1437
1443
|
existingAccessory.context.deviceID = device.deviceId;
|
|
1438
1444
|
existingAccessory.displayName = device.deviceName;
|
|
1439
|
-
existingAccessory.context.firmwareRevision = device.firmware
|
|
1445
|
+
existingAccessory.context.firmwareRevision = device.firmware;
|
|
1440
1446
|
existingAccessory.context.deviceType = `IR: ${device.remoteType}`;
|
|
1441
1447
|
await this.connectionTypeExistingIRAccessory(existingAccessory);
|
|
1442
1448
|
this.api.updatePlatformAccessories([existingAccessory]);
|
|
@@ -1459,7 +1465,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
1459
1465
|
accessory.context.device = device;
|
|
1460
1466
|
accessory.context.model = device.remoteType;
|
|
1461
1467
|
accessory.context.deviceID = device.deviceId;
|
|
1462
|
-
accessory.context.firmwareRevision = device.firmware
|
|
1468
|
+
accessory.context.firmwareRevision = device.firmware;
|
|
1463
1469
|
accessory.context.deviceType = `IR: ${device.remoteType}`;
|
|
1464
1470
|
await this.connectionTypeNewIRAccessory(accessory);
|
|
1465
1471
|
// create the accessory handler for the newly create accessory
|
|
@@ -1491,7 +1497,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
1491
1497
|
existingAccessory.context.model = device.remoteType;
|
|
1492
1498
|
existingAccessory.context.deviceID = device.deviceId;
|
|
1493
1499
|
existingAccessory.displayName = device.deviceName;
|
|
1494
|
-
existingAccessory.context.firmwareRevision = device.firmware
|
|
1500
|
+
existingAccessory.context.firmwareRevision = device.firmware;
|
|
1495
1501
|
existingAccessory.context.deviceType = `IR: ${device.remoteType}`;
|
|
1496
1502
|
await this.connectionTypeExistingIRAccessory(existingAccessory);
|
|
1497
1503
|
this.api.updatePlatformAccessories([existingAccessory]);
|
|
@@ -1514,7 +1520,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
1514
1520
|
accessory.context.device = device;
|
|
1515
1521
|
accessory.context.model = device.remoteType;
|
|
1516
1522
|
accessory.context.deviceID = device.deviceId;
|
|
1517
|
-
accessory.context.firmwareRevision = device.firmware
|
|
1523
|
+
accessory.context.firmwareRevision = device.firmware;
|
|
1518
1524
|
accessory.context.deviceType = `IR: ${device.remoteType}`;
|
|
1519
1525
|
await this.connectionTypeNewIRAccessory(accessory);
|
|
1520
1526
|
// create the accessory handler for the newly create accessory
|
|
@@ -1546,7 +1552,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
1546
1552
|
existingAccessory.context.model = device.remoteType;
|
|
1547
1553
|
existingAccessory.context.deviceID = device.deviceId;
|
|
1548
1554
|
existingAccessory.displayName = device.deviceName;
|
|
1549
|
-
existingAccessory.context.firmwareRevision = device.firmware
|
|
1555
|
+
existingAccessory.context.firmwareRevision = device.firmware;
|
|
1550
1556
|
existingAccessory.context.deviceType = `IR: ${device.remoteType}`;
|
|
1551
1557
|
await this.connectionTypeExistingIRAccessory(existingAccessory);
|
|
1552
1558
|
this.api.updatePlatformAccessories([existingAccessory]);
|
|
@@ -1569,7 +1575,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
1569
1575
|
accessory.context.device = device;
|
|
1570
1576
|
accessory.context.model = device.remoteType;
|
|
1571
1577
|
accessory.context.deviceID = device.deviceId;
|
|
1572
|
-
accessory.context.firmwareRevision = device.firmware
|
|
1578
|
+
accessory.context.firmwareRevision = device.firmware;
|
|
1573
1579
|
accessory.context.deviceType = `IR: ${device.remoteType}`;
|
|
1574
1580
|
await this.connectionTypeNewIRAccessory(accessory);
|
|
1575
1581
|
// create the accessory handler for the newly create accessory
|
|
@@ -1601,7 +1607,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
1601
1607
|
existingAccessory.context.model = device.remoteType;
|
|
1602
1608
|
existingAccessory.context.deviceID = device.deviceId;
|
|
1603
1609
|
existingAccessory.displayName = device.deviceName;
|
|
1604
|
-
existingAccessory.context.firmwareRevision = device.firmware
|
|
1610
|
+
existingAccessory.context.firmwareRevision = device.firmware;
|
|
1605
1611
|
existingAccessory.context.deviceType = `IR: ${device.remoteType}`;
|
|
1606
1612
|
await this.connectionTypeExistingIRAccessory(existingAccessory);
|
|
1607
1613
|
this.api.updatePlatformAccessories([existingAccessory]);
|
|
@@ -1624,7 +1630,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
1624
1630
|
accessory.context.device = device;
|
|
1625
1631
|
accessory.context.model = device.remoteType;
|
|
1626
1632
|
accessory.context.deviceID = device.deviceId;
|
|
1627
|
-
accessory.context.firmwareRevision = device.firmware
|
|
1633
|
+
accessory.context.firmwareRevision = device.firmware;
|
|
1628
1634
|
accessory.context.deviceType = `IR: ${device.remoteType}`;
|
|
1629
1635
|
await this.connectionTypeNewIRAccessory(accessory);
|
|
1630
1636
|
// create the accessory handler for the newly create accessory
|
package/src/settings.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { MacAddress, PlatformConfig } from 'homebridge';
|
|
2
|
+
import { IClientOptions } from 'async-mqtt';
|
|
2
3
|
/**
|
|
3
4
|
* This is the name of the platform that users will use to register the plugin in the Homebridge config.json
|
|
4
5
|
*/
|
|
@@ -58,6 +59,10 @@ export interface devicesConfig extends device {
|
|
|
58
59
|
scanDuration?: number;
|
|
59
60
|
hide_device?: boolean;
|
|
60
61
|
offline?: boolean;
|
|
62
|
+
mqttURL?: string;
|
|
63
|
+
mqttOptions?: IClientOptions;
|
|
64
|
+
mqttPubOptions?: IClientOptions;
|
|
65
|
+
history?: boolean;
|
|
61
66
|
}
|
|
62
67
|
|
|
63
68
|
export type meter = {
|