@switchbot/homebridge-switchbot 3.5.0-beta.20 → 3.5.0-beta.21

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 (61) hide show
  1. package/config.schema.json +16 -4
  2. package/dist/device/blindtilt.js +3 -3
  3. package/dist/device/blindtilt.js.map +1 -1
  4. package/dist/device/bot.js +3 -3
  5. package/dist/device/bot.js.map +1 -1
  6. package/dist/device/ceilinglight.js +3 -3
  7. package/dist/device/ceilinglight.js.map +1 -1
  8. package/dist/device/colorbulb.js +3 -3
  9. package/dist/device/colorbulb.js.map +1 -1
  10. package/dist/device/contact.js +3 -3
  11. package/dist/device/contact.js.map +1 -1
  12. package/dist/device/curtain.js +3 -3
  13. package/dist/device/curtain.js.map +1 -1
  14. package/dist/device/hub.js +3 -3
  15. package/dist/device/hub.js.map +1 -1
  16. package/dist/device/humidifier.js +3 -3
  17. package/dist/device/humidifier.js.map +1 -1
  18. package/dist/device/iosensor.js +3 -3
  19. package/dist/device/iosensor.js.map +1 -1
  20. package/dist/device/lightstrip.js +3 -3
  21. package/dist/device/lightstrip.js.map +1 -1
  22. package/dist/device/lock.js +3 -3
  23. package/dist/device/lock.js.map +1 -1
  24. package/dist/device/meter.js +3 -3
  25. package/dist/device/meter.js.map +1 -1
  26. package/dist/device/meterplus.js +3 -3
  27. package/dist/device/meterplus.js.map +1 -1
  28. package/dist/device/motion.js +3 -3
  29. package/dist/device/motion.js.map +1 -1
  30. package/dist/device/plug.js +3 -3
  31. package/dist/device/plug.js.map +1 -1
  32. package/dist/device/robotvacuumcleaner.js +3 -3
  33. package/dist/device/robotvacuumcleaner.js.map +1 -1
  34. package/dist/device/waterdetector.js +3 -3
  35. package/dist/device/waterdetector.js.map +1 -1
  36. package/dist/platform.d.ts +2 -0
  37. package/dist/platform.d.ts.map +1 -1
  38. package/dist/platform.js +20 -4
  39. package/dist/platform.js.map +1 -1
  40. package/dist/settings.d.ts +2 -0
  41. package/dist/settings.d.ts.map +1 -1
  42. package/package.json +2 -2
  43. package/src/device/blindtilt.ts +3 -3
  44. package/src/device/bot.ts +3 -3
  45. package/src/device/ceilinglight.ts +3 -3
  46. package/src/device/colorbulb.ts +3 -3
  47. package/src/device/contact.ts +3 -3
  48. package/src/device/curtain.ts +3 -3
  49. package/src/device/hub.ts +3 -3
  50. package/src/device/humidifier.ts +3 -3
  51. package/src/device/iosensor.ts +3 -3
  52. package/src/device/lightstrip.ts +3 -3
  53. package/src/device/lock.ts +3 -3
  54. package/src/device/meter.ts +3 -3
  55. package/src/device/meterplus.ts +3 -3
  56. package/src/device/motion.ts +3 -3
  57. package/src/device/plug.ts +3 -3
  58. package/src/device/robotvacuumcleaner.ts +3 -3
  59. package/src/device/waterdetector.ts +3 -3
  60. package/src/platform.ts +20 -4
  61. package/src/settings.ts +2 -0
package/src/device/bot.ts CHANGED
@@ -1488,18 +1488,18 @@ export class Bot {
1488
1488
  }
1489
1489
 
1490
1490
  async deviceRetry(device: device & devicesConfig): Promise<void> {
1491
- if (device.maxRetries === undefined) {
1491
+ if (!device.maxRetries) {
1492
1492
  this.maxRetries = 5; // Maximum number of retries
1493
1493
  this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Max Retries Not Set, Using: ${this.maxRetries}`);
1494
1494
  } else {
1495
1495
  this.maxRetries = device.maxRetries;
1496
1496
  this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Using Device Max Retries: ${this.maxRetries}`);
1497
1497
  }
1498
- if (device.delayBetweenRetries === undefined) {
1498
+ if (!device.delayBetweenRetries) {
1499
1499
  this.delayBetweenRetries = 3000; // Delay between retries in milliseconds
1500
1500
  this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Delay Between Retries Not Set, Using: ${this.delayBetweenRetries}`);
1501
1501
  } else {
1502
- this.delayBetweenRetries = device.delayBetweenRetries;
1502
+ this.delayBetweenRetries = device.delayBetweenRetries * 1000;
1503
1503
  this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Using Device Delay Between Retries: ${this.delayBetweenRetries}`);
1504
1504
  }
1505
1505
  }
