I am having some issues trying to determine how to build out an automation to accomplish this task.
I have sensors in homeassistant that log power usage of certain circuits that I would like to alert on, specifically my well pump. When the Well pump has been going on and off (not a constant on, but fluctuating frequently between a on and off state) for a prolonged period of time. This could potentially indicate a leak. What would be the proper method to alert on this?
You could write one automation that increments a counter.
Another automation resets the counter periodically (e.g. every day, every 6 hours, or every hour).
A third automation triggers an alert notification if the counter reaches a value you consider would indicate a leak.