@switchbot/homebridge-switchbot 1.10.2-beta.5 → 1.11.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/CHANGELOG.md +3 -3
- package/config.schema.json +49 -0
- package/dist/device/bot.d.ts +43 -40
- package/dist/device/bot.d.ts.map +1 -1
- package/dist/device/bot.js +29 -26
- package/dist/device/bot.js.map +1 -1
- package/dist/device/colorbulb.d.ts +25 -21
- package/dist/device/colorbulb.d.ts.map +1 -1
- package/dist/device/colorbulb.js +176 -145
- package/dist/device/colorbulb.js.map +1 -1
- package/dist/device/contact.d.ts +15 -15
- package/dist/device/contact.d.ts.map +1 -1
- package/dist/device/contact.js +14 -13
- package/dist/device/contact.js.map +1 -1
- package/dist/device/curtain.d.ts +25 -22
- package/dist/device/curtain.d.ts.map +1 -1
- package/dist/device/curtain.js +50 -37
- package/dist/device/curtain.js.map +1 -1
- package/dist/device/humidifier.d.ts +23 -20
- package/dist/device/humidifier.d.ts.map +1 -1
- package/dist/device/humidifier.js +41 -41
- package/dist/device/humidifier.js.map +1 -1
- package/dist/device/lock.d.ts +16 -13
- package/dist/device/lock.d.ts.map +1 -1
- package/dist/device/lock.js +20 -22
- package/dist/device/lock.js.map +1 -1
- package/dist/device/meter.d.ts +15 -15
- package/dist/device/meter.d.ts.map +1 -1
- package/dist/device/meter.js +11 -14
- package/dist/device/meter.js.map +1 -1
- package/dist/device/motion.d.ts +16 -16
- package/dist/device/motion.d.ts.map +1 -1
- package/dist/device/motion.js +16 -17
- package/dist/device/motion.js.map +1 -1
- package/dist/device/plug.d.ts +10 -7
- package/dist/device/plug.d.ts.map +1 -1
- package/dist/device/plug.js +22 -21
- package/dist/device/plug.js.map +1 -1
- package/dist/settings.d.ts +4 -1
- package/dist/settings.d.ts.map +1 -1
- package/dist/settings.js.map +1 -1
- package/package.json +76 -76
- package/src/device/bot.ts +53 -50
- package/src/device/colorbulb.ts +208 -162
- package/src/device/contact.ts +31 -30
- package/src/device/curtain.ts +68 -57
- package/src/device/humidifier.ts +68 -59
- package/src/device/lock.ts +28 -31
- package/src/device/meter.ts +25 -31
- package/src/device/motion.ts +32 -36
- package/src/device/plug.ts +25 -25
- package/src/settings.ts +5 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. This project uses [Semantic Versioning](https://semver.org/)
|
|
4
4
|
|
|
5
|
-
## [
|
|
5
|
+
## [Version 1.11.0](https://github.com/OpenWonderLabs/homebridge-switchbot/releases/tag/v1.11.0) (2022-01-29)
|
|
6
6
|
|
|
7
7
|
## What's Changed
|
|
8
|
-
* Add Support for SwitchBot Lock
|
|
8
|
+
* Add Support for SwitchBot Smart Lock
|
|
9
9
|
* Add Support for SwitchBot Strip Light
|
|
10
10
|
* Add Support for SwitchBot Meter Plus (US)
|
|
11
11
|
* Add Support for SwitchBot Meter Plus (JP)
|
|
@@ -14,7 +14,7 @@ All notable changes to this project will be documented in this file. This projec
|
|
|
14
14
|
* Fixed: Curtain `set_min` and `set_max` options not work correctly with minimum and maximum curtain state. [#123](https://github.com/OpenWonderLabs/homebridge-switchbot/issues/123)
|
|
15
15
|
* Housekeeping and updated dependencies.
|
|
16
16
|
|
|
17
|
-
**Full Changelog**: https://github.com/OpenWonderLabs/homebridge-switchbot/compare/v1.10.1...v1.
|
|
17
|
+
**Full Changelog**: https://github.com/OpenWonderLabs/homebridge-switchbot/compare/v1.10.1...v1.11.0
|
|
18
18
|
|
|
19
19
|
## [Version 1.10.1](https://github.com/OpenWonderLabs/homebridge-switchbot/releases/tag/v1.10.1) (2022-01-26)
|
|
20
20
|
|
package/config.schema.json
CHANGED
|
@@ -128,6 +128,42 @@
|
|
|
128
128
|
"enum": [
|
|
129
129
|
"Smart Fan"
|
|
130
130
|
]
|
|
131
|
+
},
|
|
132
|
+
{
|
|
133
|
+
"title": "Smart Lock",
|
|
134
|
+
"enum": [
|
|
135
|
+
"Smart Lock"
|
|
136
|
+
]
|
|
137
|
+
},
|
|
138
|
+
{
|
|
139
|
+
"title": "Strip Light",
|
|
140
|
+
"enum": [
|
|
141
|
+
"Strip Light"
|
|
142
|
+
]
|
|
143
|
+
},
|
|
144
|
+
{
|
|
145
|
+
"title": "Meter Plus (US)",
|
|
146
|
+
"enum": [
|
|
147
|
+
"Meter Plus (US)"
|
|
148
|
+
]
|
|
149
|
+
},
|
|
150
|
+
{
|
|
151
|
+
"title": "Meter Plus (JP)",
|
|
152
|
+
"enum": [
|
|
153
|
+
"Meter Plus (JP)"
|
|
154
|
+
]
|
|
155
|
+
},
|
|
156
|
+
{
|
|
157
|
+
"title": "Plug Mini (US)",
|
|
158
|
+
"enum": [
|
|
159
|
+
"Plug Mini (US)"
|
|
160
|
+
]
|
|
161
|
+
},
|
|
162
|
+
{
|
|
163
|
+
"title": "Plug Mini (JP)",
|
|
164
|
+
"enum": [
|
|
165
|
+
"Plug Mini (JP)"
|
|
166
|
+
]
|
|
131
167
|
}
|
|
132
168
|
],
|
|
133
169
|
"condition": {
|
|
@@ -457,6 +493,18 @@
|
|
|
457
493
|
}
|
|
458
494
|
}
|
|
459
495
|
},
|
|
496
|
+
"lock": {
|
|
497
|
+
"type": "object",
|
|
498
|
+
"properties": {
|
|
499
|
+
"hide_contactsensor": {
|
|
500
|
+
"title": "Hide Lock's Contact Sensor",
|
|
501
|
+
"type": "boolean",
|
|
502
|
+
"condition": {
|
|
503
|
+
"functionBody": "return (model.options && model.options.devices && !model.options.devices[arrayIndices].hide_device && model.options.devices[arrayIndices].configDeviceType === 'Smart Lock' && model.options.devices[arrayIndices].deviceId);"
|
|
504
|
+
}
|
|
505
|
+
}
|
|
506
|
+
}
|
|
507
|
+
},
|
|
460
508
|
"refreshRate": {
|
|
461
509
|
"title": "Device Refresh Rate",
|
|
462
510
|
"type": "number",
|
|
@@ -938,6 +986,7 @@
|
|
|
938
986
|
"options.devices[].motion.set_maxlux",
|
|
939
987
|
"options.devices[].colorbulb.set_minStep",
|
|
940
988
|
"options.devices[].colorbulb.adaptiveLightingShift",
|
|
989
|
+
"options.devices[].lock.hide_contactsensor",
|
|
941
990
|
"options.devices[].refreshRate",
|
|
942
991
|
"options.devices[].logging"
|
|
943
992
|
]
|
package/dist/device/bot.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import { AxiosResponse } from 'axios';
|
|
1
2
|
import { Subject } from 'rxjs';
|
|
2
3
|
import { SwitchBotPlatform } from '../platform';
|
|
3
|
-
import { PlatformAccessory, CharacteristicValue } from 'homebridge';
|
|
4
|
+
import { Service, PlatformAccessory, CharacteristicValue } from 'homebridge';
|
|
4
5
|
import { device, devicesConfig, serviceData, switchbot, deviceStatusResponse, deviceStatus } from '../settings';
|
|
5
6
|
/**
|
|
6
7
|
* Platform Accessory
|
|
@@ -11,17 +12,17 @@ export declare class Bot {
|
|
|
11
12
|
private readonly platform;
|
|
12
13
|
private accessory;
|
|
13
14
|
device: device & devicesConfig;
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
15
|
+
fanService?: Service;
|
|
16
|
+
doorService?: Service;
|
|
17
|
+
lockService?: Service;
|
|
18
|
+
faucetService?: Service;
|
|
19
|
+
windowService?: Service;
|
|
20
|
+
switchService?: Service;
|
|
21
|
+
outletService?: Service;
|
|
22
|
+
batteryService?: Service;
|
|
23
|
+
garageDoorService?: Service;
|
|
24
|
+
windowCoveringService?: Service;
|
|
25
|
+
statefulProgrammableSwitchService?: Service;
|
|
25
26
|
On: CharacteristicValue;
|
|
26
27
|
OnCached: CharacteristicValue;
|
|
27
28
|
BatteryLevel: CharacteristicValue;
|
|
@@ -48,14 +49,14 @@ export declare class Bot {
|
|
|
48
49
|
* Parse the device status from the SwitchBot api
|
|
49
50
|
*/
|
|
50
51
|
parseStatus(): Promise<void>;
|
|
51
|
-
|
|
52
|
-
|
|
52
|
+
BLEparseStatus(): Promise<void>;
|
|
53
|
+
openAPIparseStatus(): Promise<void>;
|
|
53
54
|
/**
|
|
54
55
|
* Asks the SwitchBot API for the latest device information
|
|
55
56
|
*/
|
|
56
57
|
refreshStatus(): Promise<void>;
|
|
57
|
-
|
|
58
|
-
|
|
58
|
+
BLERefreshStatus(): Promise<void>;
|
|
59
|
+
openAPIRefreshStatus(): Promise<void>;
|
|
59
60
|
/**
|
|
60
61
|
* Pushes the requested changes to the SwitchBot API
|
|
61
62
|
* deviceType commandType Command command parameter Description
|
|
@@ -64,36 +65,38 @@ export declare class Bot {
|
|
|
64
65
|
* Bot - "command" "press" "default" = trigger press
|
|
65
66
|
*/
|
|
66
67
|
pushChanges(): Promise<void>;
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
68
|
+
BLEpushChanges(): Promise<void>;
|
|
69
|
+
turnOnOff(device_list: any): Promise<any>;
|
|
70
|
+
openAPIpushChanges(): Promise<void>;
|
|
70
71
|
/**
|
|
71
72
|
* Updates the status for each of the HomeKit Characteristics
|
|
72
73
|
*/
|
|
73
|
-
updateHomeKitCharacteristics(): void
|
|
74
|
-
apiError(e: any): void
|
|
75
|
-
|
|
76
|
-
|
|
74
|
+
updateHomeKitCharacteristics(): Promise<void>;
|
|
75
|
+
apiError(e: any): Promise<void>;
|
|
76
|
+
statusCode(push: AxiosResponse<{
|
|
77
|
+
statusCode: number;
|
|
78
|
+
}>): Promise<void>;
|
|
79
|
+
offlineOff(): Promise<void>;
|
|
77
80
|
/**
|
|
78
81
|
* Handle requests to set the "On" characteristic
|
|
79
82
|
*/
|
|
80
|
-
|
|
81
|
-
config(device: device & devicesConfig): void
|
|
82
|
-
refreshRate(device: device & devicesConfig): void
|
|
83
|
-
scan(device: device & devicesConfig): void
|
|
84
|
-
logs(device: device & devicesConfig): void
|
|
85
|
-
PressOrSwitch(device: device & devicesConfig): void
|
|
86
|
-
allowPushChanges(device: device & devicesConfig): void
|
|
87
|
-
removeOutletService(accessory: PlatformAccessory): void
|
|
88
|
-
removeGarageDoorService(accessory: PlatformAccessory): void
|
|
89
|
-
removeDoorService(accessory: PlatformAccessory): void
|
|
90
|
-
removeLockService(accessory: PlatformAccessory): void
|
|
91
|
-
removeFaucetService(accessory: PlatformAccessory): void
|
|
92
|
-
removeFanService(accessory: PlatformAccessory): void
|
|
93
|
-
removeWindowService(accessory: PlatformAccessory): void
|
|
94
|
-
removeWindowCoveringService(accessory: PlatformAccessory): void
|
|
95
|
-
removeStatefulProgrammableSwitchService(accessory: PlatformAccessory): void
|
|
96
|
-
removeSwitchService(accessory: PlatformAccessory): void
|
|
83
|
+
handleOnSet(value: CharacteristicValue): Promise<void>;
|
|
84
|
+
config(device: device & devicesConfig): Promise<void>;
|
|
85
|
+
refreshRate(device: device & devicesConfig): Promise<void>;
|
|
86
|
+
scan(device: device & devicesConfig): Promise<void>;
|
|
87
|
+
logs(device: device & devicesConfig): Promise<void>;
|
|
88
|
+
PressOrSwitch(device: device & devicesConfig): Promise<void>;
|
|
89
|
+
allowPushChanges(device: device & devicesConfig): Promise<void>;
|
|
90
|
+
removeOutletService(accessory: PlatformAccessory): Promise<void>;
|
|
91
|
+
removeGarageDoorService(accessory: PlatformAccessory): Promise<void>;
|
|
92
|
+
removeDoorService(accessory: PlatformAccessory): Promise<void>;
|
|
93
|
+
removeLockService(accessory: PlatformAccessory): Promise<void>;
|
|
94
|
+
removeFaucetService(accessory: PlatformAccessory): Promise<void>;
|
|
95
|
+
removeFanService(accessory: PlatformAccessory): Promise<void>;
|
|
96
|
+
removeWindowService(accessory: PlatformAccessory): Promise<void>;
|
|
97
|
+
removeWindowCoveringService(accessory: PlatformAccessory): Promise<void>;
|
|
98
|
+
removeStatefulProgrammableSwitchService(accessory: PlatformAccessory): Promise<void>;
|
|
99
|
+
removeSwitchService(accessory: PlatformAccessory): Promise<void>;
|
|
97
100
|
/**
|
|
98
101
|
* Logging for Device
|
|
99
102
|
*/
|
package/dist/device/bot.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bot.d.ts","sourceRoot":"","sources":["../../src/device/bot.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"bot.d.ts","sourceRoot":"","sources":["../../src/device/bot.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AACtC,OAAO,EAAY,OAAO,EAAE,MAAM,MAAM,CAAC;AACzC,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAEhD,OAAO,EAAE,OAAO,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAC7E,OAAO,EAAa,MAAM,EAAE,aAAa,EAAE,WAAW,EAAM,SAAS,EAAE,oBAAoB,EAAW,YAAY,EAAE,MAAM,aAAa,CAAC;AAExI;;;;GAIG;AACH,qBAAa,GAAG;IA+CF,OAAO,CAAC,QAAQ,CAAC,QAAQ;IAAqB,OAAO,CAAC,SAAS;IAA4B,MAAM,EAAE,MAAM,GAAG,aAAa;IA7CrI,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAChC,iCAAiC,CAAC,EAAE,OAAO,CAAC;IAG5C,EAAE,EAAG,mBAAmB,CAAC;IACzB,QAAQ,EAAG,mBAAmB,CAAC;IAC/B,YAAY,EAAG,mBAAmB,CAAC;IACnC,gBAAgB,EAAG,mBAAmB,CAAC;IAGvC,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AAgB,CAAC,SAAS,EAAE,iBAAiB,GAAG,OAAO,CAAC,IAAI,CAAC;IAS7D,mBAAmB,CAAC,SAAS,EAAE,iBAAiB,GAAG,OAAO,CAAC,IAAI,CAAC;IAShE,2BAA2B,CAAC,SAAS,EAAE,iBAAiB,GAAG,OAAO,CAAC,IAAI,CAAC;IASxE,uCAAuC,CAAC,SAAS,EAAE,iBAAiB,GAAG,OAAO,CAAC,IAAI,CAAC;IASpF,mBAAmB,CAAC,SAAS,EAAE,iBAAiB,GAAG,OAAO,CAAC,IAAI,CAAC;IAStE;;OAEG;IACH,OAAO,CAAC,GAAG,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI;IAM5B,OAAO,CAAC,GAAG,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI;IAM5B,QAAQ,CAAC,GAAG,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI;IAM7B,QAAQ,CAAC,GAAG,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI;IAU7B,qBAAqB,IAAI,OAAO;CAGjC"}
|
package/dist/device/bot.js
CHANGED
|
@@ -274,8 +274,8 @@ class Bot {
|
|
|
274
274
|
// Start an update interval
|
|
275
275
|
(0, rxjs_1.interval)(this.deviceRefreshRate * 1000)
|
|
276
276
|
.pipe((0, operators_1.skipWhile)(() => this.botUpdateInProgress))
|
|
277
|
-
.subscribe(() => {
|
|
278
|
-
this.refreshStatus();
|
|
277
|
+
.subscribe(async () => {
|
|
278
|
+
await this.refreshStatus();
|
|
279
279
|
});
|
|
280
280
|
// Watch for Bot change events
|
|
281
281
|
// We put in a debounce of 100ms so we don't make duplicate calls
|
|
@@ -495,8 +495,8 @@ class Bot {
|
|
|
495
495
|
(0, rxjs_1.interval)(5000)
|
|
496
496
|
.pipe((0, operators_1.skipWhile)(() => this.botUpdateInProgress))
|
|
497
497
|
.pipe((0, operators_1.take)(1))
|
|
498
|
-
.subscribe(() => {
|
|
499
|
-
this.refreshStatus();
|
|
498
|
+
.subscribe(async () => {
|
|
499
|
+
await this.refreshStatus();
|
|
500
500
|
});
|
|
501
501
|
}
|
|
502
502
|
async BLEpushChanges() {
|
|
@@ -591,7 +591,7 @@ class Bot {
|
|
|
591
591
|
this.OnCached = this.On;
|
|
592
592
|
this.accessory.context.On = this.OnCached;
|
|
593
593
|
}
|
|
594
|
-
turnOnOff(device_list) {
|
|
594
|
+
async turnOnOff(device_list) {
|
|
595
595
|
if (this.On) {
|
|
596
596
|
return device_list[0].turnOn({ id: this.device.bleMac });
|
|
597
597
|
}
|
|
@@ -651,7 +651,7 @@ class Bot {
|
|
|
651
651
|
/**
|
|
652
652
|
* Updates the status for each of the HomeKit Characteristics
|
|
653
653
|
*/
|
|
654
|
-
updateHomeKitCharacteristics() {
|
|
654
|
+
async updateHomeKitCharacteristics() {
|
|
655
655
|
if (this.device.bot?.deviceType === 'garagedoor') {
|
|
656
656
|
if (this.On === undefined) {
|
|
657
657
|
this.debugLog(`Bot: ${this.accessory.displayName} On: ${this.On}`);
|
|
@@ -833,7 +833,7 @@ class Bot {
|
|
|
833
833
|
}
|
|
834
834
|
}
|
|
835
835
|
}
|
|
836
|
-
apiError(e) {
|
|
836
|
+
async apiError(e) {
|
|
837
837
|
if (this.device.bot?.deviceType === 'garagedoor') {
|
|
838
838
|
this.garageDoorService?.updateCharacteristic(this.platform.Characteristic.TargetDoorState, e);
|
|
839
839
|
this.garageDoorService?.updateCharacteristic(this.platform.Characteristic.CurrentDoorState, e);
|
|
@@ -880,7 +880,7 @@ class Bot {
|
|
|
880
880
|
}
|
|
881
881
|
//throw new this.platform.api.hap.HapStatusError(HAPStatus.SERVICE_COMMUNICATION_FAILURE);
|
|
882
882
|
}
|
|
883
|
-
statusCode(push) {
|
|
883
|
+
async statusCode(push) {
|
|
884
884
|
switch (push.data.statusCode) {
|
|
885
885
|
case 151:
|
|
886
886
|
this.errorLog(`Bot: ${this.accessory.displayName} Command not supported by this device type.`);
|
|
@@ -910,7 +910,7 @@ class Bot {
|
|
|
910
910
|
this.debugLog(`Bot: ${this.accessory.displayName} Unknown statusCode.`);
|
|
911
911
|
}
|
|
912
912
|
}
|
|
913
|
-
offlineOff() {
|
|
913
|
+
async offlineOff() {
|
|
914
914
|
if (this.device.offline) {
|
|
915
915
|
this.On = false;
|
|
916
916
|
if (this.device.bot?.deviceType === 'switch') {
|
|
@@ -924,7 +924,7 @@ class Bot {
|
|
|
924
924
|
/**
|
|
925
925
|
* Handle requests to set the "On" characteristic
|
|
926
926
|
*/
|
|
927
|
-
handleOnSet(value) {
|
|
927
|
+
async handleOnSet(value) {
|
|
928
928
|
if (this.device.bot?.deviceType === 'garagedoor') {
|
|
929
929
|
this.debugLog(`Bot: ${this.accessory.displayName} TargetDoorState: ${value}`);
|
|
930
930
|
if (value === this.platform.Characteristic.TargetDoorState.CLOSED) {
|
|
@@ -978,7 +978,7 @@ class Bot {
|
|
|
978
978
|
}
|
|
979
979
|
this.doBotUpdate.next();
|
|
980
980
|
}
|
|
981
|
-
config(device) {
|
|
981
|
+
async config(device) {
|
|
982
982
|
let config = {};
|
|
983
983
|
if (device.bot) {
|
|
984
984
|
config = device.bot;
|
|
@@ -995,11 +995,14 @@ class Bot {
|
|
|
995
995
|
if (device.scanDuration !== undefined) {
|
|
996
996
|
config['scanDuration'] = device.scanDuration;
|
|
997
997
|
}
|
|
998
|
+
if (device.offline !== undefined) {
|
|
999
|
+
config['offline'] = device.offline;
|
|
1000
|
+
}
|
|
998
1001
|
if (Object.entries(config).length !== 0) {
|
|
999
1002
|
this.warnLog(`Bot: ${this.accessory.displayName} Config: ${JSON.stringify(config)}`);
|
|
1000
1003
|
}
|
|
1001
1004
|
}
|
|
1002
|
-
refreshRate(device) {
|
|
1005
|
+
async refreshRate(device) {
|
|
1003
1006
|
if (device.refreshRate) {
|
|
1004
1007
|
this.deviceRefreshRate = this.accessory.context.refreshRate = device.refreshRate;
|
|
1005
1008
|
this.debugLog(`Bot: ${this.accessory.displayName} Using Device Config refreshRate: ${this.deviceRefreshRate}`);
|
|
@@ -1009,7 +1012,7 @@ class Bot {
|
|
|
1009
1012
|
this.debugLog(`Bot: ${this.accessory.displayName} Using Platform Config refreshRate: ${this.deviceRefreshRate}`);
|
|
1010
1013
|
}
|
|
1011
1014
|
}
|
|
1012
|
-
scan(device) {
|
|
1015
|
+
async scan(device) {
|
|
1013
1016
|
if (device.scanDuration) {
|
|
1014
1017
|
this.scanDuration = this.accessory.context.scanDuration = device.scanDuration;
|
|
1015
1018
|
if (device.ble) {
|
|
@@ -1023,7 +1026,7 @@ class Bot {
|
|
|
1023
1026
|
}
|
|
1024
1027
|
}
|
|
1025
1028
|
}
|
|
1026
|
-
logs(device) {
|
|
1029
|
+
async logs(device) {
|
|
1027
1030
|
if (this.platform.debugMode) {
|
|
1028
1031
|
this.deviceLogging = this.accessory.context.logging = 'debugMode';
|
|
1029
1032
|
this.debugLog(`Bot: ${this.accessory.displayName} Using Debug Mode Logging: ${this.deviceLogging}`);
|
|
@@ -1041,7 +1044,7 @@ class Bot {
|
|
|
1041
1044
|
this.debugLog(`Bot: ${this.accessory.displayName} Logging Not Set, Using: ${this.deviceLogging}`);
|
|
1042
1045
|
}
|
|
1043
1046
|
}
|
|
1044
|
-
PressOrSwitch(device) {
|
|
1047
|
+
async PressOrSwitch(device) {
|
|
1045
1048
|
if (!device.bot?.mode) {
|
|
1046
1049
|
this.botMode = 'switch';
|
|
1047
1050
|
this.warnLog(`Bot: ${this.accessory.displayName} does not have bot mode set in the Plugin's SwitchBot Device Settings,`);
|
|
@@ -1059,7 +1062,7 @@ class Bot {
|
|
|
1059
1062
|
throw new Error(`Bot: ${this.accessory.displayName} Bot Mode: ${this.botMode}`);
|
|
1060
1063
|
}
|
|
1061
1064
|
}
|
|
1062
|
-
allowPushChanges(device) {
|
|
1065
|
+
async allowPushChanges(device) {
|
|
1063
1066
|
if (device.bot?.allowPush) {
|
|
1064
1067
|
this.allowPush = true;
|
|
1065
1068
|
}
|
|
@@ -1068,7 +1071,7 @@ class Bot {
|
|
|
1068
1071
|
}
|
|
1069
1072
|
this.debugLog(`Bot: ${this.accessory.displayName} Allowing Push Changes: ${this.allowPush}`);
|
|
1070
1073
|
}
|
|
1071
|
-
removeOutletService(accessory) {
|
|
1074
|
+
async removeOutletService(accessory) {
|
|
1072
1075
|
// If outletService still pressent, then remove first
|
|
1073
1076
|
this.outletService = this.accessory.getService(this.platform.Service.Outlet);
|
|
1074
1077
|
if (this.outletService) {
|
|
@@ -1076,7 +1079,7 @@ class Bot {
|
|
|
1076
1079
|
}
|
|
1077
1080
|
accessory.removeService(this.outletService);
|
|
1078
1081
|
}
|
|
1079
|
-
removeGarageDoorService(accessory) {
|
|
1082
|
+
async removeGarageDoorService(accessory) {
|
|
1080
1083
|
// If garageDoorService still pressent, then remove first
|
|
1081
1084
|
this.garageDoorService = this.accessory.getService(this.platform.Service.GarageDoorOpener);
|
|
1082
1085
|
if (this.garageDoorService) {
|
|
@@ -1084,7 +1087,7 @@ class Bot {
|
|
|
1084
1087
|
}
|
|
1085
1088
|
accessory.removeService(this.garageDoorService);
|
|
1086
1089
|
}
|
|
1087
|
-
removeDoorService(accessory) {
|
|
1090
|
+
async removeDoorService(accessory) {
|
|
1088
1091
|
// If doorService still pressent, then remove first
|
|
1089
1092
|
this.doorService = this.accessory.getService(this.platform.Service.Door);
|
|
1090
1093
|
if (this.doorService) {
|
|
@@ -1092,7 +1095,7 @@ class Bot {
|
|
|
1092
1095
|
}
|
|
1093
1096
|
accessory.removeService(this.doorService);
|
|
1094
1097
|
}
|
|
1095
|
-
removeLockService(accessory) {
|
|
1098
|
+
async removeLockService(accessory) {
|
|
1096
1099
|
// If lockService still pressent, then remove first
|
|
1097
1100
|
this.lockService = this.accessory.getService(this.platform.Service.LockMechanism);
|
|
1098
1101
|
if (this.lockService) {
|
|
@@ -1100,7 +1103,7 @@ class Bot {
|
|
|
1100
1103
|
}
|
|
1101
1104
|
accessory.removeService(this.lockService);
|
|
1102
1105
|
}
|
|
1103
|
-
removeFaucetService(accessory) {
|
|
1106
|
+
async removeFaucetService(accessory) {
|
|
1104
1107
|
// If faucetService still pressent, then remove first
|
|
1105
1108
|
this.faucetService = this.accessory.getService(this.platform.Service.Faucet);
|
|
1106
1109
|
if (this.faucetService) {
|
|
@@ -1108,7 +1111,7 @@ class Bot {
|
|
|
1108
1111
|
}
|
|
1109
1112
|
accessory.removeService(this.faucetService);
|
|
1110
1113
|
}
|
|
1111
|
-
removeFanService(accessory) {
|
|
1114
|
+
async removeFanService(accessory) {
|
|
1112
1115
|
// If fanService still pressent, then remove first
|
|
1113
1116
|
this.fanService = this.accessory.getService(this.platform.Service.Fan);
|
|
1114
1117
|
if (this.fanService) {
|
|
@@ -1116,7 +1119,7 @@ class Bot {
|
|
|
1116
1119
|
}
|
|
1117
1120
|
accessory.removeService(this.fanService);
|
|
1118
1121
|
}
|
|
1119
|
-
removeWindowService(accessory) {
|
|
1122
|
+
async removeWindowService(accessory) {
|
|
1120
1123
|
// If windowService still pressent, then remove first
|
|
1121
1124
|
this.windowService = this.accessory.getService(this.platform.Service.Window);
|
|
1122
1125
|
if (this.windowService) {
|
|
@@ -1124,7 +1127,7 @@ class Bot {
|
|
|
1124
1127
|
}
|
|
1125
1128
|
accessory.removeService(this.windowService);
|
|
1126
1129
|
}
|
|
1127
|
-
removeWindowCoveringService(accessory) {
|
|
1130
|
+
async removeWindowCoveringService(accessory) {
|
|
1128
1131
|
// If windowCoveringService still pressent, then remove first
|
|
1129
1132
|
this.windowCoveringService = this.accessory.getService(this.platform.Service.WindowCovering);
|
|
1130
1133
|
if (this.windowCoveringService) {
|
|
@@ -1132,7 +1135,7 @@ class Bot {
|
|
|
1132
1135
|
}
|
|
1133
1136
|
accessory.removeService(this.windowCoveringService);
|
|
1134
1137
|
}
|
|
1135
|
-
removeStatefulProgrammableSwitchService(accessory) {
|
|
1138
|
+
async removeStatefulProgrammableSwitchService(accessory) {
|
|
1136
1139
|
// If statefulProgrammableSwitchService still pressent, then remove first
|
|
1137
1140
|
this.statefulProgrammableSwitchService = this.accessory.getService(this.platform.Service.StatefulProgrammableSwitch);
|
|
1138
1141
|
if (this.statefulProgrammableSwitchService) {
|
|
@@ -1140,7 +1143,7 @@ class Bot {
|
|
|
1140
1143
|
}
|
|
1141
1144
|
accessory.removeService(this.statefulProgrammableSwitchService);
|
|
1142
1145
|
}
|
|
1143
|
-
removeSwitchService(accessory) {
|
|
1146
|
+
async removeSwitchService(accessory) {
|
|
1144
1147
|
// If switchService still pressent, then remove first
|
|
1145
1148
|
this.switchService = this.accessory.getService(this.platform.Service.Switch);
|
|
1146
1149
|
if (this.switchService) {
|