From a2587d694fa21ba67aa8151744d147d565b3c803 Mon Sep 17 00:00:00 2001 From: Andrew Grimberg Date: Thu, 19 Mar 2026 16:47:44 -0700 Subject: [PATCH] fix: remove persistent notifications from retry lock The autolock retry lock feature created persistent notifications when the door was open (unable to lock) and when the door closed (retrying). These were a holdover from the old automation-based architecture and are no longer needed since lock state is tracked by entities. Removes the send/dismiss of persistent notifications in _timer_triggered() and _door_closed(), along with the now-unused imports of send_persistent_notification, dismiss_persistent_notification, and slugify. Closes #384 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: Andrew Grimberg --- custom_components/keymaster/coordinator.py | 19 ------------------- 1 file changed, 19 deletions(-) diff --git a/custom_components/keymaster/coordinator.py b/custom_components/keymaster/coordinator.py index faf4de3e..06b4252d 100644 --- a/custom_components/keymaster/coordinator.py +++ b/custom_components/keymaster/coordinator.py @@ -31,7 +31,6 @@ from homeassistant.helpers.event import async_call_later, async_track_state_change_event from homeassistant.helpers.storage import Store from homeassistant.helpers.update_coordinator import DataUpdateCoordinator -from homeassistant.util import slugify from .const import ( ATTR_ACTION_CODE, @@ -60,9 +59,7 @@ Throttle, call_hass_service, delete_code_slot_entities, - dismiss_persistent_notification, send_manual_notification, - send_persistent_notification, ) from .lock import ( KeymasterCodeSlot, @@ -834,16 +831,6 @@ async def _door_closed(self, kmlock: KeymasterLock) -> None: if kmlock.retry_lock and kmlock.pending_retry_lock: await self._lock_lock(kmlock=kmlock) - await dismiss_persistent_notification( - hass=self.hass, - notification_id=f"{slugify(kmlock.lock_name).lower()}_autolock_door_open", - ) - await send_persistent_notification( - hass=self.hass, - title=f"{kmlock.lock_name} is closed", - message=f"The {kmlock.lock_name} sensor indicates the door has been closed, re-attempting to lock.", - notification_id=f"{slugify(kmlock.lock_name).lower()}_autolock_door_closed", - ) if kmlock.door_notifications: await send_manual_notification( @@ -887,12 +874,6 @@ async def _timer_triggered(self, kmlock: KeymasterLock, _: dt) -> None: _LOGGER.debug("[timer_triggered] %s", kmlock.lock_name) if kmlock.retry_lock and kmlock.door_state == STATE_OPEN: kmlock.pending_retry_lock = True - await send_persistent_notification( - hass=self.hass, - title=f"Unable to lock {kmlock.lock_name}", - message=f"Unable to lock {kmlock.lock_name} as the sensor indicates the door is currently opened. The operation will be automatically retried when the door is closed.", - notification_id=f"{slugify(kmlock.lock_name).lower()}_autolock_door_open", - ) else: await self._lock_lock(kmlock=kmlock)