@switchbot/homebridge-switchbot 3.1.1-beta.11 → 3.1.1-beta.12

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.
Files changed (66) hide show
  1. package/CHANGELOG.md +1 -1
  2. package/dist/device/blindtilt.d.ts.map +1 -1
  3. package/dist/device/blindtilt.js +2 -1
  4. package/dist/device/blindtilt.js.map +1 -1
  5. package/dist/device/bot.d.ts.map +1 -1
  6. package/dist/device/bot.js +2 -1
  7. package/dist/device/bot.js.map +1 -1
  8. package/dist/device/ceilinglight.d.ts.map +1 -1
  9. package/dist/device/ceilinglight.js +2 -1
  10. package/dist/device/ceilinglight.js.map +1 -1
  11. package/dist/device/colorbulb.d.ts.map +1 -1
  12. package/dist/device/colorbulb.js +2 -1
  13. package/dist/device/colorbulb.js.map +1 -1
  14. package/dist/device/contact.d.ts.map +1 -1
  15. package/dist/device/contact.js +2 -1
  16. package/dist/device/contact.js.map +1 -1
  17. package/dist/device/curtain.d.ts.map +1 -1
  18. package/dist/device/curtain.js +2 -1
  19. package/dist/device/curtain.js.map +1 -1
  20. package/dist/device/humidifier.d.ts.map +1 -1
  21. package/dist/device/humidifier.js +2 -1
  22. package/dist/device/humidifier.js.map +1 -1
  23. package/dist/device/iosensor.d.ts.map +1 -1
  24. package/dist/device/iosensor.js +2 -1
  25. package/dist/device/iosensor.js.map +1 -1
  26. package/dist/device/lightstrip.d.ts.map +1 -1
  27. package/dist/device/lightstrip.js +2 -1
  28. package/dist/device/lightstrip.js.map +1 -1
  29. package/dist/device/lock.d.ts.map +1 -1
  30. package/dist/device/lock.js +2 -1
  31. package/dist/device/lock.js.map +1 -1
  32. package/dist/device/meter.d.ts.map +1 -1
  33. package/dist/device/meter.js +2 -1
  34. package/dist/device/meter.js.map +1 -1
  35. package/dist/device/meterplus.d.ts.map +1 -1
  36. package/dist/device/meterplus.js +2 -1
  37. package/dist/device/meterplus.js.map +1 -1
  38. package/dist/device/motion.d.ts.map +1 -1
  39. package/dist/device/motion.js +2 -1
  40. package/dist/device/motion.js.map +1 -1
  41. package/dist/device/plug.d.ts.map +1 -1
  42. package/dist/device/plug.js +2 -1
  43. package/dist/device/plug.js.map +1 -1
  44. package/dist/device/robotvacuumcleaner.d.ts.map +1 -1
  45. package/dist/device/robotvacuumcleaner.js +2 -1
  46. package/dist/device/robotvacuumcleaner.js.map +1 -1
  47. package/dist/platform.d.ts.map +1 -1
  48. package/dist/platform.js +10 -12
  49. package/dist/platform.js.map +1 -1
  50. package/package.json +3 -3
  51. package/src/device/blindtilt.ts +2 -1
  52. package/src/device/bot.ts +2 -1
  53. package/src/device/ceilinglight.ts +2 -1
  54. package/src/device/colorbulb.ts +2 -1
  55. package/src/device/contact.ts +2 -1
  56. package/src/device/curtain.ts +2 -1
  57. package/src/device/humidifier.ts +2 -1
  58. package/src/device/iosensor.ts +2 -1
  59. package/src/device/lightstrip.ts +2 -1
  60. package/src/device/lock.ts +2 -1
  61. package/src/device/meter.ts +2 -1
  62. package/src/device/meterplus.ts +2 -1
  63. package/src/device/motion.ts +2 -1
  64. package/src/device/plug.ts +2 -1
  65. package/src/device/robotvacuumcleaner.ts +2 -1
  66. package/src/platform.ts +11 -11
@@ -678,7 +678,8 @@ export class Lock {
678
678
  }
679
679
 
