This commit is contained in:
Brian D. Evans 2026-04-24 18:24:00 -05:00 committed by GitHub
commit a20949796e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 116 additions and 2 deletions

View file

@ -283,12 +283,14 @@ class HomeAssistantAdapter(BasePlatformAdapter):
# No filters configured and watch_all is off — drop the event
return
# Apply cooldown
# Apply cooldown check — but do NOT record the timestamp yet.
# Unchanged or malformed events (where ``_format_state_change``
# returns ``None`` below) must not consume the cooldown window
# and suppress the next real state change. See #12062.
now = time.time()
last = self._last_event_time.get(entity_id, 0)
if (now - last) < self._cooldown_seconds:
return
self._last_event_time[entity_id] = now
# Build human-readable message
old_state = event_data.get("old_state", {})
@ -298,6 +300,9 @@ class HomeAssistantAdapter(BasePlatformAdapter):
if not message:
return
# Only consume the cooldown window for events we actually forward.
self._last_event_time[entity_id] = now
# Build MessageEvent and forward to handler
source = self.build_source(
chat_id="ha_events",