Please check my work. (Turning off a pump and filling a birdbath, then turning back on)

I have a birdbath that evaporates pretty quickly. I have a water sensor that can tell me whether it is full or not and a sprinkler valve that can fill it back up. There is an automation that does a pretty good job keeping it full but occasionally something messes up and it dries up.

When that happens I want to turn off the pump and turn on the water supply. The sprinkler routine runs for two minutes which should be enough to top if off unless it’s really dry. So if it doesn’t show wet run it again.

Once it’s senses wet I want to turn back on the fountain.

the following is the YAML

alias: Bird Bath Protect the pump from running dry
description: ""
triggers:
  - type: not_moist
    device_id: a5b86b0ac67fda7a3fa4b8eb57aa6a54
    entity_id: 7972bda06692b86630acf94c7fd7264c
    domain: binary_sensor
    trigger: device
    for:
      hours: 0
      minutes: 10
      seconds: 0
conditions: []
actions:
  - repeat:
      sequence:
        - type: turn_off
          device_id: 63b94a8d2f2112b120c9797099717b29
          entity_id: f4048310f1a82ea59908659e56323938
          domain: light
        - type: turn_on
          device_id: 0b67b9fe077cf5d4c0b963519ad27072
          entity_id: a6acff894b785e697d467a0c8b151708
          domain: switch
        - delay:
            hours: 0
            minutes: 2
            seconds: 15
            milliseconds: 0
      until:
        - condition: state
          entity_id: binary_sensor.bird_bath_water_sensor
          state: "on"
  - if:
      - condition: state
        entity_id: binary_sensor.bird_bath_water_sensor
        state: "on"
    then:
      - type: turn_on
        device_id: 63b94a8d2f2112b120c9797099717b29
        entity_id: f4048310f1a82ea59908659e56323938
        domain: light
mode: single

Thank you

what device are you using to detect the water level?
don’t use a moist sensor those dont really work well for your application , try using float sensor like this one

i dont really like doing an automation for something really that simple, i doit with esp home all the logic is inside the device

there is not a wrong way to do it, you can make the same device doing the same thing in so many ways

for me, making smart device is exactly that something that is automatic and do all the stuff by itself

i do something similar for my house water tank , but all the logic is inside the esphome , turning on/off the pump update a text sensor if something goes wrong ,

I am using a Tuya Water Leak Detector Zigbee device from Amazon. It has worked perfectly so far. Unfortunately the Bird bath is pretty small, 24" in diameter and only 3" deep so a float sensor wouldn’t easily fit.

I have never tried the ESP at home devices, I’ll have to take a look at them. It may open up a whole new world for me.

Thank you for your response.

theres is a really small float sensors

like this one

is actually a push button so you automation is really simple if is open turn on else turn off and thats it

you can do it with a magnetic switch a piece of foam and a magnet,
theres is so many ways to make it work.

That is so tiny. Thank you very much for the link.

This seems like it will be a fun project.

Thanks again.