Use Kelvin as the preferred color temperature unit#79591
Merged
Conversation
Contributor
|
Hey there @home-assistant/core, mind taking a look at this pull request as it has been labeled with an integration ( |
5a56593 to
9e121c1
Compare
emontnemery
commented
Oct 4, 2022
| assert color_util.color_rgb_to_rgbww(64, 64, 64, 2702, 6493) == (0, 14, 25, 64, 64) | ||
| assert color_util.color_rgb_to_rgbww(32, 64, 16, 2702, 6493) == (9, 64, 0, 38, 38) | ||
| assert color_util.color_rgb_to_rgbww(0, 0, 0, 2702, 6493) == (0, 0, 0, 0, 0) | ||
| assert color_util.color_rgb_to_rgbww(0, 0, 0, 10000, 1000000) == (0, 0, 0, 0, 0) |
Contributor
Author
There was a problem hiding this comment.
Note that min_mired=0 in the test was not realistic, it means an infinitely high color temperature
Comment on lines
-438
to
-448
| assert color_util.color_rgbww_to_rgb(255, 255, 255, 0, 0, 0, 0) == (255, 255, 255) | ||
| assert color_util.color_rgbww_to_rgb(255, 255, 255, 255, 255, 0, 0) == ( | ||
| 255, | ||
| 161, | ||
| 128, | ||
| ) | ||
| assert color_util.color_rgbww_to_rgb(255, 255, 255, 255, 255, 0, 370) == ( | ||
| 255, | ||
| 245, | ||
| 237, | ||
| ) |
Contributor
Author
There was a problem hiding this comment.
Removed because these tests used invalid min/max mireds
Member
bdraco
reviewed
Oct 6, 2022
bdraco
approved these changes
Oct 6, 2022
MartinHjelmare
approved these changes
Oct 6, 2022
23 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Proposed change
Use Kelvin as the preferred color temperature unit
WTH: https://community.home-assistant.io/t/wth-is-light-temperature-not-in-kelvin/467449
Implements the proposal from home-assistant/architecture#564 (comment):
ATTR_COLOR_TEMP_KELVIN, which can be used in service calls instead ofATTR_KELVINATTR_KELVINas an alternative way to provideATTR_COLOR_TEMP. Reverse this relationship, makingATTR_COLOR_TEMP_KELVINthe primary attribute that light platforms receive in theirturn_onhandler.ATTR_COLOR_TEMPandATTR_COLOR_TEMP_KELVINLightEntity.color_temp_kelvinproperty for the color temperature of a light. Keep support for lights implementingLightEntity.color_tempduring a deprecation period, just likehs_colorauto-converts torgb_color.LightEntity.min_color_temp_kelvin/LightEntity.max_color_temp_kelvinattributes. Keep support for lights implementingLightEntity.min_mireds/LightEntity.max_miredsduring a deprecation period.ATTR_COLOR_TEMP_KELVIN,ATTR_MIN_COLOR_TEMP_KELVINandATTR_MAX_COLOR_TEMP_KELVINATTR_COLOR_TEMP,ATTR_MIN_MIREDSandATTR_MAX_MIREDSare also set.ATTR_KELVINandATTR_COLOR_TEMPfrom thelight.turn_onservice callATTR_COLOR_TEMP,ATTR_MIN_MIREDSandATTR_MAX_MIREDSLightEntity.color_temp,LightEntity.min_miredsandLightEntity.max_miredsTo be followed up with:
ATTR_COLOR_TEMP_KELVINType of change
Additional information
Checklist
black --fast homeassistant tests)If user exposed functionality or configuration variables are added/changed:
If the code communicates with devices, web services, or third-party tools:
Updated and included derived files by running:
python3 -m script.hassfest.requirements_all.txt.Updated by running
python3 -m script.gen_requirements_all..coveragerc.The integration reached or maintains the following Integration Quality Scale:
To help with the load of incoming pull requests: