{"id":13314,"date":"2021-04-16T17:19:32","date_gmt":"2021-04-16T17:19:32","guid":{"rendered":"https:\/\/www.rjt.org.uk\/home\/?post_type=home_assistant_tip&#038;p=13314"},"modified":"2021-04-16T17:20:54","modified_gmt":"2021-04-16T17:20:54","slug":"set-light-to-a-random-colour","status":"publish","type":"home_assistant_tip","link":"https:\/\/www.rjt.org.uk\/home\/archives\/home-assistant-tip\/set-light-to-a-random-colour\/","title":{"rendered":"Set Light to a Random Colour"},"content":{"rendered":"\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"yaml\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">service: light.turn_on\nentity_id: light.office_desk\ndata_template:\n  rgb_color: >-\n    {% set current = state_attr('light.office_desk', 'rgb_color') %}\n    {% set colour_list = [ \"255,255,255\", \"253,45,65\", \"25,98,67\" ] %}\n    {% set colour_list = colour_list | reject('eq', current) | list %} {{ colour_list | random }}<\/pre>\n\n\n\n<p>Quick example to set a light to a randomly selected colour from a list<\/p>\n\n\n\n<p>Source: EveryThingSmartHome Discord Post<\/p>\n","protected":false},"template":"","class_list":["post-13314","home_assistant_tip","type-home_assistant_tip","status-publish","hentry","comments-off"],"_links":{"self":[{"href":"https:\/\/www.rjt.org.uk\/home\/wp-json\/wp\/v2\/home_assistant_tip\/13314","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.rjt.org.uk\/home\/wp-json\/wp\/v2\/home_assistant_tip"}],"about":[{"href":"https:\/\/www.rjt.org.uk\/home\/wp-json\/wp\/v2\/types\/home_assistant_tip"}],"wp:attachment":[{"href":"https:\/\/www.rjt.org.uk\/home\/wp-json\/wp\/v2\/media?parent=13314"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}