How to create a stopwatch? (start/stop via wifi Button)

I want to create a stopwatch, that would help me keep track of how much time I spend working. I have a xiaomi wifi button lying around and would use it as a trigger.

So when I press it, the stopwatch starts. When I press it again, it pauses (and so on, with no reset). An automatic reset should occur by the end of each day.

The current/accumulated time for the day will be displayed on a wall mounted laptop (using Tasker/Autoremote).

My question is: How do I create this stopwatch function? Is there a template somewhere I missed? I could only find something for static timers.

1 Like

The history statistics sensor will count how long something has been on in a day:

Set up your button to toggle a template sensor (work time sensor) and apply the history statistics sensor to that.

Bes to apply different button press types (single, double, or long) for template sensor on and off to prevent start / stop confusion.

3 Likes

I suppose you have solved or forgotten this, but just in case:

https://community.home-assistant.io/t/stopwatch-with-start-stop-resume-lap-and-reset/443994