Is there suppose to be a duration limit for the Timer? I am running Home Assistant 0.105.3.
The Timer seems to be working correctly when the duration is set for less than a day. A set time that exceeds one day the countdown is frozen or not working.
Looking at the code, there is no implicit max duration.
python datetime timedelta does have a max of 999999999 days though. So if you plan on running for more than 2.7 million years, you might have an issue. Keep in mind this value will be slightly less as it will do math to compare now() to this timedelta, so you might only be able to run for 2.6 million years.
Also note, timers stop on server restartâŚthough it sounds like as soon as you input a value > 1 day, the timer no longer counts right away, not after 24 hours.
@AhmadK and @jocnnor I believe you are correct. It seems that the timer is working. It looks like the rendering is an issue in both the lovelace card and the state that are both not showing the countdown.
Maybe you can help me with the retrieval of the countdown via a sensor template, the code bellow shows the remaining time when you pause but I wish to publish the countdown time (lets say every minute)
and the template stop working? This is partially why I got fooled thinking that the issue was with the timer though it also does not display the countdown.
That doesnât show sensor.time configured. Youâd have to add it to configuration.yaml. Itâs a separate sensor completely useful for many other things.
In developer tools -> states, do you see a sensor.time in the available sensors?
By specifying an entity_id in a template, you are telling HA to update this template every time the entity_id is updated. If you donât specify one, it will use the value_template to guess which entity it needs to track. By specifying sensor.time, you are forcing it to update every 1 second minute. Without it, it will only update when timer.incubator_heater_timer1 updatesâŚwhich is only on start/stop/pause.
If you donât have a sensor.time sensor created, it will never update as it wont be able to follow the missing sensor.
@jocnnor Thanks for the explanation. Indeed I was missing the âsensor.timeâ May I ask how I retrieve the running countdown attribute? I can see it in the timer if is less than 24 hours but after that it disappears from the entity
I think that the attribute âremainingâ is updated only if I an execution of the start/stop/pause occurs.
Though I appreciate the suggestion of using the sensor.time (I also learned something new). This is not exactly helping me to get an update of the remaining time while the timer is running.
I suspect thatâs a bug weâre yet to find a way to deal with.
Long story short, but here is one of the discussions, have a read. Pay attention to balloobâs reply on how LL deals with timers.
Just to make it clear - remaining attribute is not updated on running timers at the moment if you use standard timer. Therefore itâs kind of pointless to use it. At the link above I described a workaround using input_datetime - let me know if you need more details.
Not sure why the attribute vanishes when greater than 1 day. It is converting it to a stringâŚand timedelta conversion does something different when > 1 day. Could be something else causing the attribute to be empty.
Keep in mind, these attributes are ONLY updated on start/stop/pause events. Itâs not a bug. This class updates these values, then fires off a callback to the system at some future date. In between all of those, none of these values are going to update. So even if it wasnât missing, itâs not going to help you as it wont update ever.
Youâd think the END time would be an attribute. Then you could just use a template sensor and calculate the timer yourself if you cared!
Not sure. Iâm not sure if there is some config that tells HA the output to expect. Attributes can be literally any string, so it should just be the entire string there unless itâs validating the attribute to something else.