Color Loop Blueprint with Configurable Colors and Transition Time

And so we came the full circle and it’s automation again :smiley: Thanks for the update!

edit: works great, since I am lazy, I just changed the old script to trigger this automation as I didn’t want to go thru wherever I been triggering the script and changing it to automation, I presume this should not cause any issues ?

edit2: nvm, realized that’s what the toggle is, so just went thru wherever it called script.turn_on/off and changed it to the helper input_boolean I created

Really like the version 2 of the blueprint, great work!

Hmm…I was using the color loop blueprint from @C.G.B.Spender without any issues and now I wanted to give this one a try because it was mentioned to be suggested to do so.
So what I did was:

  • Created a Toggle Helper
  • Created an automation with this blueprint which takes the Toggle Helper for enabling/disabling the color loop
  • Created an automation for my physical light switch button which on “button hold” enables the Toggle Helper and on “button release” disables the Toggle Helper

It basically works. When I press the physical light switch button, the color loop starts.
But: Compared to the color loop bluepwint from C.G.B. Spender, when releasing the physical light switch button, the color loop does not stop exactly at the time of button release but instead it continues to loop for about a second or so. Therefore, most of the time, it is not possible to choose the color of choice, because mostly it jumps to the next color and then stops to loop. Seems like there’s a delay occurring somewhere.

Any ideas what the problem could be?
Thank you in advance!

Here’s the code for the color loop blueprint automation:


alias: test_color_loop
description: ""
use_blueprint:
  path: mdolnik/color_loop.yaml
  input:
    light: light.tvroom
    helper_toggle: input_boolean.test_helper
    max_color_distance: 180
    transition:
      hours: 0
      minutes: 0
      seconds: 4
    color_1:
      - 255
      - 0
      - 0
    color_2:
      - 255
      - 104
      - 0
    color_3:
      - 255
      - 237
      - 0
    color_4:
      - 101
      - 255
      - 0
    color_5:
      - 0
      - 128
      - 0
    color_6:
      - 0
      - 255
      - 203
    color_7:
      - 7
      - 200
      - 255
    color_8:
      - 0
      - 51
      - 255
    color_9:
      - 115
      - 0
      - 255
    color_10:
      - 255
      - 7
      - 249
    color_11:
      - 255
      - 2
      - 150
    max_changes_per_second: 1

I don’t think it’s a problem per se, more of a symptom of how this blueprint does things. My blueprint has 20-something hardcoded colors it rotates each second, which can be detrimental to performance in some scenarios, with this blueprint I use 3 colors with 1s delay and still get the full rainbow spectrum.

I think the delay is happening because when you stop it, the command to rotate through the color spectrum to the next defined color was sent out, and it’s already happening, and it stops at the next step which is when it reaches the defined color. This is just my understanding.

If the ability to stop at certain color is important to you and you didn’t suffer any adverse performance effects from using my old blueprint just return to that one, until someone more knowledgeable can make this one work like you want (if possible).

edit: for reference this is what I use from this blueprint:

alias: bp Color Loop 2
description: ""
use_blueprint:
  path: mdolnik/color_loop.yaml
  input:
    light: light.lightstrip
    transition:
      hours: 0
      minutes: 0
      seconds: 30
    max_color_distance: 45
    color_1:
      - 255
      - 0
      - 0
    color_2:
      - 0
      - 255
      - 0
    color_3:
      - 0
      - 0
      - 255
    max_changes_per_second: 1
    helper_toggle: input_boolean.color_loop_control
mode: single

edit2: I think the transition is what’s delaying it, but if you put that to 1sec it’ll effectively work as my old bp did (I think :smiley:)

Hmm…I tried to change transition to 1 sec but the behavior did not change in any way.

Have been searching for something to make my exterior lights transition through red to orange during the Halloween month. I think I’ve found my answer.

I’m currently transitioning with just two colors - a deep red and a dark/burnt orange. Working on the timing to make it smooth and like a heart beat or breathing, but pretty darn happy with the 10 mins of config I’ve done so far.

Thanks for a great blueprint!

1 Like

I have a bunch of lights out front that light the front of the house.

I have migrated away from my hue hub. I did like the hue dynamic (hue labs) scenes that were possible with the hue hub. Given a group of lights each would cycle through a colour palette. At any one time there was a mix of colours being used.

I am interested in this blueprint to replicate that now that I am no longer using the hue hub. As far as I can tell if I give this blueprint a group of lights all lights in that group would be on the same colour at the same time.

Is it possible to have it so that each light is on a different colour out of the chosen colours?

The only way I see that happening is if I have multiple copies of this blueprint running, one per light. I have 14 lights out front so that might / would end up being cumbersome.

Thank you.

Yes right now, with this blueprint that’s the only way you would be able to have different color palettes occurring on different lights.

You can also add a custom Toggle Helper and reference it in all of the blueprints to have one “switch” toggle the color transitions for all lights/blueprints at once.

If you know how to deal with the yaml behind the scenes, it would be less cumbersome to make one blueprint, edit its yaml, then copy/paste the yaml to other blueprints for different lights.

1 Like

Hi, Thanks for all your efforts.
Running the automation at 2 second transition time and I am getting this error.

Stopped because an error was encountered at 31 October 2023 at 12:00:44 (runtime: 10.43 seconds)

Could not load a dict; the given string is not valid JSON.: line 1 column 16 (char 15)