@@ -1149,18 +1149,18 @@ export class CeilingLight {
1149
1149
  }
1150
1150
 
1151
1151
  async deviceRetry(device: device & devicesConfig): Promise<void> {
1152
- if (device.maxRetries === undefined) {
1152
+ if (!device.maxRetries) {
1153
1153
  this.maxRetries = 5; // Maximum number of retries
1154
1154
  this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Max Retries Not Set, Using: ${this.maxRetries}`);
1155
1155
  } else {
1156
1156
  this.maxRetries = device.maxRetries;
1157
1157
  this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Using Device Max Retries: ${this.maxRetries}`);
1158
1158
  }
1159
- if (device.delayBetweenRetries === undefined) {
1159
+ if (!device.delayBetweenRetries) {
1160
1160
  this.delayBetweenRetries = 3000; // Delay between retries in milliseconds
1161
1161
  this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Delay Between Retries Not Set, Using: ${this.delayBetweenRetries}`);
1162
1162
  } else {
1163
- this.delayBetweenRetries = device.delayBetweenRetries;
1163
+ this.delayBetweenRetries = device.delayBetweenRetries * 1000;
1164
1164
  this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Using Device Delay Between Retries: ${this.delayBetweenRetries}`);
1165
1165
  }
1166
1166
  }
@@ -1358,18 +1358,18 @@ export class ColorBulb {
1358
1358
  }
1359
1359
 
1360
1360
  async deviceRetry(device: device & devicesConfig): Promise<void> {
1361
- if (device.maxRetries === undefined) {
1361
+ if (!device.maxRetries) {
1362
1362
  this.maxRetries = 5; // Maximum number of retries
1363
1363
  this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Max Retries Not Set, Using: ${this.maxRetries}`);
1364
1364
  } else {
1365
1365
  this.maxRetries = device.maxRetries;
1366
1366
  this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Using Device Max Retries: ${this.maxRetries}`);
1367
1367
  }
1368
- if (device.delayBetweenRetries === undefined) {
1368
+ if (!device.delayBetweenRetries) {
1369
1369
  this.delayBetweenRetries = 3000; // Delay between retries in milliseconds
1370
1370
  this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Delay Between Retries Not Set, Using: ${this.delayBetweenRetries}`);
1371
1371
  } else {
1372
- this.delayBetweenRetries = device.delayBetweenRetries;
1372
+ this.delayBetweenRetries = device.delayBetweenRetries * 1000;
1373
1373
  this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Using Device Delay Between Retries: ${this.delayBetweenRetries}`);
1374
1374
  }
1375
1375
  }
@@ -712,18 +712,18 @@ export class Contact {
712
712
  }
713
713
 
714
714
  async deviceRetry(device: device & devicesConfig): Promise<void> {
715
- if (device.maxRetries === undefined) {
715
+ if (!device.maxRetries) {
716
716
  this.maxRetries = 5; // Maximum number of retries
717
717
  this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Max Retries Not Set, Using: ${this.maxRetries}`);
718
718
  } else {
719
719
  this.maxRetries = device.maxRetries;
720
720
  this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Using Device Max Retries: ${this.maxRetries}`);
721
721
  }
722
- if (device.delayBetweenRetries === undefined) {
722
+ if (!device.delayBetweenRetries) {
723
723
  this.delayBetweenRetries = 3000; // Delay between retries in milliseconds
724
724
  this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Delay Between Retries Not Set, Using: ${this.delayBetweenRetries}`);
725
725
  } else {
726
- this.delayBetweenRetries = device.delayBetweenRetries;
726
+ this.delayBetweenRetries = device.delayBetweenRetries * 1000;
727
727
  this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Using Device Delay Between Retries: ${this.delayBetweenRetries}`);
728
728
  }
729
729
  }
@@ -1315,18 +1315,18 @@ export class Curtain {
1315
1315
  }
1316
1316
 
