When I create a timer via a helper and start it, the remaining-var value doesn’t count down. This causes the value in the type: custom:button-card label to not count down.
Is this a bug, or is there another field I can display in the label?
Installation method Home Assistant Core
Core 2025.10.2
Frontend 20251001.2
Thanks for the quick response.
Then the naming isn’t clear. I also read on Git that someone had asked this question.
Do you know if there’s an easy way to see the timer count down in the button (label)?
Without having it calculated into a value via a script and an input_text?
There’s no easy way, dashboards in general do not handle something updating frequently. There are typically dedicated workers that handle time and time updates in UI frameworks to keep the overhead low.
Yep, and now you’re adding 86400 pieces of text to your database every day instead of just using a card that properly displays the countdown through normal methods.
When I had made everything in bash, before I was persuaded to switch to Home-Assistant, I did not have to write 86400 entries per day into the database for a couter in HTML5.
How can I make a counter visible in Home-Assistant when it has started and is visibly counting down. So that I know the counter is running and can see how long it has left?
Is there a reason you can’t just put the timer entity in the ui? That behaves exactly how you’d expect. Otherwise you can take the finishes_at attribute and put it in a template sensors state and make that a timestamp entity. That will also update properly.
The issue is that you’re using a card, custom button card, that does not support the feature you’re looking for. And that’s causing your problems.
Not in label but you can have it displayed as state (timer needs to be set as button’s entity). You can set the position of various fields in the button (e.g., state/name/label) and do other things like change colors or override the state display when the timer is idle.
Nice! The latest versions of custom buttons (I think 5+) have a special action type for javascript actions, so it’s better to use that.
You can also make the timer only reset when the switching action is successful. hass.callService() is actually asynchronous and you can make use of that.
tap_action:
action: javascript
javascript: |
[[[
const e = 'switch.dummy';
const on = states[e].state === 'on';
hass.callService('switch', on ? 'turn_off' : 'turn_on', { entity_id: e })
.then(_ => {
if (on)
hass.callService('timer', 'finish', { entity_id: entity.entity_id })
}).catch(error => {
/* do something in case of an error; it will show up in logs anyway */
});
]]]