Just a bit stuck here.
sequence:
- repeat:
for_each: >-
{{ expand('light.group_livingroom') | map(attribute='entity_id') | list }}
sequence:
- choose:
- conditions:
- condition: template
value_template: "{{ brightness == 'bright' }}"
sequence:
- service: light.turn_on
target:
entity_id: "{{ repeat.item }}"
data_template:
brightness_pct: 100
{% if 'color_temp' in state_attr(repeat.item, 'supported_color_modes') %}
color_temp: 300 # Adjust to desired color temperature
{% elif 'white' in state_attr(repeat.item, 'supported_color_modes') %}
white_value: 255 # Max brightness for white-only mode
{% endif %}
... etc
If I remove the set of conditionals at the bottom, below brightness_pct, the yaml is validated and saved.
However with these conditionals, the editor still shows red and will not save changes.
I've found in the guides were service_template: is used to set a dynamic value for a static attribute, but I can't find anything on setting dynamic attributes.