One minute between colours?
Ok you just made that easy, I think. Let me try it…
One minute between colours?
Ok you just made that easy, I think. Let me try it…
Try this:
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 }}'
I got the transition wrong, sorry
This is what I want to archive. See Video
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.
Tuya has stopped supporting rainbow scene effect in home assistant. Leaving the network problem out. Is it possible to do?
Yes, with a new light controller.
An ESP32 flashed with WLED will cost you $5.
Can you send a link for buying the ESP32, amazon or something?
https://www.aliexpress.com/item/32817842070.html
And the link to WLED:
It has more effects than you will ever use. Lots and lots of colour pallets (as well as custom), and it integrates very well with Home Assistant.
Is there a pre populated version of this where you can just connect power and led strip.
Yes, prebuilt and pre-flashed with WLED, but it will cost you more (stock should be arriving soon):
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?
Just curious…what would it be for 30 seconds?
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.
thx in advance!
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.
- alias: Stern Rainbow Mode an
description:
trigger:
- platform: time_pattern
hours: '*'
minutes: '*'
seconds: /1
condition:
- condition: state
entity_id: input_boolean.rainbow_mode
state: 'on'
action:
- repeat:
until:
- condition: state
entity_id: input_boolean.rainbow_mode
state: 'off'
sequence:
- service: script.rainbow_light
data:
entity: light.licht_rgb_lidl_level_light_color_on_off
- service: light.turn_on
target:
entity_id: light.licht_rgb_lidl_level_light_color_on_off
data:
kelvin: 2000
brightness_pct: 100
mode: single
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.
Hi @JottHa , please change "description: " to "description: ‘’, was throwing an error on my side.
THX
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 action
only when the input_boolean is on
, simply use a State Trigger.
- alias: Stern Rainbow Mode an
description:
trigger:
- platform: state
entity_id: input_boolean.rainbow_mode
from: 'off'
to: 'on'
condition: []
action:
- repeat:
until:
- condition: state
entity_id: input_boolean.rainbow_mode
state: 'off'
sequence:
- service: script.rainbow_light
data:
entity: light.licht_rgb_lidl_level_light_color_on_off
- delay: '00:00:01'
- service: light.turn_on
target:
entity_id: light.licht_rgb_lidl_level_light_color_on_off
data:
kelvin: 2000
brightness_pct: 100
mode: single
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).
THX - usefull improvement!
This script works great for me. Is there a way of doing more of a flicker as well, where you can actually see the colours (like red, blue, green etc as some of my lights do on startup)
I did have to remove the top part and fill in the entity hardcoded, i guess i’m missing some critical yaml or indentation.
rainbow_light: # had to remove this (it's not indented now but it was before)
alias: rainbow light
mode: single
fields:
entity:
description: The entity that will be rainbowed
example: light.study_room_light_1
variables:
colors: |-
{{ [[0.217,0.077], [0.157,0.05], [0.136,0.04], [0.137,0.065],
[0.141,0.137], [0.146,0.238], [0.151,0.343], [0.157,0.457],
[0.164,0.591], [0.17,0.703], [0.172,0.747], [0.199,0.724],
[0.269,0.665], [0.36,0.588], [0.444,0.517], [0.527,0.447],
[0.612,0.374], [0.677,0.319], [0.701,0.299], [0.667,0.284],
[0.581,0.245], [0.477,0.196], [0.385,0.155], [0.301,0.116],
[0.217,0.077]] }}
sequence:
- service: light.turn_on
data_template:
xy_color: |
{{ colors[(now().second/2.5)|round(0)] }}
transition: 1
entity_id: light.study_room_light_1 #'{{ entity }}'
@tom_l is there a way to alter the brightness? I’ve put in a brightness: 10 or brightness_pct:10 but each colour change momentarily sets the brightness to 100% and then down to 10, so it’s a flicker when doing the transition.
Also tried adding the brightness in the automation data but no joy.