Color Loop effect for any light with color wheel selector

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

Hi, I’m hoping that someone can help me figure something out. I have used this blueprint to set up a colour loop on a light group in my kids’ room. It does what it’s supposed to, except that it runs all the time and I can find no way to toggle it on and off! I’d like to have it triggered by a click from a scene switch button that is on the wall in the room, but I can’t find a way to do this. I’ve tried to edit the yaml to add a condition that a helper has to be toggled to on for it to work. The outcome of this is that the lights stop transitioning and hold to one colour when the toggle is off, but that’s as close as I can get. Does anyone have any ideas please?

Thanks,
Sam

Simply turn the resulting automation on and off to start/stop. When it’s on it fires every second and sets the light to a color, when it stops it stops at the color it’s at then you can set your own color in automation, when it starts it always starts the same color
edit: check the comment Color Loop effect for any light with color wheel selector - #4 by C.G.B.Spender

This bp is not the best tbh, but “it just works”, though I suggest you use the one I mention in 1st post which is better optimized (I get full rainbow just switching around 3 colors with it with a long delay between) and I migrated to it recently myself: Color Loop Blueprint with Configurable Colors and Transition Time

Thank you for responding and for the advice I now have it working (mostly!) thanks to your input. Also, apologies that I didn’t pick up on your earlier comments that you referred me to, I’m not sure how I missed them in my research! S.

1 Like

How can I stop/interrupt the effect?

Hi, what can I do to make the color change gradually? Obviously the color change must occur every 5/10 seconds