How to record total run time of a script

I have a script that runs my lawn irrigation. I received my water bill that shows my gallons used over a 30 day period. Is there a way that I can find out how many minutes my irrigation script ran during that same time? I’d like to calculate my average gallons per minute then use that to create an entity that estimates my total monthly usage and cost as I’m using my irrigation in the future.

You could use the history stats sensor to record the time your water valve was on… if you keep a months worth of data in your recorder database (the default is 10 days).

I have a similar application (recording daily/weekly/monthly/yearly heating hours).

I’m using a History Stats sensor, just like tom_l suggested, but it’s configured to compute just the daily heating hours (i.e. it resets at midnight so that’s well within the recorder’s default retention period).

This value is used by the Utility Meter integration to compute daily/weekly/monthly/yearly statistics (i.e. separate sensors record each period). The Utility Meter’s values are held in the database’s long-term storage and aren’t purged at the end of the retention period.

1 Like

Thanks for the replies. I think I have enough info now to get this figured out. I suppose I can’t go back to the last month of watering so I’ll have to start with the next month, or maybe next year now that the season is almost over.