hass-circadian_lighting
hass-circadian_lighting copied to clipboard
More accurately convert colortemp to xy and hs
The current color conversion from color temperature to rgb distorts colors. For instance during the day whiter colors get shifted slightly towards magenta, while in the evening warmer color temperatures shift more towards red. This is a problem when using led bulbs that don't directly support color temperature but can for instance be set in xy or hs. This PR uses a more accurate conversion for color temperature by using the functions provided by the colour-science package.
This photo shows the effect of this PR. The light bulbs in the three rooms in the picture (left, middle, and right) have all been set with the hass-circardian_lighting component.
The room on the right has a light that directly accepts color temperatures as a setting. The color of the middle room comes from setting a RGB light with the current version of this repo (without this PR). On the room on the left we have again a RGB light, but set in xy with this PR applied. As it can be seen the color generated with this PR (room on the left) more accurately resembles the light generated by the native color temperature light bulb (room on the right).