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']
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.
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ā?
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)
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 }}