Looping within Automation

I have a zigbee water valve connected to a Gardena water distributor. It’s essentially a 6 way mechanical switch and works by shifting the output to the next zone once the current zone has been turned off.

I am trying to write an automation which will water a single zone. The automation will have to loop through a counter, turning the 6 way switch on and off until it reaches the desired number.

I have my coldframe on output 1 (written as a number input value). I would like to loop my automation until I get to that number.

This is what I currently have; however, it never reaches number 1.

alias: Cold frame
description: ""
trigger:
  - platform: time
    at: "08:00:00"
condition: []
action:
  - type: turn_off
    device_id: 8c33a7f815fe3622d757f70781268d48
    entity_id: a6b92fe329d9ddd3c259f1c18cc7e2de
    domain: switch
  - delay:
      hours: 0
      minutes: 0
      seconds: 15
      milliseconds: 0
  - repeat:
      sequence:
        - type: turn_on
          device_id: 8c33a7f815fe3622d757f70781268d48
          entity_id: a6b92fe329d9ddd3c259f1c18cc7e2de
          domain: switch
        - service: counter.increment
          metadata: {}
          data: {}
          target:
            entity_id: counter.irrigation_counter
        - delay:
            hours: 0
            minutes: 0
            seconds: 15
            milliseconds: 0
        - type: turn_off
          device_id: 8c33a7f815fe3622d757f70781268d48
          entity_id: a6b92fe329d9ddd3c259f1c18cc7e2de
          domain: switch
        - delay:
            hours: 0
            minutes: 0
            seconds: 15
            milliseconds: 0
      until:
        - condition: numeric_state
          entity_id: counter.irrigation_counter
          below: input_number.irrigation_coldframe
          above: input_number.irrigation_coldframe
    enabled: true
  - delay:
      hours: 0
      minutes: 20
      seconds: 0
      milliseconds: 0
    enabled: false
  - type: turn_off
    device_id: 8c33a7f815fe3622d757f70781268d48
    entity_id: a6b92fe329d9ddd3c259f1c18cc7e2de
    domain: switch
    enabled: false
mode: single

irrigation_counter is a counter with a min value of 1 and a max value of 6 and step size of 1 - i’m assuming that this will loop back to one if you keep incrementing it?

I don’t think this is the case - it will just stop. To go back to 1 you would have to have to use counter.reset or counter.set_value.