@switchbot/homebridge-switchbot 2.6.2 → 2.6.3-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.
Files changed (52) hide show
  1. package/.github/npm-version-script.js +81 -0
  2. package/dist/device/blindtilt.js +2 -2
  3. package/dist/device/blindtilt.js.map +1 -1
  4. package/dist/device/bot.js +2 -2
  5. package/dist/device/bot.js.map +1 -1
  6. package/dist/device/ceilinglight.js +2 -2
  7. package/dist/device/ceilinglight.js.map +1 -1
  8. package/dist/device/colorbulb.js +2 -2
  9. package/dist/device/colorbulb.js.map +1 -1
  10. package/dist/device/contact.js +2 -2
  11. package/dist/device/contact.js.map +1 -1
  12. package/dist/device/curtain.js +2 -2
  13. package/dist/device/curtain.js.map +1 -1
  14. package/dist/device/humidifier.js +2 -2
  15. package/dist/device/humidifier.js.map +1 -1
  16. package/dist/device/iosensor.js +2 -2
  17. package/dist/device/iosensor.js.map +1 -1
  18. package/dist/device/lightstrip.js +2 -2
  19. package/dist/device/lightstrip.js.map +1 -1
  20. package/dist/device/lock.js +2 -2
  21. package/dist/device/lock.js.map +1 -1
  22. package/dist/device/meter.js +2 -2
  23. package/dist/device/meter.js.map +1 -1
  24. package/dist/device/meterplus.js +2 -2
  25. package/dist/device/meterplus.js.map +1 -1
  26. package/dist/device/motion.js +2 -2
  27. package/dist/device/motion.js.map +1 -1
  28. package/dist/device/plug.js +2 -2
  29. package/dist/device/plug.js.map +1 -1
  30. package/dist/device/robotvacuumcleaner.js +2 -2
  31. package/dist/device/robotvacuumcleaner.js.map +1 -1
  32. package/dist/platform.d.ts.map +1 -1
  33. package/dist/platform.js +11 -6
  34. package/dist/platform.js.map +1 -1
  35. package/nodemon.json +1 -1
  36. package/package.json +5 -5
  37. package/src/device/blindtilt.ts +2 -2
  38. package/src/device/bot.ts +2 -2
  39. package/src/device/ceilinglight.ts +2 -2
  40. package/src/device/colorbulb.ts +2 -2
  41. package/src/device/contact.ts +2 -2
  42. package/src/device/curtain.ts +2 -2
  43. package/src/device/humidifier.ts +2 -2
  44. package/src/device/iosensor.ts +2 -2
  45. package/src/device/lightstrip.ts +2 -2
  46. package/src/device/lock.ts +2 -2
  47. package/src/device/meter.ts +2 -2
  48. package/src/device/meterplus.ts +2 -2
  49. package/src/device/motion.ts +2 -2
  50. package/src/device/plug.ts +2 -2
  51. package/src/device/robotvacuumcleaner.ts +2 -2
  52. package/src/platform.ts +10 -6
@@ -454,7 +454,7 @@ export class Lock {
454
454
  }
455
455
 
456
456
  async stopScanning(switchbot: any) {
457
- switchbot.stopScan();
457
+ await switchbot.stopScan();
458
458
  if (this.connected) {
459
459
  await this.BLEparseStatus();
460
460
  await this.updateHomeKitCharacteristics();
@@ -476,7 +476,7 @@ export class Lock {
476
476
  };
477
477
  await sleep(10000);
478
478
  // Stop to monitor
479
- switchbot.stopScan();
479
+ await switchbot.stopScan();
480
480
  })();
481
481
  }
482
482
  }
@@ -465,7 +465,7 @@ export class Meter {
465
465
  }
466
466
 
467
467
  async stopScanning(switchbot: any) {
468
- switchbot.stopScan();
468
+ await switchbot.stopScan();
469
469
  if (this.connected) {
470
470
  await this.BLEparseStatus();
471
471
  await this.updateHomeKitCharacteristics();
@@ -487,7 +487,7 @@ export class Meter {
487
487
  };
488
488
  await sleep(10000);
489
489
  // Stop to monitor
490
- switchbot.stopScan();
490
+ await switchbot.stopScan();
491
491
  })();
