Quantcast
Channel: Configuration - Home Assistant Community
Viewing all articles
Browse latest Browse all 95513

Correct way to set the light color using the 'rgb_color' attribute

$
0
0

@mudit182 wrote:

I wanted to inquire about the rgb_color attribute available in the light component. In the docs it says

A list containing three integers between 0 and 255 representing the RGB color you want the light to be. ..."

However, in reality the numbers need to be between 0 and 100. This seems to be a recent modification as previously 0 - 255 worked perfectly.

The biggest problem, as far as I see, is that internally HA still stores rgb values between 0-255. So for instance when I get the current state using “state_attr(‘light.my_light’, ‘rgb_color’)” I get a list of values between 0-255, but when I need to set the same state, I need to convert it to 0-100.

So does anyone have any idea as to which is/will be the standard? Is it a bug and rgb_color will be reverted to the range of 0-255 or do the docs need to be updated and 0-100 is the new standard?

Ps. I have a script that randomly generates rgb values for my light. It’s more like a random walk around the color wheel, so the color change is not too jarring. Anyway in case anyone wishes to know how I did it, I’d be happy to share that later in this post.

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 95513

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>