Hi. For each of my lights, I have two timers - one that starts when “turned on based on motion (automatic)” and the other starts when “turned on by a switch”. Once both are finished, the light is turned off. As I am doing this for quite a few lights, I wanted to save myself the duplication and made the automation action a bit generic by handling all timers at once. This used to work very reliably, but (subjectively) since yesterday and maybe (or maybe not ) recent updates (HA Core, etc as well as some new scripts on my side) it stopped working.
I debugged it to the issue being that the timer that finishes is not set to state “idle”, which my script assumes and which worked previously. Minimal example:
- alias: debug
trigger:
platform: event
event_type: timer.finished
action:
- service: system_log.write
data_template:
level: error
logger: homeassistant.components.mylogger
message: "timer that finished: {{ trigger.event.data.entity_id }}. Its state: {{ states[trigger.event.data.entity_id] }}"
and the log shows e.g. timer that finished: timer.manual_timer_hallway_whiteboard. Its state: <template TemplateState(<state timer.manual_timer_hallway_whiteboard=active; duration=0:00:20, editable=False, finishes_at=2024-04-06T14:41:55+00:00, remaining=0:00:20 @ 2024-04-06T16:41:35.313915+02:00>)>
As this script was not changed (verified by comparing with a backup version from last month), I wonder whether any default or behavior changed. I see in older logs that apparently this issue happened in the past as well, but only very rarely. Now it happens every single time. So maybe some configuration changes on my side or in general causes this to be more consistent?
What is the expected behavior? From my perspective, when I get the timer.finished event for timer X, I would assume that timer.X is not in state “active” anymore but “idle” (otherwise, has it really finished? ). Is this a misconception?