@switchbot/homebridge-switchbot 2.8.0-beta.9 → 2.8.1-beta.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 +4 -2
- package/README.md +1 -1
- package/dist/device/blindtilt.d.ts +21 -22
- package/dist/device/blindtilt.d.ts.map +1 -1
- package/dist/device/blindtilt.js +78 -77
- package/dist/device/blindtilt.js.map +1 -1
- package/dist/device/bot.d.ts +11 -13
- package/dist/device/bot.d.ts.map +1 -1
- package/dist/device/bot.js +93 -75
- package/dist/device/bot.js.map +1 -1
- package/dist/device/ceilinglight.d.ts +10 -13
- package/dist/device/ceilinglight.d.ts.map +1 -1
- package/dist/device/ceilinglight.js +40 -27
- package/dist/device/ceilinglight.js.map +1 -1
- package/dist/device/colorbulb.d.ts +16 -23
- package/dist/device/colorbulb.d.ts.map +1 -1
- package/dist/device/colorbulb.js +55 -46
- package/dist/device/colorbulb.js.map +1 -1
- package/dist/device/contact.d.ts +16 -22
- package/dist/device/contact.d.ts.map +1 -1
- package/dist/device/contact.js +82 -73
- package/dist/device/contact.js.map +1 -1
- package/dist/device/curtain.d.ts +21 -24
- package/dist/device/curtain.d.ts.map +1 -1
- package/dist/device/curtain.js +76 -77
- package/dist/device/curtain.js.map +1 -1
- package/dist/device/hub.d.ts +10 -8
- package/dist/device/hub.d.ts.map +1 -1
- package/dist/device/hub.js +50 -35
- package/dist/device/hub.js.map +1 -1
- package/dist/device/humidifier.d.ts +8 -10
- package/dist/device/humidifier.d.ts.map +1 -1
- package/dist/device/humidifier.js +34 -21
- package/dist/device/humidifier.js.map +1 -1
- package/dist/device/iosensor.d.ts +16 -20
- package/dist/device/iosensor.d.ts.map +1 -1
- package/dist/device/iosensor.js +42 -29
- package/dist/device/iosensor.js.map +1 -1
- package/dist/device/lightstrip.d.ts +2 -5
- package/dist/device/lightstrip.d.ts.map +1 -1
- package/dist/device/lightstrip.js +9 -8
- package/dist/device/lightstrip.js.map +1 -1
- package/dist/device/lock.d.ts +15 -19
- package/dist/device/lock.d.ts.map +1 -1
- package/dist/device/lock.js +71 -28
- package/dist/device/lock.js.map +1 -1
- package/dist/device/meter.d.ts +5 -9
- package/dist/device/meter.d.ts.map +1 -1
- package/dist/device/meter.js +16 -20
- package/dist/device/meter.js.map +1 -1
- package/dist/device/meterplus.d.ts +6 -10
- package/dist/device/meterplus.d.ts.map +1 -1
- package/dist/device/meterplus.js +16 -20
- package/dist/device/meterplus.js.map +1 -1
- package/dist/device/motion.d.ts +6 -8
- package/dist/device/motion.d.ts.map +1 -1
- package/dist/device/motion.js +49 -47
- package/dist/device/motion.js.map +1 -1
- package/dist/device/plug.d.ts +2 -5
- package/dist/device/plug.d.ts.map +1 -1
- package/dist/device/plug.js +9 -8
- package/dist/device/plug.js.map +1 -1
- package/dist/device/robotvacuumcleaner.d.ts +6 -8
- package/dist/device/robotvacuumcleaner.d.ts.map +1 -1
- package/dist/device/robotvacuumcleaner.js +20 -4
- package/dist/device/robotvacuumcleaner.js.map +1 -1
- package/dist/irdevice/airconditioner.d.ts +2 -0
- package/dist/irdevice/airconditioner.d.ts.map +1 -1
- package/dist/irdevice/airconditioner.js +67 -86
- package/dist/irdevice/airconditioner.js.map +1 -1
- package/dist/irdevice/airpurifier.js.map +1 -1
- package/dist/irdevice/camera.js.map +1 -1
- package/dist/irdevice/fan.d.ts +0 -1
- package/dist/irdevice/fan.d.ts.map +1 -1
- package/dist/irdevice/fan.js.map +1 -1
- package/dist/irdevice/light.js.map +1 -1
- package/dist/irdevice/other.js.map +1 -1
- package/dist/irdevice/tv.d.ts +0 -1
- package/dist/irdevice/tv.d.ts.map +1 -1
- package/dist/irdevice/tv.js.map +1 -1
- package/dist/irdevice/vacuumcleaner.js.map +1 -1
- package/dist/irdevice/waterheater.js.map +1 -1
- package/dist/platform.d.ts.map +1 -1
- package/dist/platform.js +64 -63
- package/dist/platform.js.map +1 -1
- package/dist/settings.d.ts +3 -1
- package/dist/settings.d.ts.map +1 -1
- package/dist/settings.js.map +1 -1
- package/package.json +12 -12
- package/src/device/blindtilt.ts +103 -100
- package/src/device/bot.ts +105 -89
- package/src/device/ceilinglight.ts +56 -46
- package/src/device/colorbulb.ts +78 -76
- package/src/device/contact.ts +100 -94
- package/src/device/curtain.ts +101 -101
- package/src/device/hub.ts +61 -43
- package/src/device/humidifier.ts +42 -33
- package/src/device/iosensor.ts +59 -50
- package/src/device/lightstrip.ts +14 -17
- package/src/device/lock.ts +91 -50
- package/src/device/meter.ts +22 -30
- package/src/device/meterplus.ts +23 -32
- package/src/device/motion.ts +55 -53
- package/src/device/plug.ts +12 -15
- package/src/device/robotvacuumcleaner.ts +33 -16
- package/src/irdevice/airconditioner.ts +80 -94
- package/src/irdevice/airpurifier.ts +1 -1
- package/src/irdevice/camera.ts +1 -1
- package/src/irdevice/fan.ts +1 -4
- package/src/irdevice/light.ts +1 -1
- package/src/irdevice/other.ts +1 -1
- package/src/irdevice/tv.ts +1 -4
- package/src/irdevice/vacuumcleaner.ts +1 -1
- package/src/irdevice/waterheater.ts +1 -1
- package/src/platform.ts +73 -73
- package/src/settings.ts +6 -2
package/CHANGELOG.md
CHANGED
|
@@ -2,15 +2,17 @@
|
|
|
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
|
-
## [Version 2.8.0](https://github.com/OpenWonderLabs/homebridge-switchbot/releases/tag/v2.8.0) (2023-
|
|
5
|
+
## [Version 2.8.0](https://github.com/OpenWonderLabs/homebridge-switchbot/releases/tag/v2.8.0) (2023-08-19)
|
|
6
6
|
|
|
7
7
|
## What's Changed
|
|
8
8
|
|
|
9
9
|
- Add Hub 2 Light-Level Support. [#776](https://github.com/OpenWonderLabs/homebridge-switchbot/issues/776)
|
|
10
10
|
- Enable Meter Battery Level for OpenAPI, Thanks [@mrlt8](https://github.com/mrlt8) [#782](https://github.com/OpenWonderLabs/homebridge-switchbot/pull/782)
|
|
11
|
+
- Enable Meter Plus Battery Level for OpenAPI, Thanks [@mrlt8](https://github.com/mrlt8) [#787](https://github.com/OpenWonderLabs/homebridge-switchbot/pull/787)
|
|
12
|
+
- Enable Battery Level and Version for OpenAPI for BlindTilt, Bot, Ceiling Lights, Color Bulb, Contact, Curtain, Hub, Humidifier, Indoor/Outdoor Sensor, Light Strip, Lock, Meter, Meter Plus, Motion , Plug, Plug Mini, & Robot Vacuum Cleaner
|
|
11
13
|
- Housekeeping and updated dependencies.
|
|
12
14
|
|
|
13
|
-
**Full Changelog**: https://github.com/OpenWonderLabs/homebridge-switchbot/compare/v2.7.
|
|
15
|
+
**Full Changelog**: https://github.com/OpenWonderLabs/homebridge-switchbot/compare/v2.7.1....v2.8.0
|
|
14
16
|
|
|
15
17
|
## [Version 2.7.1](https://github.com/OpenWonderLabs/homebridge-switchbot/releases/tag/v2.7.1) (2023-07-29)
|
|
16
18
|
|
package/README.md
CHANGED
|
@@ -97,7 +97,7 @@
|
|
|
97
97
|
- Must supply `deviceId` & `deviceName` to Device Config
|
|
98
98
|
- Check `Enable Bluetooth Low Energy (BLE) Connection` on Device Config
|
|
99
99
|
- [SwitchBot Blind Tilt](https://us.switch-bot.com/pages/switchbot-blind-tilt)
|
|
100
|
-
- Supports OpenAPI Connection Only
|
|
100
|
+
- Supports OpenAPI Connection Only
|
|
101
101
|
- If using OpenAPI:
|
|
102
102
|
- [SwitchBot Hub Mini](https://www.switch-bot.com/products/switchbot-hub-mini) or [SwitchBot Hub 2](https://us.switch-bot.com/pages/switchbot-hub-2) Required
|
|
103
103
|
- Enable Cloud Services for Device on SwitchBot App
|
|
@@ -5,7 +5,7 @@ import { MqttClient } from 'mqtt';
|
|
|
5
5
|
import { Subject } from 'rxjs';
|
|
6
6
|
import { SwitchBotPlatform } from '../platform';
|
|
7
7
|
import { Service, PlatformAccessory, CharacteristicValue } from 'homebridge';
|
|
8
|
-
import { device, devicesConfig, serviceData,
|
|
8
|
+
import { device, devicesConfig, serviceData, deviceStatus } from '../settings';
|
|
9
9
|
declare enum BlindTiltMappingMode {
|
|
10
10
|
OnlyUp = "only_up",
|
|
11
11
|
OnlyDown = "only_down",
|
|
@@ -17,35 +17,34 @@ export declare class BlindTilt {
|
|
|
17
17
|
private readonly platform;
|
|
18
18
|
private accessory;
|
|
19
19
|
device: device & devicesConfig;
|
|
20
|
-
|
|
20
|
+
batteryService: Service;
|
|
21
21
|
lightSensorService?: Service;
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
windowCoveringService: Service;
|
|
23
|
+
BatteryLevel: CharacteristicValue;
|
|
24
24
|
PositionState: CharacteristicValue;
|
|
25
25
|
TargetPosition: CharacteristicValue;
|
|
26
|
+
CurrentPosition: CharacteristicValue;
|
|
27
|
+
StatusLowBattery: CharacteristicValue;
|
|
26
28
|
CurrentAmbientLightLevel?: CharacteristicValue;
|
|
27
|
-
BatteryLevel?: CharacteristicValue;
|
|
28
|
-
StatusLowBattery?: CharacteristicValue;
|
|
29
|
-
CurrentHorizontalTiltAngle: CharacteristicValue;
|
|
30
29
|
TargetHorizontalTiltAngle: CharacteristicValue;
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
30
|
+
CurrentHorizontalTiltAngle: CharacteristicValue;
|
|
31
|
+
OpenAPI_InMotion: deviceStatus['moving'];
|
|
32
|
+
OpenAPI_BatteryLevel: serviceData['battery'];
|
|
33
|
+
OpenAPI_Direction: deviceStatus['direction'];
|
|
34
|
+
OpenAPI_Calibration: serviceData['calibration'];
|
|
35
|
+
OpenAPI_CurrentPosition: serviceData['position'];
|
|
36
|
+
OpenAPI_FirmwareRevision: deviceStatus['version'];
|
|
37
|
+
OpenAPI_CurrentAmbientLightLevel: deviceStatus['brightness'];
|
|
37
38
|
Mode: string;
|
|
39
|
+
setPositionMode?: string | number;
|
|
38
40
|
mappingMode: BlindTiltMappingMode;
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
41
|
+
BLE_InMotion: serviceData['inMotion'];
|
|
42
|
+
BLE_BatteryLevel: serviceData['battery'];
|
|
43
|
+
BLE_Calibration: serviceData['calibration'];
|
|
44
|
+
BLE_CurrentPosition: serviceData['position'];
|
|
45
|
+
BLE_CurrentAmbientLightLevel: serviceData['lightLevel'];
|
|
46
|
+
BLE_IsConnected?: boolean;
|
|
42
47
|
spaceBetweenLevels: number;
|
|
43
|
-
address: ad['address'];
|
|
44
|
-
calibration: serviceData['calibration'];
|
|
45
|
-
battery: serviceData['battery'];
|
|
46
|
-
position: serviceData['position'];
|
|
47
|
-
inMotion: serviceData['inMotion'];
|
|
48
|
-
lightLevel: serviceData['lightLevel'];
|
|
49
48
|
setNewTarget: boolean;
|
|
50
49
|
setNewTargetTimer: NodeJS.Timeout;
|
|
51
50
|
mqttClient: MqttClient | null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"blindtilt.d.ts","sourceRoot":"","sources":["../../src/device/blindtilt.ts"],"names":[],"mappings":";;AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,IAAI,CAAC;AAG7B,OAAO,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AAClC,OAAO,EAAY,OAAO,EAAE,MAAM,MAAM,CAAC;AAEzC,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAEhD,OAAO,EAAE,OAAO,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAC7E,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,WAAW,EAAE,
|
|
1
|
+
{"version":3,"file":"blindtilt.d.ts","sourceRoot":"","sources":["../../src/device/blindtilt.ts"],"names":[],"mappings":";;AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,IAAI,CAAC;AAG7B,OAAO,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AAClC,OAAO,EAAY,OAAO,EAAE,MAAM,MAAM,CAAC;AAEzC,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAA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BAAqB,IAAI,OAAO;CAGjC"}
|
package/dist/device/blindtilt.js
CHANGED
|
@@ -112,22 +112,11 @@ class BlindTilt {
|
|
|
112
112
|
})
|
|
113
113
|
.onSet(this.TargetHorizontalTiltAngleSet.bind(this));
|
|
114
114
|
// Battery Service
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
else if (this.BLE && !this.batteryService) {
|
|
121
|
-
this.debugLog(`${this.device.deviceType}: ${accessory.displayName} Add Battery Service`);
|
|
122
|
-
(this.batteryService = this.accessory.getService(this.platform.Service.Battery) || this.accessory.addService(this.platform.Service.Battery)),
|
|
123
|
-
`${accessory.displayName} Battery`;
|
|
124
|
-
this.batteryService.setCharacteristic(this.platform.Characteristic.Name, `${accessory.displayName} Battery`);
|
|
125
|
-
if (!this.batteryService.testCharacteristic(this.platform.Characteristic.ConfiguredName)) {
|
|
126
|
-
this.batteryService.addCharacteristic(this.platform.Characteristic.ConfiguredName, `${accessory.displayName} Battery`);
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
else {
|
|
130
|
-
this.debugLog(`${this.device.deviceType}: ${accessory.displayName} Battery Service Not Added`);
|
|
115
|
+
(this.batteryService = this.accessory.getService(this.platform.Service.Battery) || accessory.addService(this.platform.Service.Battery)),
|
|
116
|
+
`${accessory.displayName} Battery`;
|
|
117
|
+
this.batteryService.setCharacteristic(this.platform.Characteristic.Name, `${accessory.displayName} Battery`);
|
|
118
|
+
if (!this.batteryService.testCharacteristic(this.platform.Characteristic.ConfiguredName)) {
|
|
119
|
+
this.batteryService.addCharacteristic(this.platform.Characteristic.ConfiguredName, `${accessory.displayName} Battery`);
|
|
131
120
|
}
|
|
132
121
|
// Update Homekit
|
|
133
122
|
this.updateHomeKitCharacteristics();
|
|
@@ -186,13 +175,13 @@ class BlindTilt {
|
|
|
186
175
|
async BLEparseStatus() {
|
|
187
176
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} BLEparseStatus`);
|
|
188
177
|
// CurrentPosition
|
|
189
|
-
this.CurrentPosition = 100 - Number(this.
|
|
178
|
+
this.CurrentPosition = 100 - Number(this.BLE_CurrentPosition);
|
|
190
179
|
await this.setMinMax();
|
|
191
180
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} CurrentPosition ${this.CurrentPosition}`);
|
|
192
181
|
if (this.setNewTarget) {
|
|
193
182
|
this.infoLog(`${this.device.deviceType}: ${this.accessory.displayName} Checking Status ...`);
|
|
194
183
|
}
|
|
195
|
-
if (this.setNewTarget && this.
|
|
184
|
+
if (this.setNewTarget && this.BLE_InMotion) {
|
|
196
185
|
await this.setMinMax();
|
|
197
186
|
if (Number(this.TargetPosition) > this.CurrentPosition) {
|
|
198
187
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Closing, CurrentPosition: ${this.CurrentPosition}`);
|
|
@@ -226,54 +215,54 @@ class BlindTilt {
|
|
|
226
215
|
this.set_maxLux = this.maxLux();
|
|
227
216
|
this.spaceBetweenLevels = 9;
|
|
228
217
|
// Brightness
|
|
229
|
-
switch (this.
|
|
218
|
+
switch (this.BLE_CurrentAmbientLightLevel) {
|
|
230
219
|
case 1:
|
|
231
220
|
this.CurrentAmbientLightLevel = this.set_minLux;
|
|
232
|
-
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} LightLevel: ${this.
|
|
221
|
+
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} LightLevel: ${this.BLE_CurrentAmbientLightLevel}`);
|
|
233
222
|
break;
|
|
234
223
|
case 2:
|
|
235
224
|
this.CurrentAmbientLightLevel = (this.set_maxLux - this.set_minLux) / this.spaceBetweenLevels;
|
|
236
|
-
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} LightLevel: ${this.
|
|
225
|
+
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} LightLevel: ${this.BLE_CurrentAmbientLightLevel},` +
|
|
237
226
|
` Calculation: ${(this.set_maxLux - this.set_minLux) / this.spaceBetweenLevels}`);
|
|
238
227
|
break;
|
|
239
228
|
case 3:
|
|
240
229
|
this.CurrentAmbientLightLevel = ((this.set_maxLux - this.set_minLux) / this.spaceBetweenLevels) * 2;
|
|
241
|
-
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} LightLevel: ${this.
|
|
230
|
+
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} LightLevel: ${this.BLE_CurrentAmbientLightLevel}`);
|
|
242
231
|
break;
|
|
243
232
|
case 4:
|
|
244
233
|
this.CurrentAmbientLightLevel = ((this.set_maxLux - this.set_minLux) / this.spaceBetweenLevels) * 3;
|
|
245
|
-
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} LightLevel: ${this.
|
|
234
|
+
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} LightLevel: ${this.BLE_CurrentAmbientLightLevel}`);
|
|
246
235
|
break;
|
|
247
236
|
case 5:
|
|
248
237
|
this.CurrentAmbientLightLevel = ((this.set_maxLux - this.set_minLux) / this.spaceBetweenLevels) * 4;
|
|
249
|
-
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} LightLevel: ${this.
|
|
238
|
+
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} LightLevel: ${this.BLE_CurrentAmbientLightLevel}`);
|
|
250
239
|
break;
|
|
251
240
|
case 6:
|
|
252
241
|
this.CurrentAmbientLightLevel = ((this.set_maxLux - this.set_minLux) / this.spaceBetweenLevels) * 5;
|
|
253
|
-
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} LightLevel: ${this.
|
|
242
|
+
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} LightLevel: ${this.BLE_CurrentAmbientLightLevel}`);
|
|
254
243
|
break;
|
|
255
244
|
case 7:
|
|
256
245
|
this.CurrentAmbientLightLevel = ((this.set_maxLux - this.set_minLux) / this.spaceBetweenLevels) * 6;
|
|
257
|
-
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} LightLevel: ${this.
|
|
246
|
+
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} LightLevel: ${this.BLE_CurrentAmbientLightLevel}`);
|
|
258
247
|
break;
|
|
259
248
|
case 8:
|
|
260
249
|
this.CurrentAmbientLightLevel = ((this.set_maxLux - this.set_minLux) / this.spaceBetweenLevels) * 7;
|
|
261
|
-
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} LightLevel: ${this.
|
|
250
|
+
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} LightLevel: ${this.BLE_CurrentAmbientLightLevel}`);
|
|
262
251
|
break;
|
|
263
252
|
case 9:
|
|
264
253
|
this.CurrentAmbientLightLevel = ((this.set_maxLux - this.set_minLux) / this.spaceBetweenLevels) * 8;
|
|
265
|
-
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} LightLevel: ${this.
|
|
254
|
+
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} LightLevel: ${this.BLE_CurrentAmbientLightLevel}`);
|
|
266
255
|
break;
|
|
267
256
|
case 10:
|
|
268
257
|
default:
|
|
269
258
|
this.CurrentAmbientLightLevel = this.set_maxLux;
|
|
270
259
|
this.debugLog();
|
|
271
260
|
}
|
|
272
|
-
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} LightLevel: ${this.
|
|
261
|
+
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} LightLevel: ${this.BLE_CurrentAmbientLightLevel},` +
|
|
273
262
|
` CurrentAmbientLightLevel: ${this.CurrentAmbientLightLevel}`);
|
|
274
263
|
}
|
|
275
264
|
// Battery
|
|
276
|
-
this.BatteryLevel = Number(this.
|
|
265
|
+
this.BatteryLevel = Number(this.BLE_BatteryLevel);
|
|
277
266
|
if (this.BatteryLevel < 10) {
|
|
278
267
|
this.StatusLowBattery = this.platform.Characteristic.StatusLowBattery.BATTERY_LEVEL_LOW;
|
|
279
268
|
}
|
|
@@ -284,8 +273,8 @@ class BlindTilt {
|
|
|
284
273
|
}
|
|
285
274
|
async openAPIparseStatus() {
|
|
286
275
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} openAPIparseStatus`);
|
|
287
|
-
const [homekitPosition, homekitTiltAngle] = this.mapDeviceValuesToHomekitValues(Number(this.
|
|
288
|
-
this.debugLog(` device: ${this.
|
|
276
|
+
const [homekitPosition, homekitTiltAngle] = this.mapDeviceValuesToHomekitValues(Number(this.OpenAPI_CurrentPosition), String(this.OpenAPI_Direction));
|
|
277
|
+
this.debugLog(` device: ${this.OpenAPI_CurrentPosition} => HK: ${homekitPosition}`);
|
|
289
278
|
this.CurrentPosition = homekitPosition;
|
|
290
279
|
// CurrentPosition
|
|
291
280
|
await this.setMinMax();
|
|
@@ -297,7 +286,7 @@ class BlindTilt {
|
|
|
297
286
|
if (this.setNewTarget) {
|
|
298
287
|
this.infoLog(`${this.device.deviceType}: ${this.accessory.displayName} Checking Status ...`);
|
|
299
288
|
}
|
|
300
|
-
if (this.setNewTarget && this.
|
|
289
|
+
if (this.setNewTarget && this.OpenAPI_InMotion) {
|
|
301
290
|
await this.setMinMax();
|
|
302
291
|
if (this.TargetPosition > this.CurrentPosition || (homekitTiltAngle && this.TargetHorizontalTiltAngle !== this.CurrentHorizontalTiltAngle)) {
|
|
303
292
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Closing, CurrentPosition: ${this.CurrentPosition} `);
|
|
@@ -333,7 +322,7 @@ class BlindTilt {
|
|
|
333
322
|
this.set_minLux = this.minLux();
|
|
334
323
|
this.set_maxLux = this.maxLux();
|
|
335
324
|
// Brightness
|
|
336
|
-
switch (this.
|
|
325
|
+
switch (this.OpenAPI_CurrentAmbientLightLevel) {
|
|
337
326
|
case 'dim':
|
|
338
327
|
this.CurrentAmbientLightLevel = this.set_minLux;
|
|
339
328
|
break;
|
|
@@ -380,27 +369,25 @@ class BlindTilt {
|
|
|
380
369
|
.then(async () => {
|
|
381
370
|
// Set an event hander
|
|
382
371
|
switchbot.onadvertisement = async (ad) => {
|
|
383
|
-
this.address = ad.address;
|
|
384
372
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Config BLE Address: ${this.device.bleMac},` +
|
|
385
|
-
` BLE Address Found: ${
|
|
386
|
-
this.
|
|
387
|
-
this.
|
|
388
|
-
this.
|
|
389
|
-
this.
|
|
390
|
-
this.
|
|
391
|
-
this.lightLevel = ad.serviceData.lightLevel;
|
|
373
|
+
` BLE Address Found: ${ad.address}`);
|
|
374
|
+
this.BLE_Calibration = ad.serviceData.calibration;
|
|
375
|
+
this.BLE_BatteryLevel = ad.serviceData.battery;
|
|
376
|
+
this.BLE_InMotion = ad.serviceData.inMotion;
|
|
377
|
+
this.BLE_CurrentPosition = ad.serviceData.position;
|
|
378
|
+
this.BLE_CurrentAmbientLightLevel = ad.serviceData.lightLevel;
|
|
392
379
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} serviceData: ${JSON.stringify(ad.serviceData)}`);
|
|
393
380
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} calibration: ${ad.serviceData.calibration}, ` +
|
|
394
381
|
`position: ${ad.serviceData.position}, lightLevel: ${ad.serviceData.lightLevel}, battery: ${ad.serviceData.battery}, ` +
|
|
395
382
|
`inMotion: ${ad.serviceData.inMotion}`);
|
|
396
|
-
if (
|
|
397
|
-
this.
|
|
398
|
-
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} connected: ${this.
|
|
383
|
+
if (ad.serviceData) {
|
|
384
|
+
this.BLE_IsConnected = true;
|
|
385
|
+
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} connected: ${this.BLE_IsConnected}`);
|
|
399
386
|
await this.stopScanning(switchbot);
|
|
400
387
|
}
|
|
401
388
|
else {
|
|
402
|
-
this.
|
|
403
|
-
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} connected: ${this.
|
|
389
|
+
this.BLE_IsConnected = false;
|
|
390
|
+
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} connected: ${this.BLE_IsConnected}`);
|
|
404
391
|
}
|
|
405
392
|
};
|
|
406
393
|
// Wait
|
|
@@ -432,10 +419,12 @@ class BlindTilt {
|
|
|
432
419
|
this.statusCode(statusCode);
|
|
433
420
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Headers: ${JSON.stringify(headers)}`);
|
|
434
421
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} refreshStatus: ${JSON.stringify(deviceStatus)}`);
|
|
435
|
-
this.
|
|
436
|
-
this.
|
|
437
|
-
this.
|
|
438
|
-
this.
|
|
422
|
+
this.OpenAPI_CurrentPosition = deviceStatus.body.slidePosition;
|
|
423
|
+
this.OpenAPI_Direction = deviceStatus.body.direction;
|
|
424
|
+
this.OpenAPI_InMotion = deviceStatus.body.moving;
|
|
425
|
+
this.OpenAPI_CurrentAmbientLightLevel = deviceStatus.body.brightness;
|
|
426
|
+
this.OpenAPI_BatteryLevel = deviceStatus.body.battery;
|
|
427
|
+
this.OpenAPI_FirmwareRevision = deviceStatus.body.version;
|
|
439
428
|
this.openAPIparseStatus();
|
|
440
429
|
this.updateHomeKitCharacteristics();
|
|
441
430
|
}
|
|
@@ -715,29 +704,38 @@ class BlindTilt {
|
|
|
715
704
|
` updateCharacteristic CurrentAmbientLightLevel: ${this.CurrentAmbientLightLevel}`);
|
|
716
705
|
}
|
|
717
706
|
}
|
|
718
|
-
if (this.
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
this.mqttPublish('BatteryLevel', this.BatteryLevel);
|
|
725
|
-
}
|
|
726
|
-
this.accessory.context.BatteryLevel = this.BatteryLevel;
|
|
727
|
-
this.batteryService?.updateCharacteristic(this.platform.Characteristic.BatteryLevel, this.BatteryLevel);
|
|
728
|
-
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} updateCharacteristic BatteryLevel: ${this.BatteryLevel}`);
|
|
729
|
-
}
|
|
730
|
-
if (this.StatusLowBattery === undefined) {
|
|
731
|
-
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} StatusLowBattery: ${this.StatusLowBattery}`);
|
|
707
|
+
if (this.BatteryLevel === undefined) {
|
|
708
|
+
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} BatteryLevel: ${this.BatteryLevel}`);
|
|
709
|
+
}
|
|
710
|
+
else {
|
|
711
|
+
if (this.device.mqttURL) {
|
|
712
|
+
this.mqttPublish('BatteryLevel', this.BatteryLevel);
|
|
732
713
|
}
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
714
|
+
this.accessory.context.BatteryLevel = this.BatteryLevel;
|
|
715
|
+
this.batteryService?.updateCharacteristic(this.platform.Characteristic.BatteryLevel, this.BatteryLevel);
|
|
716
|
+
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} updateCharacteristic BatteryLevel: ${this.BatteryLevel}`);
|
|
717
|
+
}
|
|
718
|
+
if (this.StatusLowBattery === undefined) {
|
|
719
|
+
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} StatusLowBattery: ${this.StatusLowBattery}`);
|
|
720
|
+
}
|
|
721
|
+
else {
|
|
722
|
+
if (this.device.mqttURL) {
|
|
723
|
+
this.mqttPublish('StatusLowBattery', this.StatusLowBattery);
|
|
740
724
|
}
|
|
725
|
+
this.accessory.context.StatusLowBattery = this.StatusLowBattery;
|
|
726
|
+
this.batteryService?.updateCharacteristic(this.platform.Characteristic.StatusLowBattery, this.StatusLowBattery);
|
|
727
|
+
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} updateCharacteristic StatusLowBattery: ${this.StatusLowBattery}`);
|
|
728
|
+
}
|
|
729
|
+
// FirmwareRevision
|
|
730
|
+
if (this.OpenAPI_FirmwareRevision === undefined) {
|
|
731
|
+
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} FirmwareRevision: ${this.OpenAPI_FirmwareRevision}`);
|
|
732
|
+
}
|
|
733
|
+
else {
|
|
734
|
+
this.accessory.context.OpenAPI_FirmwareRevision = this.OpenAPI_FirmwareRevision;
|
|
735
|
+
this.accessory.getService(this.platform.Service.AccessoryInformation)
|
|
736
|
+
.updateCharacteristic(this.platform.Characteristic.FirmwareRevision, this.OpenAPI_FirmwareRevision);
|
|
737
|
+
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} `
|
|
738
|
+
+ `updateCharacteristic CurrentTemperature: ${this.OpenAPI_FirmwareRevision}`);
|
|
741
739
|
}
|
|
742
740
|
}
|
|
743
741
|
/*
|
|
@@ -773,7 +771,7 @@ class BlindTilt {
|
|
|
773
771
|
}
|
|
774
772
|
async stopScanning(switchbot) {
|
|
775
773
|
await switchbot.stopScan();
|
|
776
|
-
if (this.
|
|
774
|
+
if (this.BLE_IsConnected) {
|
|
777
775
|
await this.BLEparseStatus();
|
|
778
776
|
await this.updateHomeKitCharacteristics();
|
|
779
777
|
}
|
|
@@ -962,12 +960,15 @@ class BlindTilt {
|
|
|
962
960
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName}` + ` accessory.context.FirmwareRevision: ${accessory.context.FirmwareRevision}`);
|
|
963
961
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} device.firmware: ${device.firmware}`);
|
|
964
962
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} this.platform.version: ${this.platform.version}`);
|
|
965
|
-
if (
|
|
966
|
-
FirmwareRevision = accessory.context.FirmwareRevision;
|
|
967
|
-
}
|
|
968
|
-
else if (device.firmware) {
|
|
963
|
+
if (device.firmware) {
|
|
969
964
|
FirmwareRevision = device.firmware;
|
|
970
965
|
}
|
|
966
|
+
else if (device.version) {
|
|
967
|
+
FirmwareRevision = JSON.stringify(device.version);
|
|
968
|
+
}
|
|
969
|
+
else if (accessory.context.FirmwareRevision) {
|
|
970
|
+
FirmwareRevision = accessory.context.FirmwareRevision;
|
|
971
|
+
}
|
|
971
972
|
else {
|
|
972
973
|
FirmwareRevision = this.platform.version;
|
|
973
974
|
}
|