492
492
  }
493
493
  }
@@ -467,7 +467,7 @@ export class MeterPlus {
467
467
  }
468
468
 
469
469
  async stopScanning(switchbot: any) {
470
- switchbot.stopScan();
470
+ await switchbot.stopScan();
471
471
  if (this.connected) {
472
472
  await this.BLEparseStatus();
473
473
  await this.updateHomeKitCharacteristics();
@@ -489,7 +489,7 @@ export class MeterPlus {
489
489
  };
490
490
  await sleep(10000);
491
491
  // Stop to monitor
492
- switchbot.stopScan();
492
+ await switchbot.stopScan();
493
493
  })();
494
494
  }
495
495
  }
@@ -388,7 +388,7 @@ export class Motion {
388
388
  }
389
389
 
390
390
  async stopScanning(switchbot: any) {
391
- switchbot.stopScan();
391
+ await switchbot.stopScan();
392
392
  if (this.connected) {
393
393
  await this.BLEparseStatus();
394
394
  await this.updateHomeKitCharacteristics();
@@ -410,7 +410,7 @@ export class Motion {
410
410
  };
411
411
  await sleep(10000);
412
412
  // Stop to monitor
413
- switchbot.stopScan();
413
+ await switchbot.stopScan();
414
414
  })();
415
415
  }
416
416
  }
@@ -409,7 +409,7 @@ export class Plug {
409
409
  }
410
410
 
411
411
  async stopScanning(switchbot: any) {
412
- switchbot.stopScan();
412
+ await switchbot.stopScan();
413
413
  if (this.connected) {
414
414
  await this.BLEparseStatus();
415
415
  await this.updateHomeKitCharacteristics();
@@ -439,7 +439,7 @@ export class Plug {
439
439
  };
440
440
  await sleep(10000);
441
441
  // Stop to monitor
442
- switchbot.stopScan();
442
+ await switchbot.stopScan();
443
443
  })();
444
444
  }
445
445
  }
@@ -523,7 +523,7 @@ export class RobotVacuumCleaner {
523
523
  }
524
524
 
525
525
  async stopScanning(switchbot: any) {
526
- switchbot.stopScan();
526
+ await switchbot.stopScan();
527
527
  if (this.connected) {
528
528
  await this.BLEparseStatus();
529
529
  await this.updateHomeKitCharacteristics();
@@ -553,7 +553,7 @@ export class RobotVacuumCleaner {
553
553
  };
554
554
  await sleep(10000);
555
555
  // Stop to monitor
556
- switchbot.stopScan();
556
+ await switchbot.stopScan();
557
557
  })();
558
558
  }
559
559
  }
package/src/platform.ts CHANGED
@@ -292,13 +292,17 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
292
292
  const deviceLists = devicesAPI.body.deviceList;
293
293
  if (!this.config.options?.devices) {
294
294
  this.debugLog(`SwitchBot Device Config Not Set: ${JSON.stringify(this.config.options?.devices)}`);
295
- const devices = deviceLists.map((v: any) => v);
296
- for (const device of devices) {
297
- if (device.deviceType) {
298
- if (device.configDeviceName) {
299
- device.deviceName = device.configDeviceName;
295
+ if (devicesAPI.body.length === 0) {
296
+ this.debugLog(`SwitchBot API Currently Doesn't Have Any Devices With Cloud Services Enabled: ${JSON.stringify(devicesAPI.body)}`);
297
+ } else {
298
+ const devices = deviceLists.map((v: any) => v);
299
+ for (const device of devices) {
300
+ if (device.deviceType) {
301
+ if (device.configDeviceName) {
302
+ device.deviceName = device.configDeviceName;
303
+ }
304
+ this.createDevice(device);
300
305
  }
301
- this.createDevice(device);
302
306
  }
303
307
  }
304
308
  } else if (this.config.credentials?.token && this.config.options.devices) {