Conversation
|
That weird UI behaviour is not new. I believe it's been there all the time, but with the new color wheel it's way more obvious. I think it has something to do with the color roundtrip from hass update -> gateway change -> hass updating based on gateway info -> color reflecting in UI. |
|
@NovapaX I think @ggravlingen and I have found the issue with the strange behaviour we were saying. Do you know where this logic comes from? We end up with rounding errors going back and forth between the gateway, and I was wondering where the normalisation math comes from? |
|
|
||
| def denormalize_xy(argx, argy, brightness=None): | ||
| """Denormalise XY from Tradfri scaling.""" | ||
| return (int(argx/65535-0.5), int(argy/65535-0.5)) |
There was a problem hiding this comment.
This must return a float
|
I have really no idea where that comes from. As far as I can see (git blame) you put it in there with this PR 😜 I've only done some work on the platform and on the color wheel UI. Nothing specific to trafdri lights. On should wonder: Why can't all these vendors just settle on some uniform inplementation and interpretation of standards? 🤔 |
|
@NovapaX @lwis when I poked around with colors in pytradfri, I noticed that that it seems you set hex values in the app. The gateway then sets the correct color of the bulb and converts hex->xy. Ideal would be to send hex from Home Assistant. Unfortunately, the gateway only accepts a predefined list of hex colors. I guess we could replicate this in Home Assistant (only a predefined set of colors), even though I suspect that users would not appreciate that. The transformation mentioned by @NovapaX involves linear algebra and transformation matrices (https://github.com/home-assistant/home-assistant/blob/8742ce035a36b3a4a176123b620fe82e55d5a4e2/homeassistant/util/color.py#L201) and given that they are rounded floats, I suspect that they will contribute to the behaviour we see in Home Assistant. |
|
Can I make a unique_id PR against this branch? |
|
Please don't add more features to this PR. |
|
Ok. I’ll rebase and re-PR when this is merged. 👍 |
|
Any objections to this being merged? |
|
Any chance of cherry picking this into the 0.66 beta? |
|
Why? Current implementation is not badly broken right? |
|
I think we should wait, given that we're half way (?) through the beta phase. |
|
No, you’re right, let's wait. |
|
During the beta phase we should only cherry pick bug fixes. New features will have to wait. |
Description:
Improved colour handling from library.