@switchbot/homebridge-switchbot 2.0.0-beta.22 → 2.0.0-beta.23
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/dist/device/bot.d.ts +2 -1
- package/dist/device/bot.d.ts.map +1 -1
- package/dist/device/bot.js +11 -5
- package/dist/device/bot.js.map +1 -1
- package/dist/device/colorbulb.d.ts +2 -1
- package/dist/device/colorbulb.d.ts.map +1 -1
- package/dist/device/colorbulb.js +13 -10
- package/dist/device/colorbulb.js.map +1 -1
- package/dist/device/contact.d.ts +1 -1
- package/dist/device/contact.d.ts.map +1 -1
- package/dist/device/contact.js +5 -5
- package/dist/device/contact.js.map +1 -1
- package/dist/device/curtain.d.ts +2 -1
- package/dist/device/curtain.d.ts.map +1 -1
- package/dist/device/curtain.js +13 -13
- package/dist/device/curtain.js.map +1 -1
- package/dist/device/humidifier.d.ts +2 -1
- package/dist/device/humidifier.d.ts.map +1 -1
- package/dist/device/humidifier.js +12 -9
- package/dist/device/humidifier.js.map +1 -1
- package/dist/device/lock.d.ts +2 -0
- package/dist/device/lock.d.ts.map +1 -1
- package/dist/device/lock.js +14 -4
- package/dist/device/lock.js.map +1 -1
- package/dist/device/meter.d.ts +1 -1
- package/dist/device/meter.d.ts.map +1 -1
- package/dist/device/meter.js +5 -5
- package/dist/device/meter.js.map +1 -1
- package/dist/device/meterplus.d.ts +1 -1
- package/dist/device/meterplus.d.ts.map +1 -1
- package/dist/device/meterplus.js +5 -5
- package/dist/device/meterplus.js.map +1 -1
- package/dist/device/motion.d.ts +1 -1
- package/dist/device/motion.d.ts.map +1 -1
- package/dist/device/motion.js +5 -5
- package/dist/device/motion.js.map +1 -1
- package/dist/device/plug.d.ts +2 -1
- package/dist/device/plug.d.ts.map +1 -1
- package/dist/device/plug.js +12 -9
- package/dist/device/plug.js.map +1 -1
- package/dist/device/striplight.d.ts +2 -1
- package/dist/device/striplight.d.ts.map +1 -1
- package/dist/device/striplight.js +12 -9
- package/dist/device/striplight.js.map +1 -1
- package/package.json +1 -1
- package/src/device/bot.ts +12 -5
- package/src/device/colorbulb.ts +14 -10
- package/src/device/contact.ts +5 -5
- package/src/device/curtain.ts +14 -13
- package/src/device/humidifier.ts +13 -9
- package/src/device/lock.ts +16 -4
- package/src/device/meter.ts +5 -5
- package/src/device/meterplus.ts +5 -5
- package/src/device/motion.ts +5 -5
- package/src/device/plug.ts +13 -9
- package/src/device/striplight.ts +13 -9
package/src/device/bot.ts
CHANGED
|
@@ -484,17 +484,17 @@ export class Bot {
|
|
|
484
484
|
this.BLEparseStatus();
|
|
485
485
|
this.updateHomeKitCharacteristics();
|
|
486
486
|
} else {
|
|
487
|
-
await this.
|
|
487
|
+
await this.BLERefreshConnection(switchbot);
|
|
488
488
|
}
|
|
489
489
|
})
|
|
490
490
|
.catch(async (e: any) => {
|
|
491
491
|
this.apiError(e);
|
|
492
492
|
this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} failed BLERefreshStatus with ${this.device.connectionType}`
|
|
493
493
|
+ ` Connection, Error Message: ${superStringify(e.message)}`);
|
|
494
|
-
await this.
|
|
494
|
+
await this.BLERefreshConnection(switchbot);
|
|
495
495
|
});
|
|
496
496
|
} else {
|
|
497
|
-
await this.
|
|
497
|
+
await this.BLERefreshConnection(switchbot);
|
|
498
498
|
}
|
|
499
499
|
}
|
|
500
500
|
|
|
@@ -1084,10 +1084,17 @@ export class Bot {
|
|
|
1084
1084
|
}
|
|
1085
1085
|
}
|
|
1086
1086
|
|
|
1087
|
-
async
|
|
1087
|
+
async BLEPushConnection() {
|
|
1088
|
+
if (this.platform.config.credentials?.token && this.device.connectionType !== 'BLE/OpenAPI') {
|
|
1089
|
+
this.warnLog(`${this.device.deviceType}: ${this.accessory.displayName} Using OpenAPI Connection to Push Changes`);
|
|
1090
|
+
await this.openAPIpushChanges();
|
|
1091
|
+
}
|
|
1092
|
+
}
|
|
1093
|
+
|
|
1094
|
+
async BLERefreshConnection(switchbot: any): Promise<void> {
|
|
1088
1095
|
this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} wasn't able to establish BLE Connection, node-switchbot: ${switchbot}`);
|
|
1089
1096
|
if (this.platform.config.credentials?.token && this.device.connectionType !== 'BLE/OpenAPI') {
|
|
1090
|
-
this.warnLog(`${this.device.deviceType}: ${this.accessory.displayName} Using OpenAPI Connection`);
|
|
1097
|
+
this.warnLog(`${this.device.deviceType}: ${this.accessory.displayName} Using OpenAPI Connection to Refresh Status`);
|
|
1091
1098
|
await this.openAPIRefreshStatus();
|
|
1092
1099
|
}
|
|
1093
1100
|
}
|
package/src/device/colorbulb.ts
CHANGED
|
@@ -366,17 +366,17 @@ export class ColorBulb {
|
|
|
366
366
|
this.BLEparseStatus();
|
|
367
367
|
this.updateHomeKitCharacteristics();
|
|
368
368
|
} else {
|
|
369
|
-
await this.
|
|
369
|
+
await this.BLERefreshConnection(switchbot);
|
|
370
370
|
}
|
|
371
371
|
})
|
|
372
372
|
.catch(async (e: any) => {
|
|
373
373
|
this.apiError(e);
|
|
374
374
|
this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} failed BLERefreshStatus with ${this.device.connectionType}`
|
|
375
375
|
+ ` Connection, Error Message: ${superStringify(e.message)}`);
|
|
376
|
-
await this.
|
|
376
|
+
await this.BLERefreshConnection(switchbot);
|
|
377
377
|
});
|
|
378
378
|
} else {
|
|
379
|
-
await this.
|
|
379
|
+
await this.BLERefreshConnection(switchbot);
|
|
380
380
|
}
|
|
381
381
|
}
|
|
382
382
|
|
|
@@ -491,10 +491,7 @@ export class ColorBulb {
|
|
|
491
491
|
this.apiError(e);
|
|
492
492
|
this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} failed BLEpushChanges with ${this.device.connectionType}`
|
|
493
493
|
+ ` Connection, Error Message: ${superStringify(e.message)}`);
|
|
494
|
-
|
|
495
|
-
this.warnLog(`${this.device.deviceType}: ${this.accessory.displayName} Using OpenAPI Connection`);
|
|
496
|
-
await this.openAPIpushChanges();
|
|
497
|
-
}
|
|
494
|
+
await this.BLEPushConnection();
|
|
498
495
|
});
|
|
499
496
|
} else {
|
|
500
497
|
this.debugLog(
|
|
@@ -896,10 +893,17 @@ export class ColorBulb {
|
|
|
896
893
|
}
|
|
897
894
|
}
|
|
898
895
|
|
|
899
|
-
async
|
|
896
|
+
async BLEPushConnection() {
|
|
897
|
+
if (this.platform.config.credentials?.token && this.device.connectionType !== 'BLE/OpenAPI') {
|
|
898
|
+
this.warnLog(`${this.device.deviceType}: ${this.accessory.displayName} Using OpenAPI Connection to Push Changes`);
|
|
899
|
+
await this.openAPIpushChanges();
|
|
900
|
+
}
|
|
901
|
+
}
|
|
902
|
+
|
|
903
|
+
async BLERefreshConnection(switchbot: any): Promise<void> {
|
|
900
904
|
this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} wasn't able to establish BLE Connection, node-switchbot: ${switchbot}`);
|
|
901
|
-
if (this.platform.config.credentials?.token) {
|
|
902
|
-
this.warnLog(`${this.device.deviceType}: ${this.accessory.displayName} Using OpenAPI Connection`);
|
|
905
|
+
if (this.platform.config.credentials?.token && this.device.connectionType !== 'BLE/OpenAPI') {
|
|
906
|
+
this.warnLog(`${this.device.deviceType}: ${this.accessory.displayName} Using OpenAPI Connection to Refresh Status`);
|
|
903
907
|
await this.openAPIRefreshStatus();
|
|
904
908
|
}
|
|
905
909
|
}
|
package/src/device/contact.ts
CHANGED
|
@@ -329,17 +329,17 @@ export class Contact {
|
|
|
329
329
|
this.BLEparseStatus();
|
|
330
330
|
this.updateHomeKitCharacteristics();
|
|
331
331
|
} else {
|
|
332
|
-
await this.
|
|
332
|
+
await this.BLERefreshConnection(switchbot);
|
|
333
333
|
}
|
|
334
334
|
})
|
|
335
335
|
.catch(async (e: any) => {
|
|
336
336
|
this.apiError(e);
|
|
337
337
|
this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} failed BLERefreshStatus with ${this.device.connectionType}`
|
|
338
338
|
+ ` Connection, Error Message: ${superStringify(e.message)}`);
|
|
339
|
-
await this.
|
|
339
|
+
await this.BLERefreshConnection(switchbot);
|
|
340
340
|
});
|
|
341
341
|
} else {
|
|
342
|
-
await this.
|
|
342
|
+
await this.BLERefreshConnection(switchbot);
|
|
343
343
|
}
|
|
344
344
|
}
|
|
345
345
|
|
|
@@ -464,10 +464,10 @@ export class Contact {
|
|
|
464
464
|
}
|
|
465
465
|
}
|
|
466
466
|
|
|
467
|
-
async
|
|
467
|
+
async BLERefreshConnection(switchbot: any): Promise<void> {
|
|
468
468
|
this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} wasn't able to establish BLE Connection, node-switchbot: ${switchbot}`);
|
|
469
469
|
if (this.platform.config.credentials?.token && this.device.connectionType !== 'BLE/OpenAPI') {
|
|
470
|
-
this.warnLog(`${this.device.deviceType}: ${this.accessory.displayName} Using OpenAPI Connection`);
|
|
470
|
+
this.warnLog(`${this.device.deviceType}: ${this.accessory.displayName} Using OpenAPI Connection to Refresh Status`);
|
|
471
471
|
await this.openAPIRefreshStatus();
|
|
472
472
|
}
|
|
473
473
|
}
|
package/src/device/curtain.ts
CHANGED
|
@@ -452,17 +452,17 @@ export class Curtain {
|
|
|
452
452
|
this.BLEparseStatus();
|
|
453
453
|
this.updateHomeKitCharacteristics();
|
|
454
454
|
} else {
|
|
455
|
-
await this.
|
|
455
|
+
await this.BLERefreshConnection(switchbot);
|
|
456
456
|
}
|
|
457
457
|
})
|
|
458
458
|
.catch(async (e: any) => {
|
|
459
459
|
this.apiError(e);
|
|
460
460
|
this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} failed BLERefreshStatus with ${this.device.connectionType}`
|
|
461
461
|
+ ` Connection, Error Message: ${superStringify(e.message)}`);
|
|
462
|
-
await this.
|
|
462
|
+
await this.BLERefreshConnection(switchbot);
|
|
463
463
|
});
|
|
464
464
|
} else {
|
|
465
|
-
await this.
|
|
465
|
+
await this.BLERefreshConnection(switchbot);
|
|
466
466
|
}
|
|
467
467
|
}
|
|
468
468
|
|
|
@@ -566,17 +566,11 @@ export class Curtain {
|
|
|
566
566
|
this.apiError(e);
|
|
567
567
|
this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} failed BLEpushChanges with ${this.device.connectionType}`
|
|
568
568
|
+ ` Connection, Error Message: ${superStringify(e.message)}`);
|
|
569
|
-
|
|
570
|
-
this.warnLog(`${this.device.deviceType}: ${this.accessory.displayName} Using OpenAPI Connection`);
|
|
571
|
-
await this.openAPIpushChanges();
|
|
572
|
-
}
|
|
569
|
+
await this.BLEPushConnection();
|
|
573
570
|
});
|
|
574
571
|
} else {
|
|
575
572
|
this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} wasn't able to establish BLE Connection`);
|
|
576
|
-
|
|
577
|
-
this.warnLog(`${this.device.deviceType}: ${this.accessory.displayName} Using OpenAPI Connection`);
|
|
578
|
-
await this.openAPIpushChanges();
|
|
579
|
-
}
|
|
573
|
+
await this.BLEPushConnection();
|
|
580
574
|
}
|
|
581
575
|
} else {
|
|
582
576
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} No BLEpushChanges, CurrentPosition & TargetPosition Are the Same.` +
|
|
@@ -808,10 +802,17 @@ export class Curtain {
|
|
|
808
802
|
}
|
|
809
803
|
}
|
|
810
804
|
|
|
811
|
-
async
|
|
805
|
+
async BLEPushConnection() {
|
|
806
|
+
if (this.platform.config.credentials?.token && this.device.connectionType !== 'BLE/OpenAPI') {
|
|
807
|
+
this.warnLog(`${this.device.deviceType}: ${this.accessory.displayName} Using OpenAPI Connection to Push Changes`);
|
|
808
|
+
await this.openAPIpushChanges();
|
|
809
|
+
}
|
|
810
|
+
}
|
|
811
|
+
|
|
812
|
+
async BLERefreshConnection(switchbot: any): Promise<void> {
|
|
812
813
|
this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} wasn't able to establish BLE Connection, node-switchbot: ${switchbot}`);
|
|
813
814
|
if (this.platform.config.credentials?.token && this.device.connectionType !== 'BLE/OpenAPI') {
|
|
814
|
-
this.warnLog(`${this.device.deviceType}: ${this.accessory.displayName} Using OpenAPI Connection`);
|
|
815
|
+
this.warnLog(`${this.device.deviceType}: ${this.accessory.displayName} Using OpenAPI Connection to Refresh Status`);
|
|
815
816
|
await this.openAPIRefreshStatus();
|
|
816
817
|
}
|
|
817
818
|
}
|
package/src/device/humidifier.ts
CHANGED
|
@@ -344,17 +344,17 @@ export class Humidifier {
|
|
|
344
344
|
this.BLEparseStatus();
|
|
345
345
|
this.updateHomeKitCharacteristics();
|
|
346
346
|
} else {
|
|
347
|
-
await this.
|
|
347
|
+
await this.BLERefreshConnection(switchbot);
|
|
348
348
|
}
|
|
349
349
|
})
|
|
350
350
|
.catch(async (e: any) => {
|
|
351
351
|
this.apiError(e);
|
|
352
352
|
this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} failed BLERefreshStatus with ${this.device.connectionType}`
|
|
353
353
|
+ ` Connection, Error Message: ${superStringify(e.message)}`);
|
|
354
|
-
await this.
|
|
354
|
+
await this.BLERefreshConnection(switchbot);
|
|
355
355
|
});
|
|
356
356
|
} else {
|
|
357
|
-
await this.
|
|
357
|
+
await this.BLERefreshConnection(switchbot);
|
|
358
358
|
}
|
|
359
359
|
}
|
|
360
360
|
|
|
@@ -460,10 +460,7 @@ export class Humidifier {
|
|
|
460
460
|
this.apiError(e);
|
|
461
461
|
this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} failed BLEpushChanges with ${this.device.connectionType}`
|
|
462
462
|
+ ` Connection, Error Message: ${superStringify(e.message)}`);
|
|
463
|
-
|
|
464
|
-
this.warnLog(`${this.device.deviceType}: ${this.accessory.displayName} Using OpenAPI Connection`);
|
|
465
|
-
await this.openAPIpushChanges();
|
|
466
|
-
}
|
|
463
|
+
await this.BLEPushConnection();
|
|
467
464
|
});
|
|
468
465
|
}
|
|
469
466
|
|
|
@@ -775,10 +772,17 @@ export class Humidifier {
|
|
|
775
772
|
}
|
|
776
773
|
}
|
|
777
774
|
|
|
778
|
-
async
|
|
775
|
+
async BLEPushConnection() {
|
|
776
|
+
if (this.platform.config.credentials?.token && this.device.connectionType !== 'BLE/OpenAPI') {
|
|
777
|
+
this.warnLog(`${this.device.deviceType}: ${this.accessory.displayName} Using OpenAPI Connection to Push Changes`);
|
|
778
|
+
await this.openAPIpushChanges();
|
|
779
|
+
}
|
|
780
|
+
}
|
|
781
|
+
|
|
782
|
+
async BLERefreshConnection(switchbot: any): Promise<void> {
|
|
779
783
|
this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} wasn't able to establish BLE Connection, node-switchbot: ${switchbot}`);
|
|
780
784
|
if (this.platform.config.credentials?.token && this.device.connectionType !== 'BLE/OpenAPI') {
|
|
781
|
-
this.warnLog(`${this.device.deviceType}: ${this.accessory.displayName} Using OpenAPI Connection`);
|
|
785
|
+
this.warnLog(`${this.device.deviceType}: ${this.accessory.displayName} Using OpenAPI Connection to Refresh Status`);
|
|
782
786
|
await this.openAPIRefreshStatus();
|
|
783
787
|
}
|
|
784
788
|
}
|
package/src/device/lock.ts
CHANGED
|
@@ -300,10 +300,7 @@ export class Lock {
|
|
|
300
300
|
this.apiError(e);
|
|
301
301
|
this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} failed BLEpushChanges with ${this.device.connectionType}`
|
|
302
302
|
+ ` Connection, Error Message: ${superStringify(e.message)}`);
|
|
303
|
-
|
|
304
|
-
this.warnLog(`${this.device.deviceType}: ${this.accessory.displayName} Using OpenAPI Connection`);
|
|
305
|
-
await this.openAPIpushChanges();
|
|
306
|
-
}
|
|
303
|
+
await this.BLEPushConnection();
|
|
307
304
|
});
|
|
308
305
|
} else {
|
|
309
306
|
this.debugLog(
|
|
@@ -415,6 +412,21 @@ export class Lock {
|
|
|
415
412
|
}
|
|
416
413
|
}
|
|
417
414
|
|
|
415
|
+
async BLEPushConnection() {
|
|
416
|
+
if (this.platform.config.credentials?.token && this.device.connectionType !== 'BLE/OpenAPI') {
|
|
417
|
+
this.warnLog(`${this.device.deviceType}: ${this.accessory.displayName} Using OpenAPI Connection to Push Changes`);
|
|
418
|
+
await this.openAPIpushChanges();
|
|
419
|
+
}
|
|
420
|
+
}
|
|
421
|
+
|
|
422
|
+
async BLERefreshConnection(switchbot: any): Promise<void> {
|
|
423
|
+
this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} wasn't able to establish BLE Connection, node-switchbot: ${switchbot}`);
|
|
424
|
+
if (this.platform.config.credentials?.token && this.device.connectionType !== 'BLE/OpenAPI') {
|
|
425
|
+
this.warnLog(`${this.device.deviceType}: ${this.accessory.displayName} Using OpenAPI Connection to Refresh Status`);
|
|
426
|
+
await this.openAPIRefreshStatus();
|
|
427
|
+
}
|
|
428
|
+
}
|
|
429
|
+
|
|
418
430
|
async scan(device: device & devicesConfig): Promise<void> {
|
|
419
431
|
if (device.scanDuration) {
|
|
420
432
|
this.scanDuration = this.accessory.context.scanDuration = device.scanDuration;
|
package/src/device/meter.ts
CHANGED
|
@@ -300,17 +300,17 @@ export class Meter {
|
|
|
300
300
|
this.BLEparseStatus();
|
|
301
301
|
this.updateHomeKitCharacteristics();
|
|
302
302
|
} else {
|
|
303
|
-
await this.
|
|
303
|
+
await this.BLERefreshConnection(switchbot);
|
|
304
304
|
}
|
|
305
305
|
})
|
|
306
306
|
.catch(async (e: any) => {
|
|
307
307
|
this.apiError(e);
|
|
308
308
|
this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} failed BLERefreshStatus with ${this.device.connectionType}`
|
|
309
309
|
+ ` Connection, Error Message: ${superStringify(e.message)}`);
|
|
310
|
-
await this.
|
|
310
|
+
await this.BLERefreshConnection(switchbot);
|
|
311
311
|
});
|
|
312
312
|
} else {
|
|
313
|
-
await this.
|
|
313
|
+
await this.BLERefreshConnection(switchbot);
|
|
314
314
|
}
|
|
315
315
|
}
|
|
316
316
|
|
|
@@ -489,10 +489,10 @@ export class Meter {
|
|
|
489
489
|
}
|
|
490
490
|
}
|
|
491
491
|
|
|
492
|
-
async
|
|
492
|
+
async BLERefreshConnection(switchbot: any): Promise<void> {
|
|
493
493
|
this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} wasn't able to establish BLE Connection, node-switchbot: ${switchbot}`);
|
|
494
494
|
if (this.platform.config.credentials?.token && this.device.connectionType !== 'BLE/OpenAPI') {
|
|
495
|
-
this.warnLog(`${this.device.deviceType}: ${this.accessory.displayName} Using OpenAPI Connection`);
|
|
495
|
+
this.warnLog(`${this.device.deviceType}: ${this.accessory.displayName} Using OpenAPI Connection to Refresh Status`);
|
|
496
496
|
await this.openAPIRefreshStatus();
|
|
497
497
|
}
|
|
498
498
|
}
|
package/src/device/meterplus.ts
CHANGED
|
@@ -300,17 +300,17 @@ export class MeterPlus {
|
|
|
300
300
|
this.parseStatus();
|
|
301
301
|
this.updateHomeKitCharacteristics();
|
|
302
302
|
} else {
|
|
303
|
-
await this.
|
|
303
|
+
await this.BLERefreshConnection(switchbot);
|
|
304
304
|
}
|
|
305
305
|
})
|
|
306
306
|
.catch(async (e: any) => {
|
|
307
307
|
this.apiError(e);
|
|
308
308
|
this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} failed BLERefreshStatus with ${this.device.connectionType}`
|
|
309
309
|
+ ` Connection, Error Message: ${superStringify(e.message)}`);
|
|
310
|
-
await this.
|
|
310
|
+
await this.BLERefreshConnection(switchbot);
|
|
311
311
|
});
|
|
312
312
|
} else {
|
|
313
|
-
await this.
|
|
313
|
+
await this.BLERefreshConnection(switchbot);
|
|
314
314
|
}
|
|
315
315
|
}
|
|
316
316
|
|
|
@@ -488,10 +488,10 @@ export class MeterPlus {
|
|
|
488
488
|
}
|
|
489
489
|
}
|
|
490
490
|
|
|
491
|
-
async
|
|
491
|
+
async BLERefreshConnection(switchbot: any): Promise<void> {
|
|
492
492
|
this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} wasn't able to establish BLE Connection, node-switchbot: ${switchbot}`);
|
|
493
493
|
if (this.platform.config.credentials?.token && this.device.connectionType !== 'BLE/OpenAPI') {
|
|
494
|
-
this.warnLog(`${this.device.deviceType}: ${this.accessory.displayName} Using OpenAPI Connection`);
|
|
494
|
+
this.warnLog(`${this.device.deviceType}: ${this.accessory.displayName} Using OpenAPI Connection to Refresh Status`);
|
|
495
495
|
await this.openAPIRefreshStatus();
|
|
496
496
|
}
|
|
497
497
|
}
|
package/src/device/motion.ts
CHANGED
|
@@ -280,17 +280,17 @@ export class Motion {
|
|
|
280
280
|
this.BLEparseStatus();
|
|
281
281
|
this.updateHomeKitCharacteristics();
|
|
282
282
|
} else {
|
|
283
|
-
await this.
|
|
283
|
+
await this.BLERefreshConnection(switchbot);
|
|
284
284
|
}
|
|
285
285
|
})
|
|
286
286
|
.catch(async (e: any) => {
|
|
287
287
|
this.apiError(e);
|
|
288
288
|
this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} failed BLERefreshStatus with ${this.device.connectionType}`
|
|
289
289
|
+ ` Connection, Error Message: ${superStringify(e.message)}`);
|
|
290
|
-
await this.
|
|
290
|
+
await this.BLERefreshConnection(switchbot);
|
|
291
291
|
});
|
|
292
292
|
} else {
|
|
293
|
-
await this.
|
|
293
|
+
await this.BLERefreshConnection(switchbot);
|
|
294
294
|
}
|
|
295
295
|
}
|
|
296
296
|
|
|
@@ -405,10 +405,10 @@ export class Motion {
|
|
|
405
405
|
}
|
|
406
406
|
}
|
|
407
407
|
|
|
408
|
-
async
|
|
408
|
+
async BLERefreshConnection(switchbot: any): Promise<void> {
|
|
409
409
|
this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} wasn't able to establish BLE Connection, node-switchbot: ${switchbot}`);
|
|
410
410
|
if (this.platform.config.credentials?.token && this.device.connectionType !== 'BLE/OpenAPI') {
|
|
411
|
-
this.warnLog(`${this.device.deviceType}: ${this.accessory.displayName} Using OpenAPI Connection`);
|
|
411
|
+
this.warnLog(`${this.device.deviceType}: ${this.accessory.displayName} Using OpenAPI Connection to Refresh Status`);
|
|
412
412
|
await this.openAPIRefreshStatus();
|
|
413
413
|
}
|
|
414
414
|
}
|
package/src/device/plug.ts
CHANGED
|
@@ -234,17 +234,17 @@ export class Plug {
|
|
|
234
234
|
this.BLEparseStatus();
|
|
235
235
|
this.updateHomeKitCharacteristics();
|
|
236
236
|
} else {
|
|
237
|
-
await this.
|
|
237
|
+
await this.BLERefreshConnection(switchbot);
|
|
238
238
|
}
|
|
239
239
|
})
|
|
240
240
|
.catch(async (e: any) => {
|
|
241
241
|
this.apiError(e);
|
|
242
242
|
this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} failed BLERefreshStatus with ${this.device.connectionType}`
|
|
243
243
|
+ ` Connection, Error Message: ${superStringify(e.message)}`);
|
|
244
|
-
await this.
|
|
244
|
+
await this.BLERefreshConnection(switchbot);
|
|
245
245
|
});
|
|
246
246
|
} else {
|
|
247
|
-
await this.
|
|
247
|
+
await this.BLERefreshConnection(switchbot);
|
|
248
248
|
}
|
|
249
249
|
}
|
|
250
250
|
|
|
@@ -355,10 +355,7 @@ export class Plug {
|
|
|
355
355
|
this.apiError(e);
|
|
356
356
|
this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} failed BLEpushChanges with ${this.device.connectionType}`
|
|
357
357
|
+ ` Connection, Error Message: ${superStringify(e.message)}`);
|
|
358
|
-
|
|
359
|
-
this.warnLog(`${this.device.deviceType}: ${this.accessory.displayName} Using OpenAPI Connection`);
|
|
360
|
-
await this.openAPIpushChanges();
|
|
361
|
-
}
|
|
358
|
+
await this.BLEPushConnection();
|
|
362
359
|
});
|
|
363
360
|
} else {
|
|
364
361
|
this.debugLog(
|
|
@@ -481,10 +478,17 @@ export class Plug {
|
|
|
481
478
|
}
|
|
482
479
|
}
|
|
483
480
|
|
|
484
|
-
async
|
|
481
|
+
async BLEPushConnection() {
|
|
482
|
+
if (this.platform.config.credentials?.token && this.device.connectionType !== 'BLE/OpenAPI') {
|
|
483
|
+
this.warnLog(`${this.device.deviceType}: ${this.accessory.displayName} Using OpenAPI Connection to Push Changes`);
|
|
484
|
+
await this.openAPIpushChanges();
|
|
485
|
+
}
|
|
486
|
+
}
|
|
487
|
+
|
|
488
|
+
async BLERefreshConnection(switchbot: any): Promise<void> {
|
|
485
489
|
this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} wasn't able to establish BLE Connection, node-switchbot: ${switchbot}`);
|
|
486
490
|
if (this.platform.config.credentials?.token && this.device.connectionType !== 'BLE/OpenAPI') {
|
|
487
|
-
this.warnLog(`${this.device.deviceType}: ${this.accessory.displayName} Using OpenAPI Connection`);
|
|
491
|
+
this.warnLog(`${this.device.deviceType}: ${this.accessory.displayName} Using OpenAPI Connection to Refresh Status`);
|
|
488
492
|
await this.openAPIRefreshStatus();
|
|
489
493
|
}
|
|
490
494
|
}
|
package/src/device/striplight.ts
CHANGED
|
@@ -354,17 +354,17 @@ export class StripLight {
|
|
|
354
354
|
this.BLEparseStatus();
|
|
355
355
|
this.updateHomeKitCharacteristics();
|
|
356
356
|
} else {
|
|
357
|
-
await this.
|
|
357
|
+
await this.BLERefreshConnection(switchbot);
|
|
358
358
|
}
|
|
359
359
|
})
|
|
360
360
|
.catch(async (e: any) => {
|
|
361
361
|
this.apiError(e);
|
|
362
362
|
this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} failed BLERefreshStatus with ${this.device.connectionType}`
|
|
363
363
|
+ ` Connection, Error Message: ${superStringify(e.message)}`);
|
|
364
|
-
await this.
|
|
364
|
+
await this.BLERefreshConnection(switchbot);
|
|
365
365
|
});
|
|
366
366
|
} else {
|
|
367
|
-
await this.
|
|
367
|
+
await this.BLERefreshConnection(switchbot);
|
|
368
368
|
}
|
|
369
369
|
}
|
|
370
370
|
|
|
@@ -477,10 +477,7 @@ export class StripLight {
|
|
|
477
477
|
this.apiError(e);
|
|
478
478
|
this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} failed BLEpushChanges with ${this.device.connectionType}`
|
|
479
479
|
+ ` Connection, Error Message: ${superStringify(e.message)}`);
|
|
480
|
-
|
|
481
|
-
this.warnLog(`${this.device.deviceType}: ${this.accessory.displayName} Using OpenAPI Connection`);
|
|
482
|
-
await this.openAPIpushChanges();
|
|
483
|
-
}
|
|
480
|
+
await this.BLEPushConnection();
|
|
484
481
|
});
|
|
485
482
|
} else {
|
|
486
483
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} No BLEpushChanges.` + `On: ${this.On}, `
|
|
@@ -808,10 +805,17 @@ export class StripLight {
|
|
|
808
805
|
}
|
|
809
806
|
}
|
|
810
807
|
|
|
811
|
-
async
|
|
808
|
+
async BLEPushConnection() {
|
|
809
|
+
if (this.platform.config.credentials?.token && this.device.connectionType !== 'BLE/OpenAPI') {
|
|
810
|
+
this.warnLog(`${this.device.deviceType}: ${this.accessory.displayName} Using OpenAPI Connection to Push Changes`);
|
|
811
|
+
await this.openAPIpushChanges();
|
|
812
|
+
}
|
|
813
|
+
}
|
|
814
|
+
|
|
815
|
+
async BLERefreshConnection(switchbot: any): Promise<void> {
|
|
812
816
|
this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} wasn't able to establish BLE Connection, node-switchbot: ${switchbot}`);
|
|
813
817
|
if (this.platform.config.credentials?.token && this.device.connectionType !== 'BLE/OpenAPI') {
|
|
814
|
-
this.warnLog(`${this.device.deviceType}: ${this.accessory.displayName} Using OpenAPI Connection`);
|
|
818
|
+
this.warnLog(`${this.device.deviceType}: ${this.accessory.displayName} Using OpenAPI Connection to Refresh Status`);
|
|
815
819
|
await this.openAPIRefreshStatus();
|
|
816
820
|
}
|
|
817
821
|
}
|