Native Countdown Component

TLDR: It would be nice to have a custom component that can show a visual countdown time in the WebUI.

Afternoon All,

It would be nice if we could have a native countdown timer that can be used to show in the Web UI. One that could cover all bases (Days, Hours, Minutes & Seconds). Also would be nice to chose what to show (ie 1 Hour 30 Minutes or instead 90minutes).

I appreciate there are some custom components that tackles part of the above, such as:

Custom Countdown Component by @speakquietly

Something like this only tackles days though (can be tweaked) and can not be used ‘on the fly’. By ‘on the fly’ I mean I can’t have a generic automation call a 10 minute countdown it has to be predefined.

There is also this adaptation the command_line.py:

An example of a countdown timer, and some related questions by @forbin

However it is not a simple process to edit command_line.py in Hass.io. I appreciate you could probably SSH in and edit it or even add command_line.py as a custom component, however I’ve had no joy (command_line.py doesn’t seem to have the referenced line any more ‘MIN_TIME_BETWEEN_UPDATES = timedelta(seconds=60)’ it seems to have ‘SCAN_INTERVAL = timedelta(seconds=60)’ now instead)

Regardless it still doesn’t encompass an all in one solution.

Why would you need / want a component like this?

Personally I use the custom component mentioned above in my ‘Car’ section of my HA. It shows me days until my MOT and days until my service is due.

I am also trying to get a countdown timer going for my ‘Kitchen’ tab in home assistant for my laundry. I have a timer set up witch sends a push bullet but it would be nice to just have a look at HA and see how much time is left.

Other than the above I think it would be useful for loads of reasons. You could have recipe countdowns (doing roast, when to put potatoes on, other vegs.), you could use it to help test automations (
stick a countdown timer in there and check if things are going off at the right time). I’m sure there are plenty of other reasons a visual count down timer would be useful. If you can through the forum a fair few people have tackled this in different ways, it would just be nice to have a simple straightforward native component that idiots like me could use.

While I can’t address all of your concerns, which I can totally see a use case for, you might find another component I wrote useful. I think this would at least address your MOT reminder.

1 Like

Thanks for that (also thanks for making it and the other one). I do use your coutdown for MOT already and plan to use a calender trigger to push a push bullet 7 days before.

The real thing I’m trying to figure out is a visual minute countdown for the laundry. However I do think it would be a useful component in gerneral for Home Assistant.

I totally agree. Something quick and ad-hoc with GUI edit/visibility. “Flash my kitchen light in 23 minutes.”

1 Like

There is the timer component, which can be used to mimic what you want when using it together with a counter or input_number.

Have a look at this topic for more details.

Originially the timer-component did update its state to show the remaining time. That however had to be removed because the core-devs disagreed to have an entity that updates its state every seconds. That would bloat the states database, and in most cases is not needed anyways, since automations mostly happen in the background without someone looking at the remaining time. However, the set of automations in the mentioned thread describe how to get a visual representation of the remaining time, which I believe would fit your needs. :slight_smile:

Edit: The input_number is more flexible. You can reset it to any value and also increment and decrement it. So if you have variable durations I would chose that instead of the counter component.

@danielperna84, thank you for the input. I can appreciate why not to have this feature, if, as you say, it would be a resource strain (which makes sense).

Also thank you for the links managed to fasion a visable timer on the Web UI, can you point me in the direction for two things?

  1. How to convert this to time left, is it as simple as if I have 10 minutes calculating 600 - counter.elapsed?

  2. Anyway to convert this to minutes? Would I devide counter.elapsed by 60 or would I change the automation from /1 to /60 (I appreciate I could be missing the point completely here).

  1. For that I would use the input_number. Lets say you want a 5 minute timer. The automation that starts this timer would use the input_number.set_value service to set the entity to 5, and then use the input_number.decrement service to lower the value with each interval.
  2. To use minutes I would, as you already say, go with /60. By modifying the automation-interval you can use pretty much any scale you like that are supported. Even odd intervals. So you could have the theoretical time an american football game has by doing: start a 48 minute timer, set the input_number to 4, and decrement every 12 minutes. You would then see which is the current quater of the game. You could even pause and continue the timer somehow to keep it in sync with the actual game.
1 Like

Countdown of timer should happen purely in the UI. No need to spam the database.

If for automation, consider adding an automation trigger for timer. Can trigger when timer is expiring or Y time before timer expires.

Yes. I just wanted to provide a working workaround while I keep dodging making the UI. Back then when I created the timer there was the transition of separating the UI from the core, and I couldn’t figure out how to setup the dev-environment. :frowning_face:

Perfect thank you. One last question (sorry) any way to make it show the word minutes after the time?