Watchdog possible?

Yesterday I experienced an open irrigation valve that with no obvious reason was turned on for 13(!!) hours. 11.000l+ of water were wasted. And it was RAINING :slight_smile:
Is there a way (automation maybe?) that checks for a state of a switch and after a given time automatically turns it off, no matter why and how it was turned on?
Or maybe I think too complicated and it is super easy to make already … ?!?

automation:
  alias: Irrigation Watchdog
  trigger:
    platform: state
    entity_id: switch.irrigation
    to: 'on' 
    for:
      hours: 1
  action:
    service: switch.turn_off
    entity_id: switch.irrigation
1 Like

That looks easy and simple. Thanks!

1 Like