Skip to content

Commit

Permalink
update LockTargetState to match LockCurrentState during lock refresh …
Browse files Browse the repository at this point in the history
…events
  • Loading branch information
ryanpesek committed Jan 22, 2025
1 parent 66d3130 commit 80d32e5
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/devices/lock.ts
Original file line number Diff line number Diff line change
Expand Up @@ -192,11 +192,14 @@ export class LockMechanism extends deviceBase {
: this.lockStatus.state.unlocked
? this.hap.Characteristic.LockCurrentState.UNSECURED
: retryCount > 1 ? this.hap.Characteristic.LockCurrentState.JAMMED : this.hap.Characteristic.LockCurrentState.UNKNOWN
this.LockMechanism.LockTargetState = this.LockMechanism.LockCurrentState

if (this.LockMechanism.LockCurrentState === this.hap.Characteristic.LockCurrentState.UNKNOWN) {
await this.warnLog(`LockCurrentState: ${this.LockMechanism.LockCurrentState}, (UNKNOWN) parseStatus`
+ ` lockEvent: ${JSON.stringify(this.lockEvent)}`)
}
await this.debugLog(`LockCurrentState: ${this.LockMechanism.LockCurrentState}`)
await this.debugLog(`LockTargetState: ${this.LockMechanism.LockTargetState}`)
}
// Contact Sensor
if (!this.device.lock?.hide_contactsensor && this.ContactSensor?.Service) {
Expand Down Expand Up @@ -261,11 +264,14 @@ export class LockMechanism extends deviceBase {
: this.lockEvent.state.unlocked
? this.hap.Characteristic.LockCurrentState.UNSECURED
: retryCount > 1 ? this.hap.Characteristic.LockCurrentState.JAMMED : this.hap.Characteristic.LockCurrentState.UNKNOWN
this.LockMechanism.LockTargetState = this.LockMechanism.LockCurrentState

if (this.LockMechanism.LockCurrentState === this.hap.Characteristic.LockCurrentState.UNKNOWN) {
await this.warnLog(`LockCurrentState: ${this.LockMechanism.LockCurrentState}, (UNKNOWN) parseEventStatus`
+ ` lockEvent: ${JSON.stringify(this.lockEvent)}`)
}
await this.debugLog(`LockCurrentState: ${this.LockMechanism.LockCurrentState}`)
await this.debugLog(`LockTargetState: ${this.LockMechanism.LockTargetState}`)
}
// Contact Sensor
if (!this.device.lock?.hide_contactsensor && this.ContactSensor?.Service) {
Expand Down

0 comments on commit 80d32e5

Please sign in to comment.