Before we get to that, what transition time do you want between colours?
I don’t think you need more colours (fading between 25 colours should be plenty), you just need to adjust the template for the transition time you want.
sequence:
- service: light.turn_on
data_template:
xy_color: |
{{ colors[(now().minute/2.5)|round(0)] }}
transition: 55 # not quite sixty seconds, just to make sure the transition finishes before the next colour command
entity_id: '{{ entity }}'
That’s a very fast transition. You are going to be better off with a LED controller that supports a rainbow effect. Otherwise you will be flooding your network with commands and loading Home Assistant.
how can I add this script to my setup? I was able to add the automation but the script gives me errors when I try to copy and past its yaml in the script page. I feel like its formatted differently?
Hello! I also tried this and checked really everything but it doesn’t work I have the same config but my light doesn’t even turn on.
Can someone help me? It’s a Paulmann Cube, but supports xy, rgb and hs color.
Hi all,
I want to use this script to change the color of a rgbw led strip by holding down a button and when the button is released, stay on that color. Is there a way to change to all colors in lets say 10 seconds?
That would be really nice.
Using:
xy_color: |
{{ colors[(now().second % 25)|round(0)] }}
give me all colors in 24 seconds, but I want it faster.
It would even be more useful if we could set the cycle time by giving it as a parameter to the script!
Who can help?
Hi all,
First of all, I applaude tom_l for patiently answering all these questions. I am still super new to HA and wanted to give it a go myself. Since LIDL had a sale of the smart home devices including lamps, I purchased some for testing purposes. The light I am using is an E14 RGB candle light by Silvercrest and the connection via ZHA worked like a charm.
Testing the script was very straight forward, but I wanted to have a switch that would toggle between the rainbow mode and warm white of the bulb. I was playing around with the “repeat” action and got to the final solution after figuring out the proper order of syntaxes. As a toggle I used a input boolean helper.
This works flawlessly, however, the LIDL lights are very dim in RGB mode compared to the warm to cold white. Also my girlfriend is not a fan of RGB - but it was a fun project anyways.
The automation’s 1-second Time Pattern Trigger is an inefficient use of Home Assistant’s resources. Basically, it’s polling the input_boolean every second (regardless if the input_boolean’s state is on or off).
Given that the goal is to execute the automation’s actiononly when the input_boolean is on, simply use a State Trigger.
In addition, include a small delay within the repeat otherwise it will loop as fast as the host machine’s CPU can execute the actions within the repeat (i.e. very fast).