I have this automation which I manually run for testing by clicking on Run actions button.
service: light.turn_on
target:
entity_id: light.office_backlight
data:
color_name: '{{ ('red','green','blue')|random }}'
brightness_pct: 40
Either I get an error while saving it (something like malformed service name or something) but sometimes I can save it and HA removes the template and color_name becomes null. If I change the color_name to say ‘red’ or ‘green’ or ‘blue’, the action works and light changes color.
I am not sure why HA doesn’t like the random filter template in color_name. I have tested the template in developer tools and it returns either red or green or blue randomly. How do I make it work?
Thanks