mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-05-08 03:01:47 +00:00
Merge 8d8a6c30c6 into 4fade39c90
This commit is contained in:
commit
a20949796e
2 changed files with 116 additions and 2 deletions
|
|
@ -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",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue