Yeah, I noticed that too when checking the PRs. Should be in 45.1.
i still got this problem, a random color is choosed at boot and then it sticks to it until a reboot
ha 0.93
rgb_color: ['{{ (range(0, 255)|random) }}', '{{ (range(0, 255)|random) }}', '{{ (range(0, 255)|random) }}']
rgb_color: ['{{ (range(0, 255)|random) }}', '{{ (range(0, 255)|random) }}', '{{ (range(0, 255)|random) }}']
This works for me since 2017 (latest version). But it looks exactly like yours.
ok i have to admit a bad recall, my fault.
I checked out again and in this particular case i use a yeelight service data (custom effect at the bottom of the page https://www.home-assistant.io/components/yeelight/):
RGBTransition: ['{{ (range(0, 255)|random) }}', '{{ (range(0, 255)|random) }}', '{{ (range(0, 255)|random) }}', 5000, '{{ (range(128, 255)|random) }}']
It works like a transition between rgb colors but somehow the random part still cache the first iteration like it was later fixed for rgb_color, even if that doesn’t makes senso to me: the random component caching was not fixed somehow but just worked around to make it works with rgb_color data only?
please can any devs check out on this?
Hi,
Did you succed? I have a yeeligh and would like to set random rgb transition and cannot succed to dot it. any clue? Thanks.
later I successfully made an automation that works
- alias: Hass - Random Colors
initial_state: false
trigger:
platform: time_pattern
seconds: '/10'
action:
- service: light.turn_on
data:
entity_id: <YOUR ENTITY>
data_template:
brightness: '{{ (range(128, 255)|random|int) }}'
transition: '{{ (range(2, 5)|random|int) }}'
rgb_color: ['{{ (range(0, 255)|random|int) }}', '{{ (range(0, 255)|random|int) }}', '{{ (range(0, 255)|random|int) }}']
you can trigger this automation within another one to start an infinite flow of random colors for a light entity (delete the brightness line if you don’t like it, I randomized it too between 50% and 100% of brightness)
Thanks a lot unfortunately its not working. I have this message in log:
voluptuous.error.MultipleInvalid: extra keys not allowed @ data['RGBTransition']
Do you have an idea?
can you please paste your code?
here you go
action:
- service: light.turn_on
data:
entity_id: light.lumiere_salon
data_template:
brightness: '{{ (range(128, 255)|random|int) }}'
rgb_color: ['{{ (range(0, 255)|random|int) }}', '{{ (range(0, 255)|random|int) }}', '{{ (range(0, 255)|random|int) }}']
I wondering if the issue is not related that my yeelight bulb are integrated to HA with homekit. How is yours integrarted to HA?
Thanks for your help!
your template has no errors codewise
my bulbs are directly configured through the yeelight yaml integration and detected over wifi, without any external gateway
Thanks for your help. Every thing is now working fine. Issue was indded that its not working via homekit integration, need to be done via yeelight integration.
Thanks again.
they just broke everything with the latest update, i’m seeking a solution
edit: i updated the automation to the new simplified template grammar, we do not need a separate data_template key to include templates
- alias: Hass - Random Colors
initial_state: false
trigger:
platform: time_pattern
seconds: '/10'
action:
- service: light.turn_on
data:
entity_id: <YOUR ENTITY>
brightness: '{{ (range(128, 255)|random|int) }}'
transition: '{{ (range(2, 5)|random|int) }}'
rgb_color: ['{{ (range(0, 255)|random|int) }}', '{{ (range(0, 255)|random|int) }}', '{{ (range(0, 255)|random|int) }}']
This is Awesome!!! Thank you
Is there a way to make several bulbs change random just like this does, but all at the same color?
I found a way
service: light.turn_on
data:
brightness: '{{ (range(128, 255)|random|int) }}'
transition: '{{ (range(2, 5)|random|int) }}'
rgb_color:
- '{{ (range(0, 255)|random|int) }}'
- '{{ (range(0, 255)|random|int) }}'
- '{{ (range(0, 255)|random|int) }}'
target:
device_id:
- e7be91b1f807c2b0438049754968ea94
- 0f4431879ffc60129ac9f5cfe3127969
- a21da6a2bf2d7ea1f657eb94a5180b98