1317
1317
  async deviceRetry(device: device & devicesConfig): Promise<void> {
1318
- if (device.maxRetries === undefined) {
1318
+ if (!device.maxRetries) {
1319
1319
  this.maxRetries = 5; // Maximum number of retries
1320
1320
  this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Max Retries Not Set, Using: ${this.maxRetries}`);
1321
1321
  } else {
1322
1322
  this.maxRetries = device.maxRetries;
1323
1323
  this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Using Device Max Retries: ${this.maxRetries}`);
1324
1324
  }
1325
- if (device.delayBetweenRetries === undefined) {
1325
+ if (!device.delayBetweenRetries) {
1326
1326
  this.delayBetweenRetries = 3000; // Delay between retries in milliseconds
1327
1327
  this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Delay Between Retries Not Set, Using: ${this.delayBetweenRetries}`);
1328
1328
  } else {
1329
- this.delayBetweenRetries = device.delayBetweenRetries;
1329
+ this.delayBetweenRetries = device.delayBetweenRetries * 1000;
1330
1330
  this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Using Device Delay Between Retries: ${this.delayBetweenRetries}`);
1331
1331
  }
1332
1332
  }
package/src/device/hub.ts CHANGED
@@ -746,18 +746,18 @@ export class Hub {
746
746
  }
747
747
 
748
748
  async deviceRetry(device: device & devicesConfig): Promise<void> {
749
- if (device.maxRetries === undefined) {
749
+ if (!device.maxRetries) {
750
750
  this.maxRetries = 5; // Maximum number of retries
751
751
  this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Max Retries Not Set, Using: ${this.maxRetries}`);
752
752
  } else {
753
753
  this.maxRetries = device.maxRetries;
754
754
  this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Using Device Max Retries: ${this.maxRetries}`);
755
755
  }
756
- if (device.delayBetweenRetries === undefined) {
756
+ if (!device.delayBetweenRetries) {
757
757
  this.delayBetweenRetries = 3000; // Delay between retries in milliseconds
758
758
  this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Delay Between Retries Not Set, Using: ${this.delayBetweenRetries}`);
759
759
  } else {
760
- this.delayBetweenRetries = device.delayBetweenRetries;
760
+ this.delayBetweenRetries = device.delayBetweenRetries * 1000;
761
761
  this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Using Device Delay Between Retries: ${this.delayBetweenRetries}`);
762
762
  }
763
763
  }
@@ -1028,18 +1028,18 @@ export class Humidifier {
1028
1028
  }
1029
1029
 
1030
1030
  async deviceRetry(device: device & devicesConfig): Promise<void> {
1031
- if (device.maxRetries === undefined) {
1031
+ if (!device.maxRetries) {
1032
1032
  this.maxRetries = 5; // Maximum number of retries
1033
1033
  this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Max Retries Not Set, Using: ${this.maxRetries}`);
1034
1034
  } else {
1035
1035
  this.maxRetries = device.maxRetries;
1036
1036
  this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Using Device Max Retries: ${this.maxRetries}`);
1037
1037
  }
1038
- if (device.delayBetweenRetries === undefined) {
1038
+ if (!device.delayBetweenRetries) {
1039
1039
  this.delayBetweenRetries = 3000; // Delay between retries in milliseconds
1040
1040
  this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Delay Between Retries Not Set, Using: ${this.delayBetweenRetries}`);
1041
1041
  } else {
1042
- this.delayBetweenRetries = device.delayBetweenRetries;
1042
+ this.delayBetweenRetries = device.delayBetweenRetries * 1000;
1043
1043
  this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Using Device Delay Between Retries: ${this.delayBetweenRetries}`);
1044
1044
  }
1045
1045
  }
@@ -747,18 +747,18 @@ export class IOSensor {
747
747
  }
748
748
 
749
749
  async deviceRetry(device: device & devicesConfig): Promise<void> {
750
- if (device.maxRetries === undefined) {
750
+ if (!device.maxRetries) {
751
751
  this.maxRetries = 5; // Maximum number of retries
752
752
  this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Max Retries Not Set, Using: ${this.maxRetries}`);
753
753
  } else {
754
754
  this.maxRetries = device.maxRetries;
755
755
  this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Using Device Max Retries: ${this.maxRetries}`);
756
756
  }
757
- if (device.delayBetweenRetries === undefined) {
757
+ if (!device.delayBetweenRetries) {
758
758
  this.delayBetweenRetries = 3000; // Delay between retries in milliseconds
759
759
  this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Delay Between Retries Not Set, Using: ${this.delayBetweenRetries}`);
760
760
  } else {
761
- this.delayBetweenRetries = device.delayBetweenRetries;
761
+ this.delayBetweenRetries = device.delayBetweenRetries * 1000;
762
762
  this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Using Device Delay Between Retries: ${this.delayBetweenRetries}`);
763
763
  }
764
764
  }
