Is it possible to use a dynamic attribute name? I want to parse something e.g. ‘color_name’ | red or ‘effect’ | colorloop and then apply it to lights - I don’t want to write a separate automation with conditions to work out exactly which attribute it is pulling. i tried making a data template with the e.g. data_template: # next line >> “{{ trigger.event.data.card_uri.split(’|’)[0]}}”: “{{ trigger.event.data.card_uri.split(’|’)[1] }}” ie… “color_name”: “red” but it doesn’t work
action:
- service: light.turn_on
data_template:
entity_id: light.color_light_1
brightness_pct: 100
"{{ trigger.event.data.card_uri.split('|')[0]}}": "{{ trigger.event.data.card_uri.split('|')[1] }}"
# e.g. color_name: "{{ trigger.event.data.card_uri }}"