Would this sprinkler automation work?

Hi all,

would this automation work as intended? Plan is to have water my lawn three times a day for 90 minutes each.

  alias: Rasen Nachsaat
  description: ''
  trigger:
  - platform: time
    at: 07:00:00
  - platform: time
    at: '13:00:00'
  - platform: time
    at: '19:00:00'
  condition: []
  action:
  - service: switch.turn_on
    data: {}
    target:
      entity_id: switch.bewasserung_rasen
  - delay:
      hours: 1
      minutes: 30
      seconds: 0
      milliseconds: 0
  - service: switch.turn_off
    data: {}
    target:
      entity_id: switch.bewasserung_rasen
  mode: single

Thanks a lot for your help!

I’d probably use two automations because of the long delay and the possibility of a HA restart that wouldn’t live through that or maybe just try Simple Scheduler Addon

The automation itself looks fine I think.

1 Like

OMG… sprinklers running for an hour an a half… I only DREAM of being able to do that here in California.

Just sayin’
Jim

1 Like

This is just one of Germanys super powers :wink:

But it might be to much. Just playing around at this stage.

This looks dope. Will install it and see if this works.

This version survives restarts (and Reload Automation) provided they don’t occur precisely at any of the six scheduled times.

  alias: Rasen Nachsaat
  description: ''
  trigger:
  - id: 'on'
    platform: time
    at:
    - '07:00:00'
    - '13:00:00'
    - '19:00:00'
  - id: 'off'
    platform: time
    at:
    - '08:30:00'
    - '14:30:00'
    - '20:30:00'
  condition: []
  action:
  - service: "switch.turn_{{ trigger.id }}"
    target:
      entity_id: switch.bewasserung_rasen
  mode: single
2 Likes

Thanks a lot Tarras! Hopefully if there is a restart for some reason its not during the designated time slots :smiley:

The automation I posted is unaffected by restarts during the time slot. It’s only affected by restarts that occur precisely at any of the six scheduled times.

For example, if Home Assistant is restarted at 06:59:45 and takes 30 seconds to startup, it will fail to trigger the 7:00:00 Time Trigger.

If instead it were to restart at 07:01:00, it will have already turned on the switch at 07:00:00 and the restart will have no affect on the next scheduled Time Trigger (to turn off the switch) at 08:30:00. It’s the use of Time Triggers (for turning the switch on and off), instead of a delay, which makes the automation more robust.

There are other techniques (that I use in my automations) to make it even more failure-resistant; it turns the switch on or off even if Home Assistant was restarted precisely at the scheduled Time Trigger. The technique adds a bit more complexity to the automation but it’s worthwhile if some device must be absolutely, positively turned on/off otherwise it will consume excessive resources (for example, electricity for a pool pump or water for sprinklers).

Yeah, and with a name like “Flo,” now you’re just rubbing it in.

Jim

This sounds interesting. Would you mind to share an example?

1 Like

I modified the timings and was entering the automation in yaml. This is how it looks like:

alias: Rasen Nachsaat
  description: ''
  trigger:
  - id: 'on'
    platform: time
    at:
    - '07:00:00'
    - '11:00:00'
    - '14:00:00'
    - '17:00:00'
    - '20:00:00'
  - id: 'off'
    platform: time
    at:
    - '07:30:00'
    - '11:15:00'
    - '14:15:00'
    - '17:15:00'
    - '20:15:00'
  condition: []
  action:
  - service: "switch.turn_{{ trigger.id }}"
    target:
      entity_id: switch.bewasserung_rasen
  mode: single

When I want to save i get this error

grafik

Any idea what i missed?

Try removing the double quotes on the following line:

I assume you are using the Automation Editor in YAML mode so ensure all lines are indented like this:

alias: Rasen Nachsaat
description: ''
trigger:
  - id: 'on'
    platform: time
    at:
      - '07:00:00'
      - '11:00:00'
      - '14:00:00'
      - '17:00:00'
      - '20:00:00'
  - id: 'off'
    platform: time
    at:
      - '07:30:00'
      - '11:15:00'
      - '14:15:00'
      - '17:15:00'
      - '20:15:00'
condition: []
action:
  - service: "switch.turn_{{ trigger.id }}"
    target:
      entity_id: switch.bewasserung_rasen
1 Like

That worked. Thanks a lot. Some day i´ll find out all the differences between several editors :slight_smile:

1 Like