diff --git a/homebridge-ui/public/index.html b/homebridge-ui/public/index.html
index 012346c1..bd9290fe 100644
--- a/homebridge-ui/public/index.html
+++ b/homebridge-ui/public/index.html
@@ -5,7 +5,7 @@
style="width: 50%" />
-
Thank you for installing homebridge-switchbot
+
Thank you for installing homebridge-switchbot
Before continuing:
-
diff --git a/src/device/blindtilt.ts b/src/device/blindtilt.ts
index e2e3f690..2cc3510b 100644
--- a/src/device/blindtilt.ts
+++ b/src/device/blindtilt.ts
@@ -613,7 +613,7 @@ export class BlindTilt {
.then(async (device_list: any) => {
this.infoLog(`${this.accessory.displayName} Target Position: ${this.TargetPosition}`);
return await this.retry({
- max: await this.maxRetry(),
+ max: this.maxRetry(),
fn: async () => {
return await device_list[0].runToPos(100 - Number(this.TargetPosition), adjustedMode);
},
@@ -651,14 +651,12 @@ export class BlindTilt {
});
}
- async maxRetry(): Promise {
- let maxRetry: number;
+ maxRetry(): number {
if (this.device.maxRetry) {
- maxRetry = this.device.maxRetry;
+ return this.device.maxRetry;
} else {
- maxRetry = 5;
+ return 5;
}
- return maxRetry;
}
async openAPIpushChanges(): Promise {
diff --git a/src/device/bot.ts b/src/device/bot.ts
index e49dd9a5..76cd1933 100644
--- a/src/device/bot.ts
+++ b/src/device/bot.ts
@@ -659,7 +659,7 @@ export class Bot {
.then(async (device_list: any) => {
this.infoLog(`${this.device.deviceType}: ${this.accessory.displayName} On: ${this.On}`);
return await this.retry({
- max: await this.maxRetry(),
+ max: this.maxRetry(),
fn: async () => {
if (this.On) {
return await device_list[0].turnOn({ id: this.device.bleMac });
@@ -1184,14 +1184,12 @@ export class Bot {
});
}
- async maxRetry(): Promise {
- let maxRetry: number;
+ maxRetry(): number {
if (this.device.maxRetry) {
- maxRetry = this.device.maxRetry;
+ return this.device.maxRetry;
} else {
- maxRetry = 5;
+ return 5;
}
- return maxRetry;
}
async PressOrSwitch(device: device & devicesConfig): Promise {
diff --git a/src/device/ceilinglight.ts b/src/device/ceilinglight.ts
index a2fbd730..49ccd923 100644
--- a/src/device/ceilinglight.ts
+++ b/src/device/ceilinglight.ts
@@ -492,7 +492,7 @@ export class CeilingLight {
.then(async (device_list: any) => {
this.infoLog(`${this.device.deviceType}: ${this.accessory.displayName} On: ${this.On}`);
return await this.retry({
- max: await this.maxRetry(),
+ max: this.maxRetry(),
fn: async () => {
if (this.On) {
return await device_list[0].turnOn({ id: this.device.bleMac });
@@ -977,14 +977,12 @@ export class CeilingLight {
});
}
- async maxRetry(): Promise {
- let maxRetry: number;
+ maxRetry(): number {
if (this.device.maxRetry) {
- maxRetry = this.device.maxRetry;
+ return this.device.maxRetry;
} else {
- maxRetry = 5;
+ return 5;
}
- return maxRetry;
}
minStep(device: device & devicesConfig): number {
diff --git a/src/device/colorbulb.ts b/src/device/colorbulb.ts
index 1670a784..a1cfe5e5 100644
--- a/src/device/colorbulb.ts
+++ b/src/device/colorbulb.ts
@@ -527,7 +527,7 @@ export class ColorBulb {
.then(async (device_list: any) => {
this.infoLog(`${this.device.deviceType}: ${this.accessory.displayName} On: ${this.On}`);
return await this.retry({
- max: await this.maxRetry(),
+ max: this.maxRetry(),
fn: async () => {
if (this.On) {
return await device_list[0].turnOn({ id: this.device.bleMac });
@@ -1134,14 +1134,12 @@ export class ColorBulb {
});
}
- async maxRetry(): Promise {
- let maxRetry: number;
+ maxRetry(): number {
if (this.device.maxRetry) {
- maxRetry = this.device.maxRetry;
+ return this.device.maxRetry;
} else {
- maxRetry = 5;
+ return 5;
}
- return maxRetry;
}
minStep(device: device & devicesConfig): number {
diff --git a/src/device/curtain.ts b/src/device/curtain.ts
index 35618acf..c40321c0 100644
--- a/src/device/curtain.ts
+++ b/src/device/curtain.ts
@@ -570,7 +570,7 @@ export class Curtain {
this.debugLog(`${this.accessory.displayName} Mode: ${this.Mode}`);
if (switchbot !== false) {
await this.retry({
- max: await this.maxRetry(),
+ max: this.maxRetry(),
fn: () => {
return switchbot
.discover({ model: 'c', quick: true, id: this.device.bleMac })
@@ -613,14 +613,12 @@ export class Curtain {
});
}
- async maxRetry(): Promise {
- let maxRetry: number;
+ maxRetry(): number {
if (this.device.maxRetry) {
- maxRetry = this.device.maxRetry;
+ return this.device.maxRetry;
} else {
- maxRetry = 5;
+ return 5;
}
- return maxRetry;
}
async openAPIpushChanges(): Promise {
diff --git a/src/device/motion.ts b/src/device/motion.ts
index 7ea8d00a..1f20216a 100644
--- a/src/device/motion.ts
+++ b/src/device/motion.ts
@@ -265,7 +265,7 @@ export class Motion {
})
.then(async () => {
return await this.retry({
- max: await this.maxRetry(),
+ max: this.maxRetry(),
fn: async () => {
// Set an event hander
this.scanning = true;
@@ -467,14 +467,12 @@ export class Motion {
});
}
- async maxRetry(): Promise {
- let maxRetry: number;
+ maxRetry(): number {
if (this.device.maxRetry) {
- maxRetry = this.device.maxRetry;
+ return this.device.maxRetry;
} else {
- maxRetry = 5;
+ return 5;
}
- return maxRetry;
}
minLux(): number {
diff --git a/src/device/plug.ts b/src/device/plug.ts
index 4158dc04..43894967 100644
--- a/src/device/plug.ts
+++ b/src/device/plug.ts
@@ -351,7 +351,7 @@ export class Plug {
.then(async (device_list: any) => {
this.infoLog(`${this.device.deviceType}: ${this.accessory.displayName} On: ${this.On}`);
return await this.retry({
- max: await this.maxRetry(),
+ max: this.maxRetry(),
fn: async () => {
if (this.On) {
return await device_list[0].turnOn({ id: this.device.bleMac });
@@ -533,14 +533,12 @@ export class Plug {
});
}
- async maxRetry(): Promise {
- let maxRetry: number;
+ maxRetry(): number {
if (this.device.maxRetry) {
- maxRetry = this.device.maxRetry;
+ return this.device.maxRetry;
} else {
- maxRetry = 5;
+ return 5;
}
- return maxRetry;
}
model(device: device & devicesConfig): string {
diff --git a/src/device/robotvacuumcleaner.ts b/src/device/robotvacuumcleaner.ts
index 68595663..0873ba00 100644
--- a/src/device/robotvacuumcleaner.ts
+++ b/src/device/robotvacuumcleaner.ts
@@ -362,7 +362,7 @@ export class RobotVacuumCleaner {
.then(async (device_list: any) => {
this.infoLog(`${this.device.deviceType}: ${this.accessory.displayName} On: ${this.On}`);
return await this.retry({
- max: await this.maxRetry(),
+ max: this.maxRetry(),
fn: async () => {
if (this.On) {
return await device_list[0].turnOn({ id: this.device.bleMac });
@@ -657,14 +657,12 @@ export class RobotVacuumCleaner {
});
}
- async maxRetry(): Promise {
- let maxRetry: number;
+ maxRetry(): number {
if (this.device.maxRetry) {
- maxRetry = this.device.maxRetry;
+ return this.device.maxRetry;
} else {
- maxRetry = 5;
+ return 5;
}
- return maxRetry;
}
model(device: device & devicesConfig): string {
diff --git a/src/device/striplight.ts b/src/device/striplight.ts
index eb8c020d..c4c206d3 100644
--- a/src/device/striplight.ts
+++ b/src/device/striplight.ts
@@ -467,7 +467,7 @@ export class StripLight {
.then(async (device_list: any) => {
this.infoLog(`${this.device.deviceType}: ${this.accessory.displayName} On: ${this.On}`);
return await this.retry({
- max: await this.maxRetry(),
+ max: this.maxRetry(),
fn: async () => {
if (this.On) {
return await device_list[0].turnOn({ id: this.device.bleMac });
@@ -898,14 +898,12 @@ export class StripLight {
});
}
- async maxRetry(): Promise {
- let maxRetry: number;
+ maxRetry(): number {
if (this.device.maxRetry) {
- maxRetry = this.device.maxRetry;
+ return this.device.maxRetry;
} else {
- maxRetry = 5;
+ return 5;
}
- return maxRetry;
}
minStep(device: device & devicesConfig): number {