From 80d32e5bd16d019bde40479581b7b8d269c11c82 Mon Sep 17 00:00:00 2001 From: Ryan Pesek Date: Wed, 22 Jan 2025 14:45:42 -0600 Subject: [PATCH] update LockTargetState to match LockCurrentState during lock refresh events --- src/devices/lock.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/devices/lock.ts b/src/devices/lock.ts index 1fa01f2..9fc9a53 100644 --- a/src/devices/lock.ts +++ b/src/devices/lock.ts @@ -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) { @@ -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) {