OR condition in repeat action

Hi experts. I am newbie to HA and I am having an issue setting up OR conditions in repeat action.
I am trying to setup an automation to run an action repeatedly until one of 2 conditions is met

action:
      until:
      condition:
        alias: "Brightness >= max brightness or time after 12:59 PM"
        condition: or
        conditions:
          - condition: template
            value_template: '{{ state_attr(''light.greenhouse_grow_light'', ''brightness'')
              | int(0) >= 255 | int }}'
          - condition: time
            after: '12:59:00'

Code check is good. However, there is an error in Automation UI:

Automation is unavailable
Actions: extra keys not allowed @ data[1]['repeat']['condition']

Could you help to advice on the issue? Thank you.

action:
  - repeat:
      until:
        - alias: "Brightness >= max brightness or time after 12:59 PM"
          condition: or
          conditions:
            - condition: template
              value_template: '{{ state_attr(''light.greenhouse_grow_light'', ''brightness'') | int(0) >= 255 }}'
            - condition: time
              after: '12:59:00'
      sequence:
.....
1 Like

Incidentally, errors in automations and scripts donā€™t show in the front end when you run ā€˜Check Configurationā€™ (assuming this is what you did).

Instead, you should immediately check your logs for any errors - in this case, there was likely a report of the same code error, with a warning that the automation had been disabled.

1 Like

Not sure what you want to achieve, but using repeat and that template condition (rather than a plain numeric_state) is almost certainly not the best solution.

Would that come from chatgpt, by any ā€œchanceā€? :wink:

1 Like

Thank you very much. This code resolves the issue.
It seems that the document needs to be updated:

Thank you for your advice.
Normally I just run ā€œcheck configurationā€ but next time I will check log as well.

I am trying to increase brightness of the light gradually using repeat action until one of two condition is met (brightness >= brightness value set in helper OR time reaches certain time). That is why I use template to compare brightness attribute of a light to a state of a helper (see below)

value_template: '{{ state_attr(''light.greenhouse_grow_light'', ''brightness'')
          | int(0) >= states("sensor.max_brightness") | int }}'

I am new to HA and still learning, so if you could advice how I can do to improve this code, it would be highly appreciated. Thank you in advance.

Below given code is working for me using ā€˜orā€™ condition when the index count reaches 5 or entity state changes from door open to close. This is helping me to setup required number of alerts at the same time closing it if the door is closed.

I am posting here for anyone trying to implement similar automation or suggestions for better way of achieving this.

condition:
  - condition: time
    after: "20:00:00"
    before: "23:30:00"
    weekday:
      - mon
      - tue
      - wed
      - thu
      - fri
      - sat
      - sun
action:
  - service: media_player.volume_set
    target:
      entity_id: media_player.librekodirpi3
    data:
      volume_level: 1
  - repeat:
      sequence:
        - service: tts.google_say
          data:
            cache: false
            entity_id: media_player.librekodirpi3
            message: "'Hi Folks, Your Terrace Door is Open. Please close the door.     "
            language: en-au
        - delay:
            hours: 0
            minutes: 1
            seconds: 0
            milliseconds: 0
      until:
        - condition: template
          value_template: >-
            {{ (states('binary_sensor.zb_door_contact_sensor_contact') == 'off')
            or
                repeat.index == 5 }}