@@ -1177,18 +1177,18 @@ export class StripLight {
1177
1177
  }
1178
1178
 
1179
1179
  async deviceRetry(device: device & devicesConfig): Promise<void> {
1180
- if (device.maxRetries === undefined) {
1180
+ if (!device.maxRetries) {
1181
1181
  this.maxRetries = 5; // Maximum number of retries
1182
1182
  this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Max Retries Not Set, Using: ${this.maxRetries}`);
1183
1183
  } else {
1184
1184
  this.maxRetries = device.maxRetries;
1185
1185
  this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Using Device Max Retries: ${this.maxRetries}`);
1186
1186
  }
1187
- if (device.delayBetweenRetries === undefined) {
1187
+ if (!device.delayBetweenRetries) {
1188
1188
  this.delayBetweenRetries = 3000; // Delay between retries in milliseconds
1189
1189
  this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Delay Between Retries Not Set, Using: ${this.delayBetweenRetries}`);
1190
1190
  } else {
1191
- this.delayBetweenRetries = device.delayBetweenRetries;
1191
+ this.delayBetweenRetries = device.delayBetweenRetries * 1000;
1192
1192
  this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Using Device Delay Between Retries: ${this.delayBetweenRetries}`);
1193
1193
  }
1194
1194
  }
@@ -852,18 +852,18 @@ export class Lock {
852
852
  }
853
853
 
854
854
  async deviceRetry(device: device & devicesConfig): Promise<void> {
855
- if (device.maxRetries === undefined) {
855
+ if (!device.maxRetries) {
856
856
  this.maxRetries = 5; // Maximum number of retries
857
857
  this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Max Retries Not Set, Using: ${this.maxRetries}`);
858
858
  } else {
859
859
  this.maxRetries = device.maxRetries;
860
860
  this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Using Device Max Retries: ${this.maxRetries}`);
861
861
  }
862
- if (device.delayBetweenRetries === undefined) {
862
+ if (!device.delayBetweenRetries) {
863
863
  this.delayBetweenRetries = 3000; // Delay between retries in milliseconds
864
864
  this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Delay Between Retries Not Set, Using: ${this.delayBetweenRetries}`);
865
865
  } else {
866
- this.delayBetweenRetries = device.delayBetweenRetries;
866
+ this.delayBetweenRetries = device.delayBetweenRetries * 1000;
867
867
  this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Using Device Delay Between Retries: ${this.delayBetweenRetries}`);
868
868
  }
869
869
  }
@@ -740,18 +740,18 @@ export class Meter {
740
740
  }
741
741
 
742
742
  async deviceRetry(device: device & devicesConfig): Promise<void> {
743
- if (device.maxRetries === undefined) {
743
+ if (!device.maxRetries) {
744
744
  this.maxRetries = 5; // Maximum number of retries
745
745
  this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Max Retries Not Set, Using: ${this.maxRetries}`);
746
746
  } else {
747
747
  this.maxRetries = device.maxRetries;
748
748
  this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Using Device Max Retries: ${this.maxRetries}`);
749
749
  }
750
- if (device.delayBetweenRetries === undefined) {
750
+ if (!device.delayBetweenRetries) {
751
751
  this.delayBetweenRetries = 3000; // Delay between retries in milliseconds
752
752
  this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Delay Between Retries Not Set, Using: ${this.delayBetweenRetries}`);
753
753
  } else {
754
- this.delayBetweenRetries = device.delayBetweenRetries;
754
+ this.delayBetweenRetries = device.delayBetweenRetries * 1000;
755
755
  this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Using Device Delay Between Retries: ${this.delayBetweenRetries}`);
756
756
  }
757
757
  }
@@ -755,18 +755,18 @@ export class MeterPlus {
755
755
  }
756
756
 
