@switchbot/homebridge-switchbot 2.5.3-beta.10 → 2.5.3-beta.11

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.
@@ -455,9 +455,9 @@ export class Humidifier {
455
455
  quick: true,
456
456
  id: this.device.bleMac,
457
457
  })
458
- .then((device_list: any) => {
458
+ .then(async (device_list: any) => {
459
459
  this.infoLog(`${this.accessory.displayName} Target Position: ${this.Active}`);
460
- return device_list[0].percentage(this.RelativeHumidityHumidifierThreshold);
460
+ return await device_list[0].percentage(this.RelativeHumidityHumidifierThreshold);
461
461
  })
462
462
  .then(() => {
463
463
  this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Done.`);
@@ -456,11 +456,11 @@ export class Motion {
456
456
  }
457
457
 
458
458
  async retry({ max, fn }: { max: number; fn: { (): any; (): Promise<any> } }): Promise<null> {
459
- return fn().catch(async (err: any) => {
459
+ return fn().catch(async (e: any) => {
460
460
  if (max === 0) {
461
- throw err;
461
+ throw e;
462
462
  }
463
- this.infoLog(err);
463
+ this.infoLog(e);
464
464
  this.infoLog(`${this.device.deviceType}: ${this.accessory.displayName} Retrying`);
465
465
  await sleep(1000);
466
466
  return this.retry({ max: max - 1, fn });
@@ -352,11 +352,11 @@ export class Plug {
352
352
  this.infoLog(`${this.device.deviceType}: ${this.accessory.displayName} On: ${this.On}`);
353
353
  return await this.retry({
354
354
  max: await this.maxRetry(),
355
- fn: () => {
355
+ fn: async () => {
356
356
  if (this.On) {
357
- return device_list[0].turnOn({ id: this.device.bleMac });
357
+ return await device_list[0].turnOn({ id: this.device.bleMac });
358
358
  } else {
359
- return device_list[0].turnOff({ id: this.device.bleMac });
359
+ return await device_list[0].turnOff({ id: this.device.bleMac });
360
360
  }
361
361
  },
362
362
  });
@@ -522,11 +522,11 @@ export class Plug {
522
522
  }
523
523
 
524
524
  async retry({ max, fn }: { max: number; fn: { (): any; (): Promise<any> } }): Promise<null> {
525
- return fn().catch(async (err: any) => {
525
+ return fn().catch(async (e: any) => {
526
526
  if (max === 0) {
527
- throw err;
527
+ throw e;
528
528
  }
529
- this.infoLog(err);
529
+ this.infoLog(e);
530
530
  this.infoLog(`${this.device.deviceType}: ${this.accessory.displayName} Retrying`);
531
531
  await sleep(1000);
532
532
  return this.retry({ max: max - 1, fn });
@@ -363,11 +363,11 @@ export class RobotVacuumCleaner {
363
363
  this.infoLog(`${this.device.deviceType}: ${this.accessory.displayName} On: ${this.On}`);
364
364
  return await this.retry({
365
365
  max: await this.maxRetry(),
366
- fn: () => {
366
+ fn: async () => {
367
367
  if (this.On) {
368
- return device_list[0].turnOn({ id: this.device.bleMac });
368
+ return await device_list[0].turnOn({ id: this.device.bleMac });
369
369
  } else {
370
- return device_list[0].turnOff({ id: this.device.bleMac });
370
+ return await device_list[0].turnOff({ id: this.device.bleMac });
371
371
  }
372
372
  },
373
373
  });
@@ -646,11 +646,11 @@ export class RobotVacuumCleaner {
646
646
  }
647
647
 
648
648
  async retry({ max, fn }: { max: number; fn: { (): any; (): Promise<any> } }): Promise<null> {
649
- return fn().catch(async (err: any) => {
649
+ return fn().catch(async (e: any) => {
650
650
  if (max === 0) {
651
- throw err;
651
+ throw e;
652
652
  }
653
- this.infoLog(err);
653
+ this.infoLog(e);
654
654
  this.infoLog(`${this.device.deviceType}: ${this.accessory.displayName} Retrying`);
655
655
  await sleep(1000);
656
656
  return this.retry({ max: max - 1, fn });
@@ -468,11 +468,11 @@ export class StripLight {
468
468
  this.infoLog(`${this.device.deviceType}: ${this.accessory.displayName} On: ${this.On}`);
469
469
  return await this.retry({
470
470
  max: await this.maxRetry(),
471
- fn: () => {
471
+ fn: async () => {
472
472
  if (this.On) {
473
- return device_list[0].turnOn({ id: this.device.bleMac });
473
+ return await device_list[0].turnOn({ id: this.device.bleMac });
474
474
  } else {
475
- return device_list[0].turnOff({ id: this.device.bleMac });
475
+ return await device_list[0].turnOff({ id: this.device.bleMac });
476
476
  }
477
477
  },
478
478
  });
@@ -516,9 +516,9 @@ export class StripLight {
516
516
  model: 'u',
517
517
  id: this.device.bleMac,
518
518
  })
519
- .then((device_list: any) => {
519
+ .then(async (device_list: any) => {
520
520
  this.infoLog(`${this.accessory.displayName} Target Brightness: ${this.Brightness}`);
521
- return device_list[0].setBrightness(this.Brightness);
521
+ return await device_list[0].setBrightness(this.Brightness);
522
522
  })
523
523
  .then(() => {
524
524
  this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Done.`);
@@ -557,9 +557,9 @@ export class StripLight {
557
557
  model: 'u',
558
558
  id: this.device.bleMac,
559
559
  })
560
- .then((device_list: any) => {
560
+ .then(async (device_list: any) => {
561
561
  this.infoLog(`${this.accessory.displayName} Target RGB: ${this.Brightness, red, green, blue}`);
562
- return device_list[0].setRGB(this.Brightness, red, green, blue);
562
+ return await device_list[0].setRGB(this.Brightness, red, green, blue);
563
563
  })
564
564
  .then(() => {
565
565
  this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Done.`);
@@ -887,11 +887,11 @@ export class StripLight {
887
887
  }
888
888
 
889
889
  async retry({ max, fn }: { max: number; fn: { (): any; (): Promise<any> } }): Promise<null> {
890
- return fn().catch(async (err: any) => {
890
+ return fn().catch(async (e: any) => {
891
891
  if (max === 0) {
892
- throw err;
892
+ throw e;
893
893
  }
894
- this.infoLog(err);
894
+ this.infoLog(e);
895
895
  this.infoLog(`${this.device.deviceType}: ${this.accessory.displayName} Retrying`);
896
896
  await sleep(1000);
897
897
  return this.retry({ max: max - 1, fn });