Just ran in to this and realised that I was running on a Raspberry Pi 3 which was getting under-voltage. You aren’t running on a pi are you? I need to get an official power adapter really.
I ran into this issue today, with a timer finishing hours early for no discernible reason. I guess I will enable logs too. I’m running hassio on ESXI.
Did you fix this issue? I have similar problem, while running a timer it suddenly goes to idle, seems like random, will enable debug mode to see what is making the timer to go to idle
in short no.
A later update at the time of HA seemed to make it fail less often, but I only use this functionality during cold weather, so not used it in a while, will be using it more and more as the weather gets colder, might run in to this issue again soon. Will report in if it starts happening again.
I read this discussion…
I face the same problem. Randomly my timer (12 hours) stops before the end, without a reason or trigger.
Did you find already any solution?
I have not found a solution
But I’m currently running 0.115.6 and have used 3 timers heavily in the last month and so far not once have they stopped prematurely.
I have not changed any hardware since I first encountered the issue, other than HA version I can’t think of anything that has changed.
if your automation is starting a timer, then most likely your automation trigger is the cause.
My Timer (defined in Helpers:
My trigger to start timer in automation:
- id: ‘1609150657468’
alias: Pomp Vloerverwarming Uit dan Start Timer 12 uur
description: ‘’
trigger:- platform: device
type: turned_off
device_id: 530e31184c952ac22f6db63b8c4a3137
entity_id: switch.pomp_vloerverwarming_switch
domain: switch
condition: []
action: - service: timer.start
data: {}
entity_id: timer.timer_12_uur
mode: single
- platform: device
I’ve been using a timer for a while now, and just noticed it stops early. I’m not sure if this is a newly (re)introduced issue… (running 2021.3.4 n a docker image)
I don’t think the problem is with my automations etc as there are only a couple of places where timer start and finish calls are made from, and I’ve moved them into scripts while trying to debug this stuff. It’s a simple motion-triggered timer controlling my heating. I was going to use more timers for other tasks, but holding off while this issue persists.
I have set the duration for 2 hours in the timer configuration, and now also explicitly set the timer on the start call to rule out any issues on that front. (it makes no difference)
After switching logger into full debug mode, it just happened again…
I see messages at 12:54:49 saying that the timer is starting, duration 2hrs, ending a 14:54:49
At 13:10:40 I get a timer.finished log message saying that the state is now idle. Oddly the end time is still showing as 14:54:49
I don’t see anything odd leading up to the timer.finished message. There are no messages relating to the timer between the active and idle, other than websocket sends to the UI and automation triggers as the timer became active.
Anyone have any ideas about this? I’m no python guru, but happy to try things to get to the bottom of this…
2021-03-24 12:54:49 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event call_service[L]: domain=timer, service=start, service_data=entity_id=timer.heating, duration=02:00:00>
2021-03-24 12:54:49 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event state_changed[L]: entity_id=input_text.any_motion, old_state=<state input_text.any_motion=2021-03-24 12:54:26; editable=False, min=0, max=32, pattern=None, mode=text, friendly_name=Any @ 2021-03-24T12:54:26.347707+00:00>, new_state=<state input_text.any_motion=2021-03-24 12:54:49; editable=False, min=0, max=32, pattern=None, mode=text, friendly_name=Any @ 2021-03-24T12:54:49.765255+00:00>>
2021-03-24 12:54:49 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event timer.restarted[L]: entity_id=timer.heating>
2021-03-24 12:54:49 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event state_changed[L]: entity_id=timer.heating, old_state=<state timer.heating=active; duration=2:00:00, editable=False, finishes_at=2021-03-24T14:54:26+00:00, remaining=2:00:00, friendly_name=Heating @ 2021-03-24T12:54:26.357001+00:00>, new_state=<state timer.heating=active; duration=2:00:00, editable=False, finishes_at=2021-03-24T14:54:49+00:00, remaining=2:00:00, friendly_name=Heating @ 2021-03-24T12:54:49.779974+00:00>>
2021-03-24 12:54:49 DEBUG (MainThread) [homeassistant.components.websocket_api.http.connection] [140050459267328] Sending {"id": 30, "type": "event", "event": {"event_type": "state_changed", "data": {"entity_id": "timer.heating", "old_state": {"entity_id": "timer.heating", "state": "active", "attributes": {"duration":"2:00:00", "editable": false, "finishes_at": "2021-03-24T14:54:26+00:00", "remaining": "2:00:00", "friendly_name": "Heating"}, "last_changed": "2021-03-24T12:54:26.357001+00:00", "last_updated": "2021-03-24T12:54:26.357001+00:00", "context": {"id": "2b378e18104543e4d42002975d4f0246", "parent_id": "9466bcafcf02bd7a0a9e9dd4cd460d7d", "user_id": null}}, "new_state": {"entity_id": "timer.heating", "state": "active", "attributes": {"duration": "2:00:00", "editable": false, "finishes_at": "2021-03-24T14:54:49+00:00", "remaining": "2:00:00", "friendly_name": "Heating"}, "last_changed": "2021-03-24T12:54:49.779974+00:00", "last_updated": "2021-03-24T12:54:49.779974+00:00", "context": {"id": "254f82781027ff4ce472ad636ddc628d", "parent_id": "24cf75ba44a123d4a90c8f4afc6f5ea3", "user_id": null}}}, "origin": "LOCAL", "time_fired": "2021-03-24T12:54:49.779974+00:00", "context": {"id": "254f82781027ff4ce472ad636ddc628d", "parent_id": "24cf75ba44a123d4a90c8f4afc6f5ea3", "user_id": null}}}
2021-03-24 13:10:40 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event timer.finished[L]: entity_id=timer.heating>
2021-03-24 13:10:40 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event state_changed[L]: entity_id=timer.heating, old_state=<state timer.heating=active; duration=2:00:00, editable=False, finishes_at=2021-03-24T14:54:49+00:00, remaining=2:00:00, friendly_name=Heating @ 2021-03-24T12:54:49.779974+00:00>, new_state=<state timer.heating=idle; duration=2:00:00, editable=False, friendly_name=Heating @ 2021-03-24T13:10:40.003892+00:00>>
More information:
The timer is frequently re-started as motion detectors are triggered, and I am now logging in Info mode so I can see the ‘heating_on’ script getting called frequently. I see the timer went idle 25 minutes after the last call, but I also see that it is exactly 2 hours after a previous call…
I don’t know how the timers are coded, but is it possible that a re-trigger did not remove a pending expiry? It doesn’t sound like something that should happen, but this evidence suggests it might. Waiting for the next occurrence to see if the same thing happens… May have to take a look for the code to see how it’s implemented.
Confirmed - this happened again, timer goes idle despite re-triggers
Your automation should be restart, not whatever you currently have.
EDIT: and if you already have restart, you should be stopping the timer if it’s active and restart it.
The automations have been restarted many times, and has not fixed the issue.
As I now interact with the timer using a script, I can try stopping the timer before (re)starting it. However I worry that this might cause a different set of problems as it will probably trigger other actions. The point of restarting to the timer is to give a continuous ‘active’ state until 2 hours after the last motion is detected. So at best, this is a workaround until the re-triggering issue is fixed.
Thanks for the suggestion though
That’s not what I ment. I’m talking about the automation mode.
All of my automations are in queued mode at the moment, but I can change it
And queued doesn’t cancel the previous run of the automation. Restart does
I thought that applied to the action that was setting up the timer, not for the running of the timer itself. If the running of the timer is part of that, then I now see my error, and it sounds hopeful that this is the fix… Many thanks, I’ll change that now!
As I kind of suspected, changing the mode of the trigger does not affect this issue, it still randomly does resets to idle. Most timer restarts work, it’s just occasionally one expiry event does not get cancelled.