#how do i make a timer slider that moves down as the time ticks down?

1 messages · Page 1 of 1 (latest)

uncut igloo
#

I want a component in the ui, that will be a slider or knob to dial up a countdown timer. say for 2 hours. it will start a fan, countdown and then turn the fan off.

ideally the ui slider will dynamically update time remaining and allow the user to slide to adjust time up or down. any pointers on how to do this? I have made number slider and timer but i don't see how to link it back to dynamically update

pallid trench
#

Generally things like this are not updated dynamically as it really thrashes the state machine.

#

If you really must do it, make an automation that triggers every 1s, 5s, 30s, computes the number of seconds left in the timer, and call number.set_value with that value.

#

But it will be more friendly on your system if you don't have the slider countdown, but just display the timer entity right next to it.

bitter brook
#

I saw your question in Automations last night and meant to comment but forgot. You might be able to get something to work but may not work as well as you hope.
Personally, I would not try to make the timer or an automation adjust the slider entity. Instead, I would incorporate the automation to watch for the slider to change and then restart the timer to that value. (It will require a template which I already have written and use something similar myself.) Maybe it could still be set via the automation without updating the timer and restrict the update when changed by a specific user. In the end, counting down the slider may not be optimal.
For the graphical representation of the timer, I recommend the timer-bar-card. It is very customizable and useful. I, personally, would use it along with a browser_mod pop-up that could contain some buttons for options: restart, cancel, add x minutes, etc.

uncut igloo
#

thanks for the pointers guys

#

i didn't realise i could just put the timer entity on the dashboard! this is great

#

i mean, not my perfect solution but pretty close!

#

it does seem like a glaring omission not to have a "dynamic" countdown timer user interface imho

bitter brook
# uncut igloo it does seem like a glaring omission not to have a "dynamic" countdown timer use...

Everything is subjective when it comes to dashboard design and use. For me, the timer-bar-card works. To make adjustments to the timers, I have two options. These are custom:button-cards that I made. Tapping the card toggles the input_boolean entity that I use to "enable/disable" to automatic timer in the automations. The automation can cancel an active timer if I toggle the input_boolean. The automation also references the value of the input_number to set the duration.

#

Here, an auto entities card "finds" all of the input_number entities for my automations. This only works for adjusting the times though.