Is this too easy so I dont see it?

Background: I have a waterwell and it has a binary_sensor.waterwell with state “off” and “on”. Yesterday someonbe left the water running and the waterwell was running over 3 hours before I noticed it. Normally it does not run over 5 minutes to catch up and shut off.

I believe the ‘Helper’ is the right way to go but I cant set up the binary sensor in there, it requires a ‘sensor’ and not a ‘binary sensor’.

I thought about creating an automation that starts a timer when the water well comes on and then sends a notification when the timer gets over 5 minutes. But this gets cumbersome in a hurry.

The waterwell sensor already shows duration in the history. How can I use this value without going through major programming steps? Do I not see the forrest because of all the trees?

I would do like this:

description: ""
mode: single
trigger:
  - platform: state
    entity_id:
      - binary_sensor.waterwell
    to: "on"
    for:
      hours: 0
      minutes: 5
      seconds: 0
condition: []
action:
  - service: notify.mobile_app_andreas
    data:
      message: Water has been running for 5 minutes

Automations have a way of running after a certain amount of time. When you use a state trigger you can specify in the “For” to trigger after your specified time.

You can also use an alert to get repeated messages to your HA app while this is running. It automatically resets after the metric is no longer in an alarm state

Show us the state from the developer tools. You may be able to use a state attribute.

Hellis81 suggestion worked, it was actually that simple. Thanks Andreas!
I could kick myself.

Can I bother you on something else regarding the waterwell?

The pump feeds a pressure tank. And sometimes it gets ‘airlocked’ so that that pump comes on more frequently. Normally I have under normal use the pump come on for three minutes every 4 to 5 hours. When its airlocked it can go as bad as one minute on, one minute off, one minute on,…off, on, on.

In the past I had a counter that counted the minutes ‘on per hour’ and I plotted this out. Or I just monitored a history bar on the main page.
Screenshot from 2024-05-24 10-04-02
Would be good to identify this automatically - any thoughts?

Did you have a look @ this

think you be able to count the number of time waterwell went off in a hour