680
680
  async BLERefreshConnection(switchbot: any): Promise<void> {
681
- this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} wasn't able to establish BLE Connection, node-switchbot: ${switchbot}`);
681
+ this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} wasn't able to establish BLE Connection, node-switchbot:`
682
+ + ` ${JSON.stringify(switchbot)}`);
682
683
  if (this.platform.config.credentials?.token && this.device.connectionType === 'BLE/OpenAPI') {
683
684
  this.warnLog(`${this.device.deviceType}: ${this.accessory.displayName} Using OpenAPI Connection to Refresh Status`);
684
685
  await this.openAPIRefreshStatus();
@@ -552,7 +552,8 @@ export class Meter {
552
552
  }
553
553
 
554
554
  async BLERefreshConnection(switchbot: any): Promise<void> {
555
- this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} wasn't able to establish BLE Connection, node-switchbot: ${switchbot}`);
555
+ this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} wasn't able to establish BLE Connection, node-switchbot:`
556
+ + ` ${JSON.stringify(switchbot)}`);
556
557
  if (this.platform.config.credentials?.token && this.device.connectionType === 'BLE/OpenAPI') {
557
558
  this.warnLog(`${this.device.deviceType}: ${this.accessory.displayName} Using OpenAPI Connection to Refresh Status`);
558
559
  await this.openAPIRefreshStatus();
@@ -557,7 +557,8 @@ export class MeterPlus {
557
557
  }
558
558
 
559
559
  async BLERefreshConnection(switchbot: any): Promise<void> {
560
- this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} wasn't able to establish BLE Connection, node-switchbot: ${switchbot}`);
560
+ this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} wasn't able to establish BLE Connection, node-switchbot:`
561
+ + ` ${JSON.stringify(switchbot)}`);
561
562
  if (this.platform.config.credentials?.token && this.device.connectionType === 'BLE/OpenAPI') {
562
563
  this.warnLog(`${this.device.deviceType}: ${this.accessory.displayName} Using OpenAPI Connection to Refresh Status`);
563
564
  await this.openAPIRefreshStatus();
@@ -462,7 +462,8 @@ export class Motion {
462
462
  }
463
463
 
464
464
  async BLERefreshConnection(switchbot: any): Promise<void> {
465
- this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} wasn't able to establish BLE Connection, node-switchbot: ${switchbot}`);
465
+ this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} wasn't able to establish BLE Connection, node-switchbot:`
466
+ + ` ${JSON.stringify(switchbot)}`);
466
467
  if (this.platform.config.credentials?.token && this.device.connectionType === 'BLE/OpenAPI') {
467
468
  this.warnLog(`${this.device.deviceType}: ${this.accessory.displayName} Using OpenAPI Connection to Refresh Status`);
468
469
  await this.openAPIRefreshStatus();
@@ -497,7 +497,8 @@ export class Plug {
497
497
  }
498
498
 
499
499
  async BLERefreshConnection(switchbot: any): Promise<void> {
500
- this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} wasn't able to establish BLE Connection, node-switchbot: ${switchbot}`);
500
+ this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} wasn't able to establish BLE Connection, node-switchbot:`
501
+ + ` ${JSON.stringify(switchbot)}`);
501
502
  if (this.platform.config.credentials?.token && this.device.connectionType === 'BLE/OpenAPI') {
502
503
  this.warnLog(`${this.device.deviceType}: ${this.accessory.displayName} Using OpenAPI Connection to Refresh Status`);
503
504
  await this.openAPIRefreshStatus();
@@ -659,7 +659,8 @@ export class RobotVacuumCleaner {
659
659
  }
660
660
 
661
661
  async BLERefreshConnection(switchbot: any): Promise<void> {
662
- this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} wasn't able to establish BLE Connection, node-switchbot: ${switchbot}`);
662
+ this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} wasn't able to establish BLE Connection, node-switchbot:`
663
+ + ` ${JSON.stringify(switchbot)}`);
663
664
  if (this.platform.config.credentials?.token && this.device.connectionType === 'BLE/OpenAPI') {
664
665
  this.warnLog(`${this.device.deviceType}: ${this.accessory.displayName} Using OpenAPI Connection to Refresh Status`);
665
666
  await this.openAPIRefreshStatus();
package/src/platform.ts CHANGED
@@ -39,6 +39,9 @@ import asyncmqtt from 'async-mqtt';
39
39
  import crypto, { randomUUID } from 'crypto';
40
40
  import { readFileSync, writeFileSync } from 'fs';
41
41
  import hbLib from 'homebridge-lib';
42
+ import { SwitchBot } from 'node-switchbot';
43
+ /*import { SwitchBot } from '/Users/Shared/GitHub/OpenWonderLabs/node-switchbot/dist/switchbot.js';*/
44
+
42
45
 
43
46
 
44
47
  /**
@@ -2520,17 +2523,14 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
2520
2523
 
2521
2524
  // BLE Connection
2522
2525
  async connectBLE() {
2523
- let SwitchbotBLE: any;
2524
- let Switchbot: any;
2525
- try {
2526
- Switchbot = (await import('node-switchbot')).default;
2527
- queueScheduler.schedule(() => (Switchbot = new SwitchbotBLE()));
2528
- } catch (e: any) {
2529
- this.log.error(e);
2530
- Switchbot = false;
2531
- this.errorLog(`Was 'node-switchbot' found: ${Switchbot}`);
2532
- }
2533
- return Switchbot;
2526
+ let switchbot: any;
2527
+ //try {
2528
+ queueScheduler.schedule(() => (switchbot = new SwitchBot()));
2529
+ /*} catch (e: any) {
2530
+ switchbot = false;
2531
+ this.errorLog(`Was 'node-switchbot' found: ${switchbot}, Error: ${e}`);
2532
+ }*/
2533
+ return switchbot;
2534
2534
  }
2535
2535
 
2536
2536
  logType() {