Log duration of a signal

Hi,
I have a signal for my water heater that tells me when it is running. It goes on and off several times a day. I would like to count the total minutes it runs a day and then reset this value at midnight. The goal is to show a graph that shows me how long the heater runs each day. I played around with automations but could not find a good solution that works. Has anybody done this before and can share some code snippets?

Thx

Stephan

Once created, you can monitor the History stats sensor with a Utility Meter Helper if you want create daily, weekly, etc counts and log the values into the long term statistics data.

1 Like