Skip to content

Commit

Permalink
Update lock.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
donavanbecker committed May 20, 2024
1 parent 151a09e commit 0493738
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions src/devices/lock.ts
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,6 @@ export class LockMechanism extends deviceBase {
this.subscribeAugust();

// Start an update interval

if (this.deviceRefreshRate !== 0) {
interval(this.deviceRefreshRate * 1000)
.pipe(skipWhile(() => this.lockUpdateInProgress))
Expand All @@ -179,7 +178,9 @@ export class LockMechanism extends deviceBase {
await this.pushChanges();
} catch (e: any) {
this.errorLog(`doLockUpdate pushChanges: ${e}`);
await this.refreshStatus();
if (this.deviceRefreshRate !== 0) {
await this.refreshStatus();
}
}
this.lockUpdateInProgress = false;
});
Expand Down Expand Up @@ -229,7 +230,9 @@ export class LockMechanism extends deviceBase {
this.LockMechanism!.LockCurrentState = this.hap.Characteristic.LockCurrentState.JAMMED;
} else {
this.LockMechanism!.LockCurrentState = this.hap.Characteristic.LockCurrentState.UNKNOWN;
await this.refreshStatus();
if (this.deviceRefreshRate !== 0) {
await this.refreshStatus();
}
}
}

Expand Down Expand Up @@ -375,7 +378,9 @@ export class LockMechanism extends deviceBase {
this.infoLog(`Lock: ${this.accessory.displayName} was Locked`);
}
} else {
await this.refreshStatus();
if (this.deviceRefreshRate !== 0) {
await this.refreshStatus();
}
}
}
// Contact Sensor
Expand All @@ -393,7 +398,9 @@ export class LockMechanism extends deviceBase {
this.infoLog(`Lock: ${this.accessory.displayName} was Closed`);
}
} else {
await this.refreshStatus();
if (this.deviceRefreshRate !== 0) {
await this.refreshStatus();
}
}
}
// Update HomeKit
Expand Down

0 comments on commit 0493738

Please sign in to comment.