#Single white channel vs color temp bulbs

1 messages · Page 1 of 1 (latest)

chrome briar
#

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.

void stirrup
#

You cannot template keys like that

#

And service_template was deprecated for just service: (and now action:) many years ago

#

Use additional conditions in your choose: to make separate service calls with the the fields you want

chrome briar
#

roger, let me give that a go

chrome briar