zwave-js / certification-backlog

Issues and discussions related to Z-Wave certification of HA + Z-Wave JS
1 stars 0 forks source link

RGB colors are rounded incorrectly #51

Closed AlCalzone closed 1 week ago

AlCalzone commented 2 weeks ago

The CTT tests send a report with RGB = (8, 255, 255), and asks whether the color component for red is 8, but the color picker in the HA frontend shows (7, 255, 255).

MindFreeze commented 1 week ago

This is probably a frontend bug with the color picker as I see a lot of conversions between HS and RGB, which means floating point math. Will be difficult to reproduce though

AlCalzone commented 1 week ago

FWIW, I wasn't able to reproduce it with other values the CTT tests send. Only the 8 was problematic. Maybe we can get around it by explaining the difference in the corresponding documentation for the test house.

MindFreeze commented 1 week ago

I managed to reproduce it on the frontend. If you set those values in the color picker and the device only supports HS mode, we do some conversions and set the wrong saturation value

MindFreeze commented 1 week ago

The float error in the frontend turned out to be irrelevant and not fixable in a nice way. The problem is that core does floor instead of round in the conversion so I submitted a PR there

MindFreeze commented 1 week ago

HA has improved conversions now and (8, 255, 255) works but there is still floating point error so we might encounter this with another color in the future