I had setup an automation which runs every few seconds and calls this:
service: light.turn_on
data_template:
entity_id:
- light.hue_color_spot_1_2
effect: random
and this would turn this hue color spot light to a random color each time. I just updated Home assistant this morning to core-2021.12.1 and now this does not seem to work at all anymore.
This code does not work either if I manually run it using the development tools, so it’s not the automation per se which is the problem.
I saw some hue related changes in the change log and under breaking changes but it was not obviously related to this as far I can tell. Am I missing something?
Thanks. I actually did not realize that the random effect was a functionality in the Hue bridge. I thought it was something implemented by Home Assistant
Please consider marking my post above with the Solution tag. It will automatically place a check-mark next to the topic’s title which signals to other users that this topic has been resolved. This helps users find answers to similar questions. For more information refer to guideline 21 in the FAQ.
Sure, your solution is actually brilliant, that way I can control which colors are used. So in that sense it’s even better than using the colorloop effect provided by the Hue bridge!
Please elaborate … it does not have to be “properly” random in my case, I just need rotating/alternating colors. It’s a christmas light automation where I have three Hue color G10 bulbs displaying alternating colors. For that, this works fine
I very much enjoy the option to make all my lights in a room go to a completely random color. But you are correct, that might not be the case for you.
I use the random effect on a light group it would make all the lights individually a random color. The suggestion solution would make all the lights the same random color.
And then again, a complete random between all the colors the bulb can make or a random between the colors described is different too.
I’m not sure why HUE took out the option to use it…
Probably because they thought few people needed a roomful of randomly colored lights, so they eliminated it (and colorloop). However, they added dynamic scenes whose functionality they continue to improve (since first released earlier this year).
Similar to the random approach above, I replaced the random color effect with a yaml that uses hs_color and two random values. 0-360, and 0,100 though I’m using 50-100 for the saturation value and may just change it to 100.
Still looking into a solution for colorloop though.
They are all the same. Just different ways to call it. Each variation has been added over time to solve a problem. The “old ways” have never been removed to maintain backward compatibility.
It could be a script or a scene, it’s just up to you. In my case, I created it as a script. Then I have an automation with a time-based trigger (triggers every 5 seconds) and the specified action in the automation is to run this script. I could just as well have created this as a scene, and then had the automation activate that scene.
If you want random colors upon pressing a button, that should also work regardless of it being a scene or a script. A button can be set to activate a scene or run a script