@switchbot/homebridge-switchbot 2.8.0 → 2.8.1-beta.1
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/npm-version-script.js +81 -0
- package/dist/device/blindtilt.d.ts +21 -23
- package/dist/device/blindtilt.d.ts.map +1 -1
- package/dist/device/blindtilt.js +71 -73
- package/dist/device/blindtilt.js.map +1 -1
- package/dist/device/bot.d.ts +11 -15
- package/dist/device/bot.d.ts.map +1 -1
- package/dist/device/bot.js +38 -34
- package/dist/device/bot.js.map +1 -1
- package/dist/device/ceilinglight.d.ts +10 -14
- package/dist/device/ceilinglight.d.ts.map +1 -1
- package/dist/device/ceilinglight.js +33 -23
- package/dist/device/ceilinglight.js.map +1 -1
- package/dist/device/colorbulb.d.ts +16 -24
- package/dist/device/colorbulb.d.ts.map +1 -1
- package/dist/device/colorbulb.js +49 -43
- package/dist/device/colorbulb.js.map +1 -1
- package/dist/device/contact.d.ts +16 -24
- package/dist/device/contact.d.ts.map +1 -1
- package/dist/device/contact.js +49 -51
- package/dist/device/contact.js.map +1 -1
- package/dist/device/curtain.d.ts +21 -26
- package/dist/device/curtain.d.ts.map +1 -1
- package/dist/device/curtain.js +49 -47
- package/dist/device/curtain.js.map +1 -1
- package/dist/device/hub.d.ts +9 -8
- package/dist/device/hub.d.ts.map +1 -1
- package/dist/device/hub.js +42 -30
- 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 +27 -17
- package/dist/device/humidifier.js.map +1 -1
- package/dist/device/iosensor.d.ts +16 -21
- package/dist/device/iosensor.d.ts.map +1 -1
- package/dist/device/iosensor.js +35 -26
- package/dist/device/iosensor.js.map +1 -1
- package/dist/device/lightstrip.d.ts +8 -13
- package/dist/device/lightstrip.d.ts.map +1 -1
- package/dist/device/lightstrip.js +28 -25
- package/dist/device/lightstrip.js.map +1 -1
- package/dist/device/lock.d.ts +15 -21
- package/dist/device/lock.d.ts.map +1 -1
- package/dist/device/lock.js +75 -26
- package/dist/device/lock.js.map +1 -1
- package/dist/device/meter.d.ts +16 -21
- package/dist/device/meter.d.ts.map +1 -1
- package/dist/device/meter.js +40 -37
- package/dist/device/meter.js.map +1 -1
- package/dist/device/meterplus.d.ts +16 -21
- package/dist/device/meterplus.d.ts.map +1 -1
- package/dist/device/meterplus.js +40 -37
- package/dist/device/meterplus.js.map +1 -1
- package/dist/device/motion.d.ts +12 -21
- package/dist/device/motion.d.ts.map +1 -1
- package/dist/device/motion.js +44 -46
- package/dist/device/motion.js.map +1 -1
- package/dist/device/plug.d.ts +5 -15
- package/dist/device/plug.d.ts.map +1 -1
- package/dist/device/plug.js +22 -19
- package/dist/device/plug.js.map +1 -1
- package/dist/device/robotvacuumcleaner.d.ts +9 -13
- package/dist/device/robotvacuumcleaner.d.ts.map +1 -1
- package/dist/device/robotvacuumcleaner.js +30 -28
- package/dist/device/robotvacuumcleaner.js.map +1 -1
- package/dist/irdevice/airconditioner.d.ts +4 -4
- package/dist/irdevice/airconditioner.d.ts.map +1 -1
- package/dist/irdevice/camera.d.ts +1 -1
- package/dist/irdevice/camera.d.ts.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.map +1 -1
- package/dist/irdevice/light.d.ts +1 -1
- package/dist/irdevice/light.d.ts.map +1 -1
- package/dist/irdevice/other.d.ts +2 -2
- package/dist/irdevice/other.d.ts.map +1 -1
- package/dist/irdevice/tv.d.ts +1 -2
- package/dist/irdevice/tv.d.ts.map +1 -1
- package/dist/irdevice/tv.js.map +1 -1
- package/dist/irdevice/vacuumcleaner.d.ts +1 -1
- package/dist/irdevice/vacuumcleaner.d.ts.map +1 -1
- package/dist/irdevice/waterheater.d.ts +1 -1
- package/dist/irdevice/waterheater.d.ts.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 +5 -5
- package/src/device/blindtilt.ts +96 -95
- package/src/device/bot.ts +54 -54
- package/src/device/ceilinglight.ts +46 -39
- package/src/device/colorbulb.ts +68 -69
- package/src/device/contact.ts +69 -77
- package/src/device/curtain.ts +75 -74
- package/src/device/hub.ts +53 -38
- package/src/device/humidifier.ts +33 -26
- package/src/device/iosensor.ts +53 -48
- package/src/device/lightstrip.ts +39 -40
- package/src/device/lock.ts +94 -49
- package/src/device/meter.ts +59 -59
- package/src/device/meterplus.ts +59 -60
- package/src/device/motion.ts +61 -65
- package/src/device/plug.ts +27 -35
- package/src/device/robotvacuumcleaner.ts +43 -43
- package/src/irdevice/airconditioner.ts +4 -4
- package/src/irdevice/camera.ts +1 -1
- package/src/irdevice/fan.ts +3 -6
- package/src/irdevice/light.ts +1 -1
- package/src/irdevice/other.ts +2 -2
- package/src/irdevice/tv.ts +1 -4
- package/src/irdevice/vacuumcleaner.ts +1 -1
- package/src/irdevice/waterheater.ts +1 -1
- package/src/settings.ts +5 -1
package/src/device/lightstrip.ts
CHANGED
|
@@ -6,7 +6,7 @@ import { interval, Subject } from 'rxjs';
|
|
|
6
6
|
import { SwitchBotPlatform } from '../platform';
|
|
7
7
|
import { debounceTime, skipWhile, take, tap } from 'rxjs/operators';
|
|
8
8
|
import { Service, PlatformAccessory, CharacteristicValue, ControllerConstructor, Controller, ControllerServiceMap } from 'homebridge';
|
|
9
|
-
import { device, devicesConfig,
|
|
9
|
+
import { device, devicesConfig, hs2rgb, rgb2hs, deviceStatus, ad, serviceData, m2hs, Devices } from '../settings';
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
12
|
* Platform Accessory
|
|
@@ -24,21 +24,18 @@ export class StripLight {
|
|
|
24
24
|
Brightness!: CharacteristicValue;
|
|
25
25
|
ColorTemperature?: CharacteristicValue;
|
|
26
26
|
|
|
27
|
-
// OpenAPI
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
27
|
+
// OpenAPI Status
|
|
28
|
+
OpenAPI_On: deviceStatus['power'];
|
|
29
|
+
OpenAPI_RGB: deviceStatus['color'];
|
|
30
|
+
OpenAPI_Brightness: deviceStatus['brightness'];
|
|
31
|
+
OpenAPI_FirmwareRevision: deviceStatus['version'];
|
|
32
|
+
|
|
33
|
+
// BLE Status
|
|
34
|
+
BLE_On: serviceData['state'];
|
|
35
|
+
BLE_Brightness: serviceData['brightness'];
|
|
33
36
|
|
|
34
37
|
// BLE Others
|
|
35
|
-
|
|
36
|
-
switchbot!: switchbot;
|
|
37
|
-
address!: ad['address'];
|
|
38
|
-
serviceData!: serviceData;
|
|
39
|
-
state: serviceData['state'];
|
|
40
|
-
delay: serviceData['delay'];
|
|
41
|
-
wifiRssi: serviceData['wifiRssi'];
|
|
38
|
+
BLE_IsConnected?: boolean;
|
|
42
39
|
|
|
43
40
|
// Config
|
|
44
41
|
set_minStep?: number;
|
|
@@ -238,7 +235,7 @@ export class StripLight {
|
|
|
238
235
|
async BLEparseStatus(): Promise<void> {
|
|
239
236
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} BLEparseStatus`);
|
|
240
237
|
// State
|
|
241
|
-
switch (this.
|
|
238
|
+
switch (this.BLE_On) {
|
|
242
239
|
case 'on':
|
|
243
240
|
this.On = true;
|
|
244
241
|
break;
|
|
@@ -250,7 +247,7 @@ export class StripLight {
|
|
|
250
247
|
|
|
251
248
|
async openAPIparseStatus(): Promise<void> {
|
|
252
249
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} openAPIparseStatus`);
|
|
253
|
-
switch (this.
|
|
250
|
+
switch (this.OpenAPI_On) {
|
|
254
251
|
case 'on':
|
|
255
252
|
this.On = true;
|
|
256
253
|
break;
|
|
@@ -260,13 +257,13 @@ export class StripLight {
|
|
|
260
257
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} On: ${this.On}`);
|
|
261
258
|
|
|
262
259
|
// Brightness
|
|
263
|
-
this.Brightness = Number(this.
|
|
260
|
+
this.Brightness = Number(this.OpenAPI_Brightness);
|
|
264
261
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Brightness: ${this.Brightness}`);
|
|
265
262
|
|
|
266
263
|
// Color, Hue & Brightness
|
|
267
|
-
if (this.
|
|
268
|
-
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} color: ${JSON.stringify(this.
|
|
269
|
-
const [red, green, blue] = this.
|
|
264
|
+
if (this.OpenAPI_RGB) {
|
|
265
|
+
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} color: ${JSON.stringify(this.OpenAPI_RGB)}`);
|
|
266
|
+
const [red, green, blue] = this.OpenAPI_RGB!.split(':');
|
|
270
267
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} red: ${JSON.stringify(red)}`);
|
|
271
268
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} green: ${JSON.stringify(green)}`);
|
|
272
269
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} blue: ${JSON.stringify(blue)}`);
|
|
@@ -324,21 +321,12 @@ export class StripLight {
|
|
|
324
321
|
})
|
|
325
322
|
.then(async () => {
|
|
326
323
|
// Set an event hander
|
|
327
|
-
switchbot.onadvertisement = async (ad:
|
|
328
|
-
this.address = ad.address;
|
|
324
|
+
switchbot.onadvertisement = async (ad: ad) => {
|
|
329
325
|
this.debugLog(
|
|
330
326
|
`${this.device.deviceType}: ${this.accessory.displayName} Config BLE Address: ${this.device.bleMac},` +
|
|
331
|
-
` BLE Address Found: ${
|
|
327
|
+
` BLE Address Found: ${ad.address}`,
|
|
332
328
|
);
|
|
333
329
|
this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} serviceData: ${JSON.stringify(ad.serviceData)}`);
|
|
334
|
-
this.serviceData = ad.serviceData;
|
|
335
|
-
//this.state = ad.serviceData.state;
|
|
336
|
-
//this.delay = ad.serviceData.delay;
|
|
337
|
-
//this.timer = ad.serviceData.timer;
|
|
338
|
-
//this.syncUtcTime = ad.serviceData.syncUtcTime;
|
|
339
|
-
//this.wifiRssi = ad.serviceData.wifiRssi;
|
|
340
|
-
//this.overload = ad.serviceData.overload;
|
|
341
|
-
//this.currentPower = ad.serviceData.currentPower;
|
|
342
330
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} serviceData: ${JSON.stringify(ad.serviceData)}`);
|
|
343
331
|
/*this.debugLog(
|
|
344
332
|
`${this.device.deviceType}: ${this.accessory.displayName} state: ${ad.serviceData.state}, ` +
|
|
@@ -346,13 +334,13 @@ export class StripLight {
|
|
|
346
334
|
`wifiRssi: ${ad.serviceData.wifiRssi}, overload: ${ad.serviceData.overload}, currentPower: ${ad.serviceData.currentPower}`,
|
|
347
335
|
);*/
|
|
348
336
|
|
|
349
|
-
if (
|
|
350
|
-
this.
|
|
351
|
-
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} connected: ${this.
|
|
337
|
+
if (ad.serviceData) {
|
|
338
|
+
this.BLE_IsConnected = true;
|
|
339
|
+
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} connected: ${this.BLE_IsConnected}`);
|
|
352
340
|
await this.stopScanning(switchbot);
|
|
353
341
|
} else {
|
|
354
|
-
this.
|
|
355
|
-
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} connected: ${this.
|
|
342
|
+
this.BLE_IsConnected = false;
|
|
343
|
+
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} connected: ${this.BLE_IsConnected}`);
|
|
356
344
|
}
|
|
357
345
|
};
|
|
358
346
|
// Wait
|
|
@@ -386,9 +374,10 @@ export class StripLight {
|
|
|
386
374
|
this.statusCode(statusCode);
|
|
387
375
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Headers: ${JSON.stringify(headers)}`);
|
|
388
376
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} refreshStatus: ${JSON.stringify(deviceStatus)}`);
|
|
389
|
-
this.
|
|
390
|
-
this.
|
|
391
|
-
this.
|
|
377
|
+
this.OpenAPI_On = deviceStatus.body.power;
|
|
378
|
+
this.OpenAPI_RGB = deviceStatus.body.color;
|
|
379
|
+
this.OpenAPI_Brightness = deviceStatus.body.brightness;
|
|
380
|
+
this.OpenAPI_FirmwareRevision = deviceStatus.body.version;
|
|
392
381
|
this.openAPIparseStatus();
|
|
393
382
|
this.updateHomeKitCharacteristics();
|
|
394
383
|
} catch (e: any) {
|
|
@@ -829,11 +818,21 @@ export class StripLight {
|
|
|
829
818
|
this.lightBulbService.updateCharacteristic(this.platform.Characteristic.Saturation, this.Saturation);
|
|
830
819
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} updateCharacteristic Saturation: ${this.Saturation}`);
|
|
831
820
|
}
|
|
821
|
+
// FirmwareRevision
|
|
822
|
+
if (this.OpenAPI_FirmwareRevision === undefined) {
|
|
823
|
+
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} FirmwareRevision: ${this.OpenAPI_FirmwareRevision}`);
|
|
824
|
+
} else {
|
|
825
|
+
this.accessory.context.OpenAPI_FirmwareRevision = this.OpenAPI_FirmwareRevision;
|
|
826
|
+
this.accessory.getService(this.platform.Service.AccessoryInformation)!
|
|
827
|
+
.updateCharacteristic(this.platform.Characteristic.FirmwareRevision, this.OpenAPI_FirmwareRevision);
|
|
828
|
+
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} `
|
|
829
|
+
+ `updateCharacteristic CurrentTemperature: ${this.OpenAPI_FirmwareRevision}`);
|
|
830
|
+
}
|
|
832
831
|
}
|
|
833
832
|
|
|
834
833
|
async stopScanning(switchbot: any) {
|
|
835
834
|
await switchbot.stopScan();
|
|
836
|
-
if (this.
|
|
835
|
+
if (this.BLE_IsConnected) {
|
|
837
836
|
await this.BLEparseStatus();
|
|
838
837
|
await this.updateHomeKitCharacteristics();
|
|
839
838
|
} else {
|
package/src/device/lock.ts
CHANGED
|
@@ -6,30 +6,35 @@ import { interval, Subject } from 'rxjs';
|
|
|
6
6
|
import { SwitchBotPlatform } from '../platform';
|
|
7
7
|
import { debounceTime, skipWhile, take, tap } from 'rxjs/operators';
|
|
8
8
|
import { Service, PlatformAccessory, CharacteristicValue } from 'homebridge';
|
|
9
|
-
import { device, devicesConfig, deviceStatus,
|
|
9
|
+
import { device, devicesConfig, deviceStatus, ad, Devices, serviceData } from '../settings';
|
|
10
10
|
|
|
11
11
|
export class Lock {
|
|
12
12
|
// Services
|
|
13
13
|
lockService: Service;
|
|
14
|
+
batteryService: Service;
|
|
14
15
|
contactSensorService?: Service;
|
|
15
16
|
|
|
16
17
|
// Characteristic Values
|
|
17
|
-
|
|
18
|
-
LockCurrentState!: CharacteristicValue;
|
|
18
|
+
BatteryLevel!: CharacteristicValue;
|
|
19
19
|
LockTargetState!: CharacteristicValue;
|
|
20
|
+
LockCurrentState!: CharacteristicValue;
|
|
21
|
+
StatusLowBattery!: CharacteristicValue;
|
|
22
|
+
ContactSensorState!: CharacteristicValue;
|
|
23
|
+
|
|
24
|
+
// OpenAPI Status
|
|
25
|
+
OpenAPI_BatteryLevel: deviceStatus['battery'];
|
|
26
|
+
OpenAPI_FirmwareRevision: deviceStatus['version'];
|
|
27
|
+
OpenAPI_LockCurrentState!: deviceStatus['lockState'];
|
|
28
|
+
OpenAPI_ContactSensorState!: deviceStatus['doorState'];
|
|
20
29
|
|
|
21
|
-
//
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
deviceStatus!: any; //deviceStatusResponse;
|
|
30
|
+
// BLE Status
|
|
31
|
+
BLE_BatteryLevel: serviceData['battery'];
|
|
32
|
+
BLE_LockCurrentState: serviceData['state'];
|
|
33
|
+
BLE_Calibration: serviceData['calibration'];
|
|
34
|
+
BLE_ContactSensorState: serviceData['door_open'];
|
|
27
35
|
|
|
28
36
|
// BLE Others
|
|
29
|
-
|
|
30
|
-
switchbot!: switchbot;
|
|
31
|
-
address!: ad['address'];
|
|
32
|
-
serviceData!: serviceData;
|
|
37
|
+
BLE_IsConnected?: boolean;
|
|
33
38
|
|
|
34
39
|
// Config
|
|
35
40
|
scanDuration!: number;
|
|
@@ -43,15 +48,6 @@ export class Lock {
|
|
|
43
48
|
// Connection
|
|
44
49
|
private readonly BLE = this.device.connectionType === 'BLE' || this.device.connectionType === 'BLE/OpenAPI';
|
|
45
50
|
private readonly OpenAPI = this.device.connectionType === 'OpenAPI' || this.device.connectionType === 'BLE/OpenAPI';
|
|
46
|
-
battery: any;
|
|
47
|
-
calibration: any;
|
|
48
|
-
status: any;
|
|
49
|
-
update_from_secondary_lock: any;
|
|
50
|
-
door_open: any;
|
|
51
|
-
double_lock_mode: any;
|
|
52
|
-
unclosed_alarm: any;
|
|
53
|
-
unlocked_alarm: any;
|
|
54
|
-
auto_lock_paused: any;
|
|
55
51
|
|
|
56
52
|
constructor(
|
|
57
53
|
private readonly platform: SwitchBotPlatform,
|
|
@@ -123,6 +119,16 @@ export class Lock {
|
|
|
123
119
|
this.debugLog(`${this.device.deviceType}: ${accessory.displayName} Contact Sensor Service Not Added`);
|
|
124
120
|
}
|
|
125
121
|
|
|
122
|
+
// Battery Service
|
|
123
|
+
(this.batteryService = this.accessory.getService(this.platform.Service.Battery) || accessory.addService(this.platform.Service.Battery)),
|
|
124
|
+
`${accessory.displayName} Battery`;
|
|
125
|
+
|
|
126
|
+
this.batteryService.setCharacteristic(this.platform.Characteristic.Name, `${accessory.displayName} Battery`);
|
|
127
|
+
if (!this.batteryService.testCharacteristic(this.platform.Characteristic.ConfiguredName)) {
|
|
128
|
+
this.batteryService.addCharacteristic(this.platform.Characteristic.ConfiguredName, `${accessory.displayName} Battery`);
|
|
129
|
+
}
|
|
130
|
+
this.batteryService.setCharacteristic(this.platform.Characteristic.ChargingState, this.platform.Characteristic.ChargingState.NOT_CHARGEABLE);
|
|
131
|
+
|
|
126
132
|
// Update Homekit
|
|
127
133
|
this.updateHomeKitCharacteristics();
|
|
128
134
|
|
|
@@ -176,7 +182,7 @@ export class Lock {
|
|
|
176
182
|
|
|
177
183
|
async BLEparseStatus(): Promise<void> {
|
|
178
184
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} BLEparseStatus`);
|
|
179
|
-
switch (this.
|
|
185
|
+
switch (this.BLE_LockCurrentState) {
|
|
180
186
|
case 'locked':
|
|
181
187
|
this.LockCurrentState = this.platform.Characteristic.LockCurrentState.SECURED;
|
|
182
188
|
this.LockTargetState = this.platform.Characteristic.LockTargetState.SECURED;
|
|
@@ -185,7 +191,7 @@ export class Lock {
|
|
|
185
191
|
this.LockCurrentState = this.platform.Characteristic.LockCurrentState.UNSECURED;
|
|
186
192
|
this.LockTargetState = this.platform.Characteristic.LockTargetState.UNSECURED;
|
|
187
193
|
}
|
|
188
|
-
switch (this.
|
|
194
|
+
switch (this.BLE_ContactSensorState) {
|
|
189
195
|
case 'opened':
|
|
190
196
|
this.ContactSensorState = this.platform.Characteristic.ContactSensorState.CONTACT_NOT_DETECTED;
|
|
191
197
|
break;
|
|
@@ -193,11 +199,21 @@ export class Lock {
|
|
|
193
199
|
this.ContactSensorState = this.platform.Characteristic.ContactSensorState.CONTACT_DETECTED;
|
|
194
200
|
}
|
|
195
201
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} On: ${this.LockTargetState}`);
|
|
202
|
+
// Battery
|
|
203
|
+
this.BatteryLevel = Number(this.BLE_BatteryLevel);
|
|
204
|
+
if (this.BatteryLevel < 10) {
|
|
205
|
+
this.StatusLowBattery = this.platform.Characteristic.StatusLowBattery.BATTERY_LEVEL_LOW;
|
|
206
|
+
} else {
|
|
207
|
+
this.StatusLowBattery = this.platform.Characteristic.StatusLowBattery.BATTERY_LEVEL_NORMAL;
|
|
208
|
+
}
|
|
209
|
+
this.debugLog(
|
|
210
|
+
`${this.device.deviceType}: ${this.accessory.displayName} BatteryLevel: ${this.BatteryLevel},` + ` StatusLowBattery: ${this.StatusLowBattery}`,
|
|
211
|
+
);
|
|
196
212
|
}
|
|
197
213
|
|
|
198
214
|
async openAPIparseStatus(): Promise<void> {
|
|
199
215
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} openAPIparseStatus`);
|
|
200
|
-
switch (this.
|
|
216
|
+
switch (this.OpenAPI_LockCurrentState) {
|
|
201
217
|
case 'locked':
|
|
202
218
|
this.LockCurrentState = this.platform.Characteristic.LockCurrentState.SECURED;
|
|
203
219
|
this.LockTargetState = this.platform.Characteristic.LockTargetState.SECURED;
|
|
@@ -206,7 +222,7 @@ export class Lock {
|
|
|
206
222
|
this.LockCurrentState = this.platform.Characteristic.LockCurrentState.UNSECURED;
|
|
207
223
|
this.LockTargetState = this.platform.Characteristic.LockTargetState.UNSECURED;
|
|
208
224
|
}
|
|
209
|
-
switch (this.
|
|
225
|
+
switch (this.OpenAPI_ContactSensorState) {
|
|
210
226
|
case 'opened':
|
|
211
227
|
this.ContactSensorState = this.platform.Characteristic.ContactSensorState.CONTACT_NOT_DETECTED;
|
|
212
228
|
break;
|
|
@@ -214,6 +230,18 @@ export class Lock {
|
|
|
214
230
|
this.ContactSensorState = this.platform.Characteristic.ContactSensorState.CONTACT_DETECTED;
|
|
215
231
|
}
|
|
216
232
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} On: ${this.LockTargetState}`);
|
|
233
|
+
|
|
234
|
+
// Battery
|
|
235
|
+
this.BatteryLevel = Number(this.OpenAPI_BatteryLevel);
|
|
236
|
+
if (this.BatteryLevel < 10) {
|
|
237
|
+
this.StatusLowBattery = this.platform.Characteristic.StatusLowBattery.BATTERY_LEVEL_LOW;
|
|
238
|
+
} else {
|
|
239
|
+
this.StatusLowBattery = this.platform.Characteristic.StatusLowBattery.BATTERY_LEVEL_NORMAL;
|
|
240
|
+
}
|
|
241
|
+
if (Number.isNaN(this.BatteryLevel)) {
|
|
242
|
+
this.BatteryLevel = 100;
|
|
243
|
+
}
|
|
244
|
+
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} BatteryLevel: ${this.BatteryLevel}`);
|
|
217
245
|
}
|
|
218
246
|
|
|
219
247
|
/**
|
|
@@ -254,22 +282,15 @@ export class Lock {
|
|
|
254
282
|
})
|
|
255
283
|
.then(async () => {
|
|
256
284
|
// Set an event hander
|
|
257
|
-
switchbot.onadvertisement = async (ad:
|
|
258
|
-
this.address = ad.address;
|
|
285
|
+
switchbot.onadvertisement = async (ad: ad) => {
|
|
259
286
|
this.debugLog(
|
|
260
287
|
`${this.device.deviceType}: ${this.accessory.displayName} Config BLE Address: ${this.device.bleMac},` +
|
|
261
|
-
` BLE Address Found: ${
|
|
288
|
+
` BLE Address Found: ${ad.address}`,
|
|
262
289
|
);
|
|
263
|
-
this.
|
|
264
|
-
this.
|
|
265
|
-
this.
|
|
266
|
-
this.
|
|
267
|
-
this.update_from_secondary_lock = ad.serviceData.update_from_secondary_lock;
|
|
268
|
-
this.door_open = ad.serviceData.door_open;
|
|
269
|
-
this.double_lock_mode = ad.serviceData.double_lock_mode;
|
|
270
|
-
this.unclosed_alarm = ad.serviceData.unclosed_alarm;
|
|
271
|
-
this.unlocked_alarm = ad.serviceData.unlocked_alarm;
|
|
272
|
-
this.auto_lock_paused = ad.serviceData.auto_lock_paused;
|
|
290
|
+
this.BLE_BatteryLevel = ad.serviceData.battery;
|
|
291
|
+
this.BLE_Calibration = ad.serviceData.calibration;
|
|
292
|
+
this.BLE_LockCurrentState = ad.serviceData.status;
|
|
293
|
+
this.BLE_ContactSensorState = ad.serviceData.door_open;
|
|
273
294
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} serviceData: ${JSON.stringify(ad.serviceData)}`);
|
|
274
295
|
this.debugLog(
|
|
275
296
|
`${this.device.deviceType}: ${this.accessory.displayName} battery: ${ad.serviceData.battery}, ` +
|
|
@@ -277,13 +298,13 @@ export class Lock {
|
|
|
277
298
|
`door_open: ${ad.serviceData.door_open}`,
|
|
278
299
|
);
|
|
279
300
|
|
|
280
|
-
if (
|
|
281
|
-
this.
|
|
282
|
-
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} connected: ${this.
|
|
301
|
+
if (ad.serviceData) {
|
|
302
|
+
this.BLE_IsConnected = true;
|
|
303
|
+
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} connected: ${this.BLE_IsConnected}`);
|
|
283
304
|
await this.stopScanning(switchbot);
|
|
284
305
|
} else {
|
|
285
|
-
this.
|
|
286
|
-
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} connected: ${this.
|
|
306
|
+
this.BLE_IsConnected = false;
|
|
307
|
+
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} connected: ${this.BLE_IsConnected}`);
|
|
287
308
|
}
|
|
288
309
|
};
|
|
289
310
|
// Wait
|
|
@@ -317,10 +338,10 @@ export class Lock {
|
|
|
317
338
|
this.statusCode(statusCode);
|
|
318
339
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Headers: ${JSON.stringify(headers)}`);
|
|
319
340
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} refreshStatus: ${JSON.stringify(deviceStatus)}`);
|
|
320
|
-
this.
|
|
321
|
-
this.
|
|
322
|
-
this.
|
|
323
|
-
this.
|
|
341
|
+
this.OpenAPI_LockCurrentState = deviceStatus.body.lockState;
|
|
342
|
+
this.OpenAPI_ContactSensorState = deviceStatus.body.doorState;
|
|
343
|
+
this.OpenAPI_BatteryLevel = deviceStatus.body.battery;
|
|
344
|
+
this.OpenAPI_FirmwareRevision = deviceStatus.body.version;
|
|
324
345
|
this.openAPIparseStatus();
|
|
325
346
|
this.updateHomeKitCharacteristics();
|
|
326
347
|
} catch (e: any) {
|
|
@@ -479,11 +500,35 @@ export class Lock {
|
|
|
479
500
|
this.lockService.updateCharacteristic(this.platform.Characteristic.LockCurrentState, this.LockCurrentState);
|
|
480
501
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} updateCharacteristic LockCurrentState: ${this.LockCurrentState}`);
|
|
481
502
|
}
|
|
503
|
+
if (this.BatteryLevel === undefined) {
|
|
504
|
+
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} BatteryLevel: ${this.BatteryLevel}`);
|
|
505
|
+
} else {
|
|
506
|
+
this.accessory.context.BatteryLevel = this.BatteryLevel;
|
|
507
|
+
this.batteryService?.updateCharacteristic(this.platform.Characteristic.BatteryLevel, this.BatteryLevel);
|
|
508
|
+
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} updateCharacteristic BatteryLevel: ${this.BatteryLevel}`);
|
|
509
|
+
}
|
|
510
|
+
if (this.StatusLowBattery === undefined) {
|
|
511
|
+
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} StatusLowBattery: ${this.StatusLowBattery}`);
|
|
512
|
+
} else {
|
|
513
|
+
this.accessory.context.StatusLowBattery = this.StatusLowBattery;
|
|
514
|
+
this.batteryService?.updateCharacteristic(this.platform.Characteristic.StatusLowBattery, this.StatusLowBattery);
|
|
515
|
+
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} updateCharacteristic StatusLowBattery: ${this.StatusLowBattery}`);
|
|
516
|
+
}
|
|
517
|
+
// FirmwareRevision
|
|
518
|
+
if (this.OpenAPI_FirmwareRevision === undefined) {
|
|
519
|
+
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} FirmwareRevision: ${this.OpenAPI_FirmwareRevision}`);
|
|
520
|
+
} else {
|
|
521
|
+
this.accessory.context.OpenAPI_FirmwareRevision = this.OpenAPI_FirmwareRevision;
|
|
522
|
+
this.accessory.getService(this.platform.Service.AccessoryInformation)!
|
|
523
|
+
.updateCharacteristic(this.platform.Characteristic.FirmwareRevision, this.OpenAPI_FirmwareRevision);
|
|
524
|
+
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} `
|
|
525
|
+
+ `updateCharacteristic CurrentTemperature: ${this.OpenAPI_FirmwareRevision}`);
|
|
526
|
+
}
|
|
482
527
|
}
|
|
483
528
|
|
|
484
529
|
async stopScanning(switchbot: any) {
|
|
485
530
|
await switchbot.stopScan();
|
|
486
|
-
if (this.
|
|
531
|
+
if (this.BLE_IsConnected) {
|
|
487
532
|
await this.BLEparseStatus();
|
|
488
533
|
await this.updateHomeKitCharacteristics();
|
|
489
534
|
} else {
|
package/src/device/meter.ts
CHANGED
|
@@ -7,7 +7,7 @@ import { skipWhile } from 'rxjs/operators';
|
|
|
7
7
|
import { request } from 'undici';
|
|
8
8
|
import { Context } from 'vm';
|
|
9
9
|
import { SwitchBotPlatform } from '../platform';
|
|
10
|
-
import { Devices, ad, device, deviceStatus, devicesConfig, serviceData,
|
|
10
|
+
import { Devices, ad, device, deviceStatus, devicesConfig, serviceData, temperature } from '../settings';
|
|
11
11
|
import { sleep } from '../utils';
|
|
12
12
|
|
|
13
13
|
/**
|
|
@@ -17,34 +17,31 @@ import { sleep } from '../utils';
|
|
|
17
17
|
*/
|
|
18
18
|
export class Meter {
|
|
19
19
|
// Services
|
|
20
|
-
batteryService
|
|
21
|
-
temperatureservice?: Service;
|
|
20
|
+
batteryService: Service;
|
|
22
21
|
humidityservice?: Service;
|
|
22
|
+
temperatureservice?: Service;
|
|
23
23
|
|
|
24
24
|
// Characteristic Values
|
|
25
|
-
|
|
25
|
+
BatteryLevel!: CharacteristicValue;
|
|
26
|
+
StatusLowBattery!: CharacteristicValue;
|
|
26
27
|
CurrentTemperature?: CharacteristicValue;
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
28
|
+
CurrentRelativeHumidity!: CharacteristicValue;
|
|
29
|
+
|
|
30
|
+
// OpenAPI Status
|
|
31
|
+
OpenAPI_BatteryLevel: deviceStatus['battery'];
|
|
32
|
+
OpenAPI_FirmwareRevision: deviceStatus['version'];
|
|
33
|
+
OpenAPI_CurrentTemperature: deviceStatus['temperature'];
|
|
34
|
+
OpenAPI_CurrentRelativeHumidity: deviceStatus['humidity'];
|
|
30
35
|
|
|
31
|
-
//
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
36
|
+
// BLE Status
|
|
37
|
+
BLE_Celsius!: temperature['c'];
|
|
38
|
+
BLE_Fahrenheit!: temperature['f'];
|
|
39
|
+
BLE_BatteryLevel!: serviceData['battery'];
|
|
40
|
+
BLE_CurrentTemperature!: serviceData['temperature'];
|
|
41
|
+
BLE_CurrentRelativeHumidity!: serviceData['humidity'];
|
|
37
42
|
|
|
38
43
|
// BLE Others
|
|
39
|
-
|
|
40
|
-
switchbot!: switchbot;
|
|
41
|
-
serviceData!: serviceData;
|
|
42
|
-
address!: ad['address'];
|
|
43
|
-
temperature!: serviceData['temperature'];
|
|
44
|
-
celsius!: temperature['c'];
|
|
45
|
-
fahrenheit!: temperature['f'];
|
|
46
|
-
battery!: serviceData['battery'];
|
|
47
|
-
humidity!: serviceData['humidity'];
|
|
44
|
+
BLE_IsConnected?: boolean;
|
|
48
45
|
|
|
49
46
|
//MQTT stuff
|
|
50
47
|
mqttClient: MqttClient | null = null;
|
|
@@ -155,19 +152,14 @@ export class Meter {
|
|
|
155
152
|
}
|
|
156
153
|
|
|
157
154
|
// Battery Service
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
this.batteryService.
|
|
164
|
-
if (!this.batteryService.testCharacteristic(this.platform.Characteristic.ConfiguredName)) {
|
|
165
|
-
this.batteryService.addCharacteristic(this.platform.Characteristic.ConfiguredName, `${accessory.displayName} Battery`);
|
|
166
|
-
}
|
|
167
|
-
this.batteryService.setCharacteristic(this.platform.Characteristic.ChargingState, this.platform.Characteristic.ChargingState.NOT_CHARGEABLE);
|
|
168
|
-
} else {
|
|
169
|
-
this.debugLog(`${this.device.deviceType}: ${accessory.displayName} Battery Service Not Added`);
|
|
155
|
+
(this.batteryService = this.accessory.getService(this.platform.Service.Battery) || accessory.addService(this.platform.Service.Battery)),
|
|
156
|
+
`${accessory.displayName} Battery`;
|
|
157
|
+
|
|
158
|
+
this.batteryService.setCharacteristic(this.platform.Characteristic.Name, `${accessory.displayName} Battery`);
|
|
159
|
+
if (!this.batteryService.testCharacteristic(this.platform.Characteristic.ConfiguredName)) {
|
|
160
|
+
this.batteryService.addCharacteristic(this.platform.Characteristic.ConfiguredName, `${accessory.displayName} Battery`);
|
|
170
161
|
}
|
|
162
|
+
this.batteryService.setCharacteristic(this.platform.Characteristic.ChargingState, this.platform.Characteristic.ChargingState.NOT_CHARGEABLE);
|
|
171
163
|
|
|
172
164
|
// Retrieve initial values and updateHomekit
|
|
173
165
|
this.updateHomeKitCharacteristics();
|
|
@@ -202,7 +194,7 @@ export class Meter {
|
|
|
202
194
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} BLEparseStatus`);
|
|
203
195
|
|
|
204
196
|
// Battery
|
|
205
|
-
this.BatteryLevel = Number(this.
|
|
197
|
+
this.BatteryLevel = Number(this.BLE_BatteryLevel);
|
|
206
198
|
if (this.BatteryLevel < 15) {
|
|
207
199
|
this.StatusLowBattery = this.platform.Characteristic.StatusLowBattery.BATTERY_LEVEL_LOW;
|
|
208
200
|
} else {
|
|
@@ -212,14 +204,14 @@ export class Meter {
|
|
|
212
204
|
|
|
213
205
|
// Humidity
|
|
214
206
|
if (!this.device.meter?.hide_humidity) {
|
|
215
|
-
this.CurrentRelativeHumidity = this.
|
|
207
|
+
this.CurrentRelativeHumidity = this.BLE_CurrentRelativeHumidity!;
|
|
216
208
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Humidity: ${this.CurrentRelativeHumidity}%`);
|
|
217
209
|
}
|
|
218
210
|
|
|
219
211
|
// Current Temperature
|
|
220
212
|
if (!this.device.meter?.hide_temperature) {
|
|
221
|
-
this.
|
|
222
|
-
this.CurrentTemperature = this.
|
|
213
|
+
this.BLE_Celsius < 0 ? 0 : this.BLE_Celsius > 100 ? 100 : this.BLE_Celsius;
|
|
214
|
+
this.CurrentTemperature = this.BLE_Celsius;
|
|
223
215
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Temperature: ${this.CurrentTemperature}°c`);
|
|
224
216
|
}
|
|
225
217
|
}
|
|
@@ -228,7 +220,7 @@ export class Meter {
|
|
|
228
220
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} openAPIparseStatus`);
|
|
229
221
|
|
|
230
222
|
// Battery
|
|
231
|
-
this.BatteryLevel = Number(this.
|
|
223
|
+
this.BatteryLevel = Number(this.OpenAPI_BatteryLevel);
|
|
232
224
|
if (this.BatteryLevel < 15) {
|
|
233
225
|
this.StatusLowBattery = this.platform.Characteristic.StatusLowBattery.BATTERY_LEVEL_LOW;
|
|
234
226
|
} else {
|
|
@@ -238,13 +230,13 @@ export class Meter {
|
|
|
238
230
|
|
|
239
231
|
// Current Relative Humidity
|
|
240
232
|
if (!this.device.meter?.hide_humidity) {
|
|
241
|
-
this.CurrentRelativeHumidity = this.
|
|
233
|
+
this.CurrentRelativeHumidity = this.OpenAPI_CurrentRelativeHumidity!;
|
|
242
234
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Humidity: ${this.CurrentRelativeHumidity}%`);
|
|
243
235
|
}
|
|
244
236
|
|
|
245
237
|
// Current Temperature
|
|
246
238
|
if (!this.device.meter?.hide_temperature) {
|
|
247
|
-
this.CurrentTemperature = this.
|
|
239
|
+
this.CurrentTemperature = this.OpenAPI_CurrentTemperature!;
|
|
248
240
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Temperature: ${this.CurrentTemperature}°c`);
|
|
249
241
|
}
|
|
250
242
|
}
|
|
@@ -288,20 +280,18 @@ export class Meter {
|
|
|
288
280
|
.then(async () => {
|
|
289
281
|
// Set an event hander
|
|
290
282
|
switchbot.onadvertisement = async (ad: ad) => {
|
|
291
|
-
this.address = ad.address;
|
|
292
283
|
this.debugLog(
|
|
293
284
|
`${this.device.deviceType}: ${this.accessory.displayName} Config BLE Address: ${this.device.bleMac},` +
|
|
294
|
-
` BLE Address Found: ${
|
|
285
|
+
` BLE Address Found: ${ad.address}`,
|
|
295
286
|
);
|
|
296
287
|
if (ad.serviceData.humidity! > 0) {
|
|
297
288
|
// reject unreliable data
|
|
298
|
-
this.
|
|
289
|
+
this.BLE_CurrentRelativeHumidity = ad.serviceData.humidity;
|
|
299
290
|
}
|
|
300
|
-
this.
|
|
301
|
-
this.
|
|
302
|
-
this.
|
|
303
|
-
this.
|
|
304
|
-
this.battery = ad.serviceData.battery;
|
|
291
|
+
this.BLE_CurrentTemperature = ad.serviceData.temperature;
|
|
292
|
+
this.BLE_Celsius = ad.serviceData.temperature!.c;
|
|
293
|
+
this.BLE_Fahrenheit = ad.serviceData.temperature!.f;
|
|
294
|
+
this.BLE_BatteryLevel = ad.serviceData.battery;
|
|
305
295
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} serviceData: ${JSON.stringify(ad.serviceData)}`);
|
|
306
296
|
this.debugLog(
|
|
307
297
|
`${this.device.deviceType}: ${this.accessory.displayName} model: ${ad.serviceData.model}, modelName: ${ad.serviceData.modelName}, ` +
|
|
@@ -309,13 +299,13 @@ export class Meter {
|
|
|
309
299
|
`battery: ${ad.serviceData.battery}`,
|
|
310
300
|
);
|
|
311
301
|
|
|
312
|
-
if (
|
|
313
|
-
this.
|
|
314
|
-
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} connected: ${this.
|
|
302
|
+
if (ad.serviceData) {
|
|
303
|
+
this.BLE_IsConnected = true;
|
|
304
|
+
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} connected: ${this.BLE_IsConnected}`);
|
|
315
305
|
await this.stopScanning(switchbot);
|
|
316
306
|
} else {
|
|
317
|
-
this.
|
|
318
|
-
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} connected: ${this.
|
|
307
|
+
this.BLE_IsConnected = false;
|
|
308
|
+
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} connected: ${this.BLE_IsConnected}`);
|
|
319
309
|
}
|
|
320
310
|
};
|
|
321
311
|
// Wait
|
|
@@ -349,10 +339,10 @@ export class Meter {
|
|
|
349
339
|
this.statusCode(statusCode);
|
|
350
340
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Headers: ${JSON.stringify(headers)}`);
|
|
351
341
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} refreshStatus: ${JSON.stringify(deviceStatus)}`);
|
|
352
|
-
this.
|
|
353
|
-
this.
|
|
354
|
-
this.
|
|
355
|
-
this.
|
|
342
|
+
this.OpenAPI_CurrentRelativeHumidity = deviceStatus.body.humidity!;
|
|
343
|
+
this.OpenAPI_CurrentTemperature = deviceStatus.body.temperature!;
|
|
344
|
+
this.OpenAPI_BatteryLevel = deviceStatus.body.battery;
|
|
345
|
+
this.OpenAPI_FirmwareRevision = deviceStatus.body.version;
|
|
356
346
|
this.openAPIparseStatus();
|
|
357
347
|
this.updateHomeKitCharacteristics();
|
|
358
348
|
} catch (e: any) {
|
|
@@ -434,6 +424,16 @@ export class Meter {
|
|
|
434
424
|
this.historyService?.addEntry(entry);
|
|
435
425
|
}
|
|
436
426
|
}
|
|
427
|
+
// FirmwareRevision
|
|
428
|
+
if (this.OpenAPI_FirmwareRevision === undefined) {
|
|
429
|
+
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} FirmwareRevision: ${this.OpenAPI_FirmwareRevision}`);
|
|
430
|
+
} else {
|
|
431
|
+
this.accessory.context.OpenAPI_FirmwareRevision = this.OpenAPI_FirmwareRevision;
|
|
432
|
+
this.accessory.getService(this.platform.Service.AccessoryInformation)!
|
|
433
|
+
.updateCharacteristic(this.platform.Characteristic.FirmwareRevision, this.OpenAPI_FirmwareRevision);
|
|
434
|
+
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} `
|
|
435
|
+
+ `updateCharacteristic CurrentTemperature: ${this.OpenAPI_FirmwareRevision}`);
|
|
436
|
+
}
|
|
437
437
|
}
|
|
438
438
|
|
|
439
439
|
/*
|
|
@@ -487,7 +487,7 @@ export class Meter {
|
|
|
487
487
|
|
|
488
488
|
async stopScanning(switchbot: any) {
|
|
489
489
|
await switchbot.stopScan();
|
|
490
|
-
if (this.
|
|
490
|
+
if (this.BLE_IsConnected) {
|
|
491
491
|
await this.BLEparseStatus();
|
|
492
492
|
await this.updateHomeKitCharacteristics();
|
|
493
493
|
} else {
|