757
757
  async deviceRetry(device: device & devicesConfig): Promise<void> {
758
- if (device.maxRetries === undefined) {
758
+ if (!device.maxRetries) {
759
759
  this.maxRetries = 5; // Maximum number of retries
760
760
  this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Max Retries Not Set, Using: ${this.maxRetries}`);
761
761
  } else {
762
762
  this.maxRetries = device.maxRetries;
763
763
  this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Using Device Max Retries: ${this.maxRetries}`);
764
764
  }
765
- if (device.delayBetweenRetries === undefined) {
765
+ if (!device.delayBetweenRetries) {
766
766
  this.delayBetweenRetries = 3000; // Delay between retries in milliseconds
767
767
  this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Delay Between Retries Not Set, Using: ${this.delayBetweenRetries}`);
768
768
  } else {
769
- this.delayBetweenRetries = device.delayBetweenRetries;
769
+ this.delayBetweenRetries = device.delayBetweenRetries * 1000;
770
770
  this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Using Device Delay Between Retries: ${this.delayBetweenRetries}`);
771
771
  }
772
772
  }
@@ -669,18 +669,18 @@ export class Motion {
669
669
  }
670
670
 
671
671
  async deviceRetry(device: device & devicesConfig): Promise<void> {
672
- if (device.maxRetries === undefined) {
672
+ if (!device.maxRetries) {
673
673
  this.maxRetries = 5; // Maximum number of retries
674
674
  this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Max Retries Not Set, Using: ${this.maxRetries}`);
675
675
  } else {
676
676
  this.maxRetries = device.maxRetries;
677
677
  this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Using Device Max Retries: ${this.maxRetries}`);
678
678
  }
679
- if (device.delayBetweenRetries === undefined) {
679
+ if (!device.delayBetweenRetries) {
680
680
  this.delayBetweenRetries = 3000; // Delay between retries in milliseconds
681
681
  this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Delay Between Retries Not Set, Using: ${this.delayBetweenRetries}`);
682
682
  } else {
683
- this.delayBetweenRetries = device.delayBetweenRetries;
683
+ this.delayBetweenRetries = device.delayBetweenRetries * 1000;
684
684
  this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Using Device Delay Between Retries: ${this.delayBetweenRetries}`);
685
685
  }
686
686
  }
@@ -696,18 +696,18 @@ export class Plug {
696
696
  }
697
697
 
698
698
  async deviceRetry(device: device & devicesConfig): Promise<void> {
699
- if (device.maxRetries === undefined) {
699
+ if (!device.maxRetries) {
700
700
  this.maxRetries = 5; // Maximum number of retries
701
701
  this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Max Retries Not Set, Using: ${this.maxRetries}`);
702
702
  } else {
703
703
  this.maxRetries = device.maxRetries;
704
704
  this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Using Device Max Retries: ${this.maxRetries}`);
705
705
  }
706
- if (device.delayBetweenRetries === undefined) {
706
+ if (!device.delayBetweenRetries) {
707
707
  this.delayBetweenRetries = 3000; // Delay between retries in milliseconds
708
708
  this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Delay Between Retries Not Set, Using: ${this.delayBetweenRetries}`);
709
709
  } else {
710
- this.delayBetweenRetries = device.delayBetweenRetries;
710
+ this.delayBetweenRetries = device.delayBetweenRetries * 1000;
711
711
  this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Using Device Delay Between Retries: ${this.delayBetweenRetries}`);
712
712
  }
713
713
  }
@@ -857,18 +857,18 @@ export class RobotVacuumCleaner {
857
857
  }
858
858
 
859
859
  async deviceRetry(device: device & devicesConfig): Promise<void> {
860
- if (device.maxRetries === undefined) {
860
+ if (!device.maxRetries) {
861
861
  this.maxRetries = 5; // Maximum number of retries
862
862
  this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Max Retries Not Set, Using: ${this.maxRetries}`);
863
863
  } else {
864
864
  this.maxRetries = device.maxRetries;
865
865
  this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Using Device Max Retries: ${this.maxRetries}`);
866
866
  }
867
- if (device.delayBetweenRetries === undefined) {
867
+ if (!device.delayBetweenRetries) {
868
868
  this.delayBetweenRetries = 3000; // Delay between retries in milliseconds
869
869
  this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Delay Between Retries Not Set, Using: ${this.delayBetweenRetries}`);
870
870
  } else {
871
- this.delayBetweenRetries = device.delayBetweenRetries;
871
+ this.delayBetweenRetries = device.delayBetweenRetries * 1000;
872
872
  this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Using Device Delay Between Retries: ${this.delayBetweenRetries}`);
873
873
  }
874
874
  }
@@ -593,18 +593,18 @@ export class WaterDetector {
593
593
  }
594
594
 