The automation just stops, any ideas.
Many thanks

PS I have left on for about 30 minutes on a transition of 10s and it seem ok (but is more like 5 seconds rather than 10)

Would it be possible to allow this (maybe even an option in the UI) to select the next color randomly? I know it’s called “Color Loop”. I would like my set of outside lights to slowly fade through the colors I’ve selected but randomly, so they all seem to have their own color sequence. I’ve not looked at the code yet, as I’m pretty new to HA, but I am about to do that.

what about cycling between scenes of lights?

I’m a bit confused as to what I have to do to have all lights within a group switch to different colours. I currently have one helper, and an automation for light01 to light10. All 10 lights automation are using the 3 x 255 rgb setting as suggested (which seems to go through all the color wheel). However all lights are switching to the same exact color at all times. not sure what I’m missing …

edit1:

it seems like if I turn on the individual lights in the group one after the other (waiting for the previous to change color), I can get them to be all different, in this group I have 10 bulbs so it takes a pretty long time to get this going.

The automation in the blueprint sends commands to an entity. That can be a group or a single light. But the commands are all the same. Apparently you can trick the timing by switching things off and on.
A way to do it that takes some upfront work but is easy afterwards, is like this:you use the blueprint to make a number of different automation, but you link them all to the same helper. Then you can control each color order and timing individually but switch on the looping with a single button.
I don’t know if it is possible in YAML to extract the members of a group. If that is possible, it would be possible to change the blueprint such that it automatically gives random time offsets to the different members. I guess that would increase Zigbee traffic though.

Edit:didn’t read your post well enough. You already have individual automations. In that case, change the color order and/or timing for each light. I think it would also not be hard to add a random start delay to the blueprint, and add an input for that.

@mdolnik , I went ahead and built in this random start delay into the blueprint. It was a fun excercise, YAML isn’t exactly my native language :laughing:. I made a fork for it on Github Gist but it’s such a small edit that it would be a bit weird to start a whole new fork for it. Perhaps you can update the blueprint? See the code here:

1 Like

HI
Created a Christmas loop for my outside house lights, just consisting of green and red but I am also getting a yellow from nowhere, which is between colour changes so it more annoying as it is twice the rate of the green and red, I have also checked the Tapo app to check for defaults and states etc but i have a default state of white, any ideas?

Thanks

I do believe this is a side effect of how the blueprint works, if you look at the top few posts where author shows the color wheel and how the script “travels” across it, it becomes apparent that on the way from red to green and vice versa you have to pass yellow twice.

I personally haven’t tried suggestions from this thread, but you might find some inspiration there, since you look to emulate xmas lights ie blinking lights not a color loop per se: Blinking Holiday Lights? Best Approach - #5 by dailand

I trying to just put a simple light to the blueprint but. Get this message

Message malformed: Entity IDs cannotn be None for dictionary value @ data|‘condition’][O][conditions’][0]

l’entity_id"]

When I’m trying to save

Running on latest HA on a rpi4

The light i a ostam led strip and it works as a normal light in HA

type or paste code here

Thanks for letting me know, Sorry for the delay, appreciate your input

1 Like

@mdolnik

I’m finding some color-syncing issues. Is that why you were experimenting with a delay randomizer, @allard77 ?

I’ve got all of the lights I want to change color in a Z2M group (~dozen Philips Hue Downlights, ~dozen Gledopto LED light strips).

I find when I activate the Automation via the Blueprint (v 2.0.0), the Philips lag behind the Gledopto-controlled lights (even though they are in the same Z2M group). FWIW, the Philips lights, however, always stay in sync with themselves, as do the Gledopto LED strips.

I’ve tried with a separate toggle, as well as simply using the same Light Group Entity as the Color Loop Toggle. Same Results: The Philips lag behind the other lights in the group, by ~10-~15 seconds. However, the Philips seem to skip the first color (blue), and start to fade into the second-ish color, Pink. It sounds dumb, but they seem to hang on the original color (usually warm or cool white), and then realize they need to be in sync with the others, so they skip blue, jump to pink-ish, but are still lagging.

I have all of the colors set (12 colors, Blue-Purple-Pink-Red-Orange-Yellow-Green-Blue). I’ve confirmed that all of the lights can display all of the colors individually.

Transition Time: 10 seconds
Max Color Distance: 180
Max Changes Per Second: 1

CPU is only hitting about 25%.

Also, FWIW, when I activate any separate scenes (e.g. not using the Color Loop Blueprint), the Philips and Gledopto lights all react almost instantly.

Edit: If I add a separate Toggle for the Automation - and I toggle it while the Automation is running, the Philips “jump” to the color the Gledoptos are at, and the Automation pauses.

  • Core 2024.5.3
  • Supervisor 2024.05.1
  • Operating System12.3
  • Frontend 20240501.1

What could I be missing? Thanks!

I’ve run this blueprint in the past without a problem. However, I’m now re-visiting it because I have some LED strips that I’m integrating. It’s not working for me anymore, with any of my lights. The hugalafutro Color Loop is, as is the Twanne Party Lights, so I’m sure the LED strip and my other test lights are functioning.

I wonder if something broke in the latest updates. I’m on HA 2024.6.4. Is anyone else having problems? Thanks!

I just tested mine for you. It works as it always has. I’m on 2024.7.1 so I doubt it’s the updates.

1 Like