Thanks very much for this. I’ve been looking for a way to create a job-timer thing with a physical button and whilst I can sort the electronic and Tasmota side out, I was struggling with how to do it in HA. This does the trick and I shall have fun integrating it. - All the best!
hello, and thank you for this work. I was looking for a timer to start work, be able to take breaks and finally stop. the goal was to count the working time over the day…
I’m a little new to HA and I would like to be able to switch the daily data into influxdb (I already have an HA database in there with consumption reports for example). And also know if once transferred to influx the HA database can be cleaned? in any case, the timer and what I was looking for!
I cannot help you here. I’m not expert in dababase and I don’t know anything about influxdb. I don’t know if anybody else can help you, or you can try creating a new topic about your question in configuration thread, as this is not directly related with the stopwatch, but with database management.
Hi, first of all - Thank you very much for your great work! I’ve got everything working flawlessly for my usecase
I’m using the timer as an Espresso-Shot-Counter, and therefore only the elapsed time in seconds is relevant for me. Unfortunately, if I change the attribute in lovelace to “elapsed time”, there is only a value when the timer stopps. Is there a possibility to get the “elapsed time” view with a running counter?
Here are two screenshots to hopefully show more clearly what I mean.
Timer is running but “elapsed time view” is stuck at zero
The elapsed time is an attribute needed to take into account the time the stopwatch is not running to calculate the sate of the sensor, so it is not intended to use as a running counter.
What you need is to change the format presentation of the sensor state. To do it, simply change the state lines of the sensor with this ones:
state: >-
{% if is_state('input_boolean.reset_stopwatch','on') %}
{{ 0 }}
{% elif is_state('input_boolean.start_stopwatch','off') and is_state('input_boolean.lap_stopwatch','off') %}
{% set value = as_timestamp(now()) - state_attr('sensor.stopwatch','initial_time') + state_attr('sensor.stopwatch','elapsed_time') %}
{{ value|float|round(2) }}
{% elif is_state_attr('sensor.stopwatch','running','on') %}
{% set value = as_timestamp(now()) - state_attr('sensor.stopwatch','initial_time') + state_attr('sensor.stopwatch','elapsed_time') %}
{{ value|float|round(2) }}
{% else %}
{{ states('sensor.stopwatch') }}
{% endif %}