When i simple display the timer in a lovelace entity card, it does show me the remaining seconds. I want somethin like this! But only if a timer is actually running.
But if I try to read the state of a running timer in the template editor, I only get a state of “active”. Not even the attributes are updated.
doesn’t work.
(above my sensors, the two below are your version).
I tried using sensor.time for force regular updates. Maybe I need to use an automation to refresh the template sensor every second. But I don’t want to run a automation that constantly checks if a timer is running.
Thank you for the suggestion. This doesn’t work for me, because I want to display the timer in a picture elements card. I basically need a simple ( template ) sensor, like in the snippet above, that displays what I need.
I saw it mentioned in the documentation but what exactly does it control? Lukastillman doesn’t want to suppress the display of the entire timer, just the timer’s state if the timer isn’t running. Is that possible with a Picture Element card?
However, I tried it and it doesn’t work. The state of the timer is active and that is what’s displayed, when I add it in the picture element card. For some reason, the remaining time is only displayed in the entities card.
@123 I could have worked, if the state of the timer actually contained the remaining time.
This has come up a lot before, including by myself.
I think the bottom line is this…
The remaining attribute does not ever update when a timer is active. In fact I believe that timers don’t even actually count down the time at all but when they are started they work out what time they will finish and then stop at that time.
Lovelace will display the countdown (I assume by working it out) but I find it doesn’t always keep updating if the tab loses focus. Also it only works at all if you do not start the timer again before it has finished. In that case it will just show active and the initial time.
@petro in another post said he looked at the code and one way to get the remaining time is to pause the timer. This will populate the remaining attribute. Not useful for time critical purposes but I can confirm it works as I have spent all day today rewriting all my PIR sensor code using pauses and starts to allow me to have reliable data with sensors that sleep for four minutes after four activations within four minutes (but that is another story).
I think it is by design. I think it because it was considered too processor intensive to keep decrementing timers every second. At least I am sure I read that explanation somewhere else…