keymaster
keymaster copied to clipboard
ISSUE: auto-lock should always take into account door state
Describe the bug
The auto-lock option attempts to lock the door even when the door sensor indicates the door is open. As I understand it, the current implementation requires users to enable a separate retry_lock option to prevent this.
Users may not want retry_lock as it introduces new behavior related to locking the door when it is closed.
Auto-lock should always check door status before attempting to lock, regardless of configuration settings.
Environment (please complete the following information):
- OS: HassOS
- Type of system that HA is running on: dedicated
- Home Assistant version: 2025.10.1
- Component version: v0.1.0-b5
- Z-Wave integration name: zwave_js
- Lock make and model: Kwikset Zwave
Logs
Door opened at 15:32:34, but auto-lock still attempted to lock at 15:37:32 (door was open for ~5 minutes).
15:32:32.253 DEBUG [KeymasterTimer] Starting auto-lock timer for 300 seconds. Ending 2025-10-05 15:37:32.253754-06:00
15:32:34.136 DEBUG [door_opened] Garage Front Door: Running
15:37:32.254 DEBUG [timer_triggered] Garage Front Door
15:37:32.254 DEBUG [lock_lock] Garage Front Door: Locking
15:37:32.254 DEBUG [call_hass_service] service: lock.lock, target: {'entity_id': 'lock.garage_front_door'}
Proposed Fix
The _timer_triggered function should always check door status:
_LOGGER.debug("[timer_triggered] %s", kmlock.lock_name)
# Always check door status
if kmlock.door_state == STATE_OPEN:
_LOGGER.warning("[timer_triggered] %s: Cannot auto-lock - door is open", kmlock.lock_name)
return # Don't attempt to lock
# Door is closed, proceed with lock
await self._lock_lock(kmlock=kmlock)