Add color_mode support to zwave_js light#49588
Conversation
|
Hey there @home-assistant/z-wave, mind taking a look at this pull request as its been labeled with an integration ( |
| # convert to HS | ||
| self._hs_color = color_util.color_RGB_to_hs(red, green, blue) | ||
| # Light supports color, set color mode to hs | ||
| self._color_mode = COLOR_MODE_HS |
There was a problem hiding this comment.
zwave is using raw RGB internally, we might want to flag COLOR_MODE_RGB instead.
| - ((cold_white / 255) * (self._max_mireds - self._min_mireds)) | ||
| ) | ||
| # White channels turned on, set color mode to color_temp | ||
| self._color_mode = COLOR_MODE_COLOR_TEMP |
There was a problem hiding this comment.
zwave allows all 5 channels in a 5 channel light to be on simultaneously. Unless blocked by zwave_js, we might want to check which channels are on:
if r, g, b are all zero and at least one white channel is non zero -> COLOR_MODE_COLOR_TEMP
if at least one of r, g, b is non zero and at least one white channel is non zero -> COLOR_MODE_RGBWW
| if self._supports_rgbw: | ||
| self._supported_color_modes.add(COLOR_MODE_RGBW) | ||
| elif self._supports_color: | ||
| self._supported_color_modes.add(COLOR_MODE_HS) |
There was a problem hiding this comment.
zwave is using raw RGB internally, we might want to flag COLOR_MODE_RGB instead.
Also, if the light supports both color and color_temp, it's a 5 channel light and we might want to flag COLOR_MODE_RGBWW as well.
MartinHjelmare
left a comment
There was a problem hiding this comment.
Looks good. I'll test the PR with my color light.
|
My color light is missing the color wheel in the frontend with this PR. |
|
Calling the light.turn_on service seems to work with a color name. (but still no color wheel in the frontend) |
|
For testing with frontend, you need this PR, I forgot to mention it home-assistant/frontend#8961 Also, what kind of color lights do you have? |
|
It's an Aeotec LED Bulb 6 Multi-Colour with warm/cold/red/blue/green. |
|
Ok, we should wait with merging here until the frontend is updated with this in core. |
|
The frontend PR is merged, I think this should not be marked as draft anymore? |
|
I think this may need a little rework in light of the recently fixed |
3d65976 to
330d2fa
Compare
|
Thanks @firstof9, rebased + reworked as needed 👍 |
MartinHjelmare
left a comment
There was a problem hiding this comment.
I've now tested this with my light and the new frontend and the behavior is the same as before.
Looks good!
Breaking change
Zwave JS lights no longer supports deprecated white_value, use rgbw_color instead.
Proposed change
Add color_mode support to zwave_js light.
Flag support for rgbw instead of white_value for lights with red, green, blue and a single white channel
Note:
The driver for this PR is that
white_valueis deprecated, with a plan to warn when it's used in 2021.6, and a complete removal in 2021.10.zwave_js is one of the most widely used integrations which supports
white_value.If this is not the right way to modify zwave_js, it's perfectly fine to close this PR.
Type of change
Example entry for
configuration.yaml:# Example configuration.yamlAdditional 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: