Sometimes we want timers in reverse! WTH?
Until this gets implemented, the workaround is to store now() as a timestamp in a date/time helper, and then do elapsed time with math in a jinja template.
I use this to “start a timer” in an automation to log commute time:
action:
- service: input_datetime.set_datetime
target:
entity_id: input_datetime.countup_timer_start
data_template:
datetime: "{{ now() }}"
And this is when I “stop” the timer to get elapsed time (in this case it’s in minutes with one decimal point)
{{((as_timestamp(now())-as_timestamp(states('input_datetime.countup_timer_start')))/60) | round(1)}}
Another suggested option is to use an automation to increment a helper every minute. Your option sounds better.
I am trying to move some automations from Homeseer to Home Assistant and was very surprised that upward counting timers do not exist here. The suggestions above are going to be a non-starter for folks who just want to buy a home Assistant Green or Yellow box and work within the visual editor to quickly set up some basic duration timer automations.
These timers are usually used to track the run time of a specific device and speak it as part of a TTS status report. For example: I have a timer that tracks the total run time of my well pump each day. When I hear the verbal report I can judge if that sounds normal or if it is high and warrants some investigation. A simple threashold alarm is useless because differing activities such as running laundry or having guests taking showers needs to be factored into whether the total is reasonable or a cause for concern.
In Homeseer it takes 30 seconds to define a timer and maybe two minutes to write an event (automation) that starts the timer when the device (or entity) starts and pause it when the device goes idle. All of these are done using drop-downs in the Homeseer visual editor. I could probably study up on helpers and templates and then try to modify the YAML example syntax to replicate the Homeseer event but it seems way to complex a way to achieve such a simple thing.
In the end I simply kept all of my timers on Homeseer and use an integration between the two platforms to pass the current timer values to Home Assistant so they are available if I want to use them there. I truly think that an easier way to create and use duration timers that count up from zero and are managed entirely from within the visual editor would be widely used if they were available.