I am trying to set a light to a random list of colors using the color_name attribute in a script. I have tried a few different ways but I can’t seem to get it to work. Using the following works fine:
- service: light.turn_on
data:
color_name: red
target:
entity_id: light.color_office
but when I try to use a list, it always reverts back to null when I save the script. Here is what I am trying:
- service: light.turn_on
data:
color_name: {{ ["red","blue","green"] | random }}
target:
entity_id: light.color_office
I have also tried pulling from an input select:
- service: light.turn_on
data:
color_name: {{ state_attr('input_select.color_theme', 'options')|random }}
target:
entity_id: light.color_office
I’m fairly new to YAML so I am sure I am missing something silly, but I can’t figure out what it is. Any help would be appreciated.