Set Light to a Random Colour
Home Assistant Template
service: light.turn_on entity_id: light.office_desk data_template: rgb_color: >- {% set current = state_attr('light.office_desk', 'rgb_color') %} {% set colour_list = [ "255,255,255", "253,45,65", "25,98,67" ] %} {% set colour_list = colour_list | reject('eq', current) | list %} {{ colour_list | random }}
Quick example to set a light to a randomly selected colour from a list
Source: EveryThingSmartHome Discord Post