ESPHome Over Run Failsafe?

I’ve just started really playing with ESPHome (and love it so far), but what I’m wondering is if there is the capability to “failsafe” something?

For instance, I’m incorporating an automatic watering system. When it was pure Arduino I was able to send a trigger to turn on a water pump through the network but the Arduino code would only ever let that pump run 15 seconds.

In ESPHome if I turn on the pump, is there any way the device itself can be configured to not let the pump run more than 15 seconds? My concern is that I start the pump and it doesn’t get (for whatever reason) the command to turn it off and before I know it I have a couple gallons of water overflowing onto my floor.

Yes, you can run automations onboard the micro with esphome.

However, if a runaway pump would actually cause damage to your house, I encourage you to use several safeguards. I assume that your valve is fail-safe? (That is, powered open, spring closed). You could also add a second esphome (or arduino) that cuts power to the pump based on a water sensor detecting a spill, or use many other safeguards.

Edit: this example may be of interest as well, if you want to put the irrigation schedule onboard. Sonoff Fish Pond Pump — ESPHome