595
595
  async deviceRetry(device: device & devicesConfig): Promise<void> {
596
- if (device.maxRetries === undefined) {
596
+ if (!device.maxRetries) {
597
597
  this.maxRetries = 5; // Maximum number of retries
598
598
  this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Max Retries Not Set, Using: ${this.maxRetries}`);
599
599
  } else {
600
600
  this.maxRetries = device.maxRetries;
601
601
  this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Using Device Max Retries: ${this.maxRetries}`);
602
602
  }
603
- if (device.delayBetweenRetries === undefined) {
603
+ if (!device.delayBetweenRetries) {
604
604
  this.delayBetweenRetries = 3000; // Delay between retries in milliseconds
605
605
  this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Delay Between Retries Not Set, Using: ${this.delayBetweenRetries}`);
606
606
  } else {
607
- this.delayBetweenRetries = device.delayBetweenRetries;
607
+ this.delayBetweenRetries = device.delayBetweenRetries * 1000;
608
608
  this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Using Device Delay Between Retries: ${this.delayBetweenRetries}`);
609
609
  }
610
610
  }
package/src/platform.ts CHANGED
@@ -39,7 +39,7 @@ import fakegato from 'fakegato-history';
39
39
  import asyncmqtt from 'async-mqtt';
40
40
  import crypto, { randomUUID } from 'crypto';
41
41
  import { readFileSync, writeFileSync } from 'fs';
42
- import hbLib from 'homebridge-lib';
42
+ import { EveHomeKitTypes } from 'homebridge-lib';
43
43
  import { UrlObject } from 'url';
44
44
  import { sleep } from './utils.js';
45
45
 
@@ -58,6 +58,8 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
58
58
  version!: string;
59
59
  Logging?: string;
60
60
  debugMode!: boolean;
61
+ maxRetries!: number;
62
+ delayBetweenRetries!: number;
61
63
  platformConfig!: SwitchBotPlatformConfig['options'];
62
64
  platformLogging!: SwitchBotPlatformConfig['logging'];
63
65
  config!: SwitchBotPlatformConfig;
@@ -106,7 +108,6 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
106
108
  }
107
109
 
108
110
  // import fakegato-history module and EVE characteristics
109
- const { EveHomeKitTypes } = hbLib;
110
111
  this.fakegatoAPI = fakegato(api);
111
112
  this.eve = new EveHomeKitTypes(api);
112
113
 
@@ -385,6 +386,21 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
385
386
  this.debugWarnLog('Using Default Push Rate.');
386
387
  }
387
388
 
389
+ if (!this.config.options.maxRetries) {
390
+ this.config.options!.maxRetries! = 5;
391
+ this.debugWarnLog('Using Default Max Retries.');
392
+ } else {
393
+ this.maxRetries = this.config.options.maxRetries;
394
+ }
395
+
396
+ if (!this.config.options.delayBetweenRetries) {
397
+ // default 3 seconds
398
+ this.config.options!.delayBetweenRetries! = 3000;
399
+ this.debugWarnLog('Using Default Delay Between Retries.');
400
+ } else {
401
+ this.delayBetweenRetries = this.config.options.delayBetweenRetries * 1000;
402
+ }
403
+
388
404
  if (!this.config.credentials && !this.config.options) {
389
405
  this.debugWarnLog('Missing Credentials');
390
406
  } else if (this.config.credentials && !this.config.credentials.notice) {
@@ -495,8 +511,8 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
495
511
  async discoverDevices() {
496
512
  if (this.config.credentials?.token) {
497
513
  let retryCount = 0;
498
- const maxRetries = 5; // Maximum number of retries
499
- const delayBetweenRetries = 5000; // Delay between retries in milliseconds
514
+ const maxRetries = this.maxRetries; // Maximum number of retries
515
+ const delayBetweenRetries = this.delayBetweenRetries; // Delay between retries in milliseconds
500
516
  while (retryCount < maxRetries) {
501
517
  try {
502
518
  const { body, statusCode } = await request(Devices, {
package/src/settings.ts CHANGED
@@ -36,6 +36,8 @@ export type credentials = {
36
36
  export type options = {
37
37
  refreshRate?: number;
38
38
  pushRate?: number;
39
+ maxRetries?: number;
40
+ delayBetweenRetries?: number;
39
41
  logging?: string;
40
42
  devices?: Array<devicesConfig>;
41
43
  irdevices?: Array<irDevicesConfig>;