How to turn on each irrigation zone at a time?

Hello,
I have 4 switches controlling 4 irrigation zones (switch.zone_1, switch.zone_2, etc.).
I would like to create an automation which start irrigation one zone at a time only when previous is finished.
I created a group helper in which I put all 4 switches, named “Garden Zones”.
This is my pseudo-code for a complete irrigation cycle I wish to translate in HA automation:

if switch.garden_zones is off
   turn_on switch_zone_1
   delay 10 minutes
   if switch.garden_zones is off
       turn_on switch_zone_2
       delay 10 minutes
   if switch.garden_zones is off
       turn_on switch_zone_3
       delay 10 minutes
   if switch.garden_zones is off
       turn_on switch_zone_4
       delay 10 minutes

How can I translate it in HA automation considering each anomaly scenario?

Why not just build it in the HA automatons UI?

description: "Turning things on and off after set time period"
mode: single
trigger:
  - platform: numeric_state
    entity_id: sensor.openweathermap_temperature
    above: 28
condition: []
action:
  - type: turn_on
    device_id: 0f87ca318545f7264b57b9a63969b551
    entity_id: switch.sonoff_10010a6717_1
    domain: switch
  - delay:
      hours: 0
      minutes: 10
      seconds: 0
      milliseconds: 0
  - type: turn_off
    device_id: 0f87ca318545f7264b57b9a63969b551
    entity_id: switch.sonoff_10010a6717_1
    domain: switch
  - type: turn_on
    device_id: 02c219e8288887f446796d0c0f23277b
    entity_id: switch.sonoff_1001505a08_1
    domain: switch
  - delay:
      hours: 0
      minutes: 10
      seconds: 0
      milliseconds: 0
  - type: turn_off
    device_id: 02c219e8288887f446796d0c0f23277b
    entity_id: switch.sonoff_1001505a08_1
    domain: switch
  - type: turn_on
    device_id: 0f87ca318545f7264b57b9a63969b551
    entity_id: switch.sonoff_10010a6717_1
    domain: switch
  - delay:
      hours: 0
      minutes: 10
      seconds: 0
      milliseconds: 0
  - type: turn_off
    device_id: 0f87ca318545f7264b57b9a63969b551
    entity_id: switch.sonoff_10010a6717_1
    domain: switch
  - type: turn_on
    device_id: 02c219e8288887f446796d0c0f23277b
    entity_id: switch.sonoff_1001505a08_1
    domain: switch
  - delay:
      hours: 0
      minutes: 10
      seconds: 0
      milliseconds: 0
  - type: turn_off
    device_id: 02c219e8288887f446796d0c0f23277b
    entity_id: switch.sonoff_1001505a08_1
    domain: switch

2 Likes