Color Loop effect for any light with color wheel selector

You can ofc experiment and if you succeed, do share. But I do really think it comes to the limitation of the lights, regardless of how fast you’re triggering it, if you want the transition smooth, it’ll always take 1 seconds between 2 color changes as that’s as fast as the light can transition (at least I couldn’t get my hue lightstrip any faster).

My LIFX lights are capable of changing colors pretty quickly, but I’m not sure if there’s a limitation of Home Assistant. I don’t see why that would be. The reason I know that the lights are capable is because I have an app on my Android phone called “Chromania” that strobes my lights to music with different colors based on beat and frequency.
I’ll try to figure out the script, but I’m not sure where to even start in order to have it change one step every time its executed rather than flowing through the colors every few seconds. The theory I have is that the remote will fire off enough events that the changes would look smooth anyway to the human eye. I just need to change the colors based on math equations.

Mazing!

Well done.

Using Sylvania zigbee bulbs. Transitions are smooth.

1 Like

@C.G.B.Spender Thank you so much for sharing!

What would be the best way to make the transition ultra slow. Let’s say I want the transition to be switched from one “full” color to the next in 15 minutes or so?

I’m already playing around with your yaml but haven’t nailed it yet.

I haven’t really found a way to alter the speeds, whenever I mess with them it’s not smooth. I just copied the script from the gist linked in 1st post, so maybe worth asking there too.

As I understand the script is made for the 1sec delay, to alter the speed you’d have to alter the number of colors too I think, but I don’t really get it.

I think I got the issue now:

since the color is chosen based on the times current seconds, this might not work

xy_color: '{{ colors[(now().second/2.5)|round(0)] }}'

I stumbled across this service call: Set a random color on a light
This does not use the current time to choose the color. I think this will work better for my desired outcome.

Thank you so much for getting me started on this. I finally see my Lounge Lighting about to happen :slight_smile:

Is there a way to control the brightness? Tried adding a brightness: 50 entry but the leds flash bright then quickly change to 50 brightness.

I’m not sure honestly.

I thought creating a default value for the light as described @ Light - Home Assistant would do it

I modified blueprint like so:

- service: light.turn_on
  data_template:
    brightness_pct: 50
    xy_color: '{{ colors[(now().second/2.5)|round(0)] }}'
    transition: 1
  target: !input 'cl_light'

then created light_profiles.csv next to where configuration.yaml is and for my light I created the defaults like so:

light.lightstrip.default,0.217,0.077,50

and restarted HA, which makes the lightstrip start at half brightness, but when the automation to loop starts it briefly goes to max brightness then to 50. No idea why.

No worries. We’ll see if anyone has found a fix.

I found this alternative option so going to try it

Ha! Just found this after making something similar but without hardcoded values. Thinking about making a component for general light effects instead now…

Have you gotten this to work? I just got into Home Assistant and after the initial setup this is something I wanted to do. I have a lamp with 3 bulbs and it works with each one but I want them to have different colors instead of all the same.
My inital plan was to change the order of colors @C.G.B.Spender made but somehow whenever I change it, it just doesn’t work anymore.
Not really sure what I’m doing wrong.

I’m usually fairly good with adjusting scripts such like this slightly to do what I want, yet this one proves extremely resilient to any change, basically any single thing I try to adjust in it completely ruins it and I’m sorry I do not know why as I’d like it to do many of the things you folks want to too :slight_smile:

1 Like

I’m finding the same issue. I want to adjust the trigger so that instead of every second, it triggers every 15 minutes.

I change the initial code to:

trigger:
- platform: time_pattern
  hours: '*'
  minutes: /15
  seconds: '*'

But it still triggers every second.

How does one modify this blueprint to work with different time triggers?

Thanks!

adjusting your script; for every 15 minutes, at the top of the minute:

trigger:
- platform: time_pattern
  hours: '*'
  minutes: /15
  seconds: 0

…make sense? :slight_smile: if you wanted things happening at 3:15:47, 3:30:47, etc, then you’d have seconds: 47

…your first offering was interpreted to run to the narrative of “this triggers: at all hours of the day, at every fifteenth minute, for all seconds within said minute.”

Did you actually try this? I’m asking, because if you read thru the thread there’s plenty of us who’d like to change the script, and each of us failed miserably. The script stops working as soon as you mess with the timing of the trigger (or anything else really)

I myself would like to be able to change this, but as it is the script only works with the amount of colors defined when the interval is 1 sec. I do believe to change the timing you would need to introduce/remove certain number of colors into the color array in the same ratio to interval as they are now. I’m not original author of the script, I just made it into blueprint hence why I don’t know how it works exactly.

I looked at this. It triggers every second, which gives you the list of 0 to 59 as the triggers. It converts this list to 0 to 24 by dividing it by 2.5 and rounding that to an integer. That integer picks the color out of the list of 25 colors.
So if you want to change the timing, you would need to change to something else that counts 0 to 59 (because you have the list of 25 colors already made).
You would have to build a counter that changes to 0,1,2,3,4,5… (lets use 2 seconds). Then after 59 reset to 0. The transition time needs to be set to the same 2 seconds.
Outline:
Set the trigger & transition to 2 seconds with the same !input value. Create an input_number helper to store the count. (Choose 1st condition)Check if the input_number is = 59 then change it to 0 and store the number. (Choose 2nd condition)Otherwise add 1 and store the number. Then in the always action replace second/2.5 with the value of the input boolean/2.5. That’s how to change the timing. Should work for sub seconds or multiple seconds. I would probably do the math part in the variables, though, and just put the actual number in the action…

This means the lights would not be synced. IE. now every copy you run of this is syncing on the same second, so multiple running copies all have the same color. With the above they would be different so to sync it you would need to use the multiple in the blueprint to address your lights all at once with the same code instance.

Also you should look at changing this to a script Blueprint so it doesn’t just run all the time. Or leave it an automation Blueprint and add a helper toggle to turn it on and off. It’s not terribly useful as-is.

Take what I gave you there. If you want to work on it or ask more questions feel free. If I re-write it myself it will be in my list of blueprints so I can maintain it, though.

1 Like

That’s some great research / explanations!

I’m gonna be honest here: This looks like it would be far more work I was prepared to put into this (seeing as the published blueprint works as intended for my use case (I work around the issues you mention with separate automations, which is admittedly cumbersome and far from optimal, but already in place and working)).

Should you decide to rewrite and implement your suggestions I would be more than happy to switch to your version of the blueprint.

I have made a blueprint inspired by this one that performs the looping in a script and makes it easy to configure the list of colors and transition time.

1 Like

Thanks for this!

1 Like

It’s strange because when you use the Hue Lab. then you can create a color loop that is working fast… And with the new Hue Play HDMI sync it can change colors raptly fast to sync with screen