Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.Sign up
Use kelvins as the preferred white temperature unit #146
Home Assistant currently uses mireds as the internal representation of color temperature for white lights. I believe this has no particular reasoning other than the Hue API being the first one implemented and it uses mireds.
However, lights are always advertised with a certain kelvin range, even Hue bulbs, so this is the scale that humans know and also the one used for most other light APIs.
This means that almost all light integrations must do kelvin/mired conversions and that has resulted in numerous bugs. We have had bugs such as swapped warm/cold, division by zero and setting a temperature that is slightly (but noticeably) wrong. These kinds of bugs continue to appear in new implementations. This is because implementors expect kelvins and mireds to be related by a linear function but they are not.
Since the kelvin/mired relationship is reciprocal rather than linear, an interesting artifact is that the color temperature slider in the UI is not intuitive. For a 2000K-8000K (500-125 mireds) bulb, the expected midpoint is 5000K but the midpoint we currently use in the UI is way off at 3200K.
If we can agree, I volunteer to implement these changes across all light platforms. It is not entirely clear to me how it would affect external stuff like mqtt?