-
-
Notifications
You must be signed in to change notification settings - Fork 33.8k
improve RGB support for tradfri
#9698
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and
privacy statement. We’ll occasionally send you account related emails.
Already on GitHub?
Sign in
to your account
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Added feature detection (SUPPORT_RGB_COLOR) for IKEA tradfri RGB bulbs. String comparison with manufacturer/device id used because I think there isn't a suitable property/param to identify the RGB capability. Both IKEA WS and RGB have data in the same parameters (x, y, rgb). Color picker in UI is only offered after one of the default RGB colors (i.e. efd275) is set in param 5706. For now I couldn't find the section in polymer where the decision (to show a color picker or not) is made.
|
||
|
||
_LOGGER.debug("features detected for %s %s: %d", self._name, self._light.device_info.model_number, self._features) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
blank line contains whitespace
else: | ||
self._features |= SUPPORT_RGB_COLOR | ||
|
||
|
||
_LOGGER.debug("features detected for %s %s: %d", self._name, self._light.device_info.model_number, self._features) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
line too long (122 > 79 characters)
else: | ||
self._features |= SUPPORT_RGB_COLOR | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
blank line contains whitespace
@@ -104,13 +104,18 @@ def __init__(self, light, api): | |||
self._name = self._light.name | |||
self._rgb_color = None | |||
self._features = SUPPORT_BRIGHTNESS | |||
|
|||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
blank line contains whitespace
else: | ||
self._features |= SUPPORT_RGB_COLOR | ||
|
||
_LOGGER.debug("features detected for %s %s: %d", | ||
self._name, self._light.device_info.model_number, self._features) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
continuation line under-indented for visual indent
else: | ||
self._features |= SUPPORT_RGB_COLOR | ||
|
||
_LOGGER.debug("features detected for %s %s: %d", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
trailing whitespace
else: | ||
self._features |= SUPPORT_RGB_COLOR | ||
|
||
_LOGGER.debug("features detected for %s %s: %d", | ||
self._name, self._light.device_info.model_number, self._features) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
continuation line under-indented for visual indent
line too long (81 > 79 characters)
_LOGGER.debug( | ||
"features detected for %s %s: %d", | ||
self._name, self._light.device_info.model_number, self._features | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You see the feature on UI, there need no debug log...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed logging of detected features
The color selector will be shown when the RGB property of the entity does not return |
- debug logging of detected features removed (change requested) - on the fly conversion of xyb values to rgb list added to update method resulting in: - current rgb values will made be available for all bulbs/entities from current xyb values (i.e. IKEA WS and RGB) - bulb icon in UI is color scaled with current color (tested with IKEA WS+RGB and FLS-pp RGB) - UI color picker or color temperature slider is displayed for respective bulb types
self._light_data.dimmer not in (None, '0'): | ||
self._rgb_color = color_util.color_xy_brightness_to_RGB( | ||
self._light_data.xy_color[0]/65536, | ||
self._light_data.xy_color[1]/65536, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
trailing whitespace
elif self._light_data.xy_color not in (None, '0') and \ | ||
self._light_data.dimmer not in (None, '0'): | ||
self._rgb_color = color_util.color_xy_brightness_to_RGB( | ||
self._light_data.xy_color[0]/65536, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
trailing whitespace
|
||
# handle GW behavoiur which does report hex color '0' whenevener | ||
# a bulb is set to a color_xy which isn't one of the predefined ones | ||
# -> convert xyb to rgb when available |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
trailing whitespace
self._rgb_color = color_util.rgb_hex_to_rgb_list( | ||
self._light_data.hex_color) | ||
|
||
# handle GW behavoiur which does report hex color '0' whenevener |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
trailing whitespace
@@ -198,6 +201,16 @@ def update(self): | |||
|
|||
# Handle Hue lights paired with the gateway | |||
# hex_color is 0 when bulb is unreachable | |||
if self._light_data.hex_color not in (None, '0'): | |||
if self._light_data.hex_color not in (None, '0'): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
trailing whitespace
- debug logging of detected features removed (change requested) - on the fly conversion of xyb values to rgb list added to update method resulting in: - current rgb values will made be available for all bulbs/entities from current xyb values (i.e. IKEA WS and RGB) - bulb icon in UI is color scaled with current color (tested with IKEA WS+RGB and FLS-pp RGB) - UI color picker or color temperature slider is displayed for respective bulb types
I don't want to merge this before #7815 gets in, which is a major refactor of Tradfri and should land soon. |
Reincarnated in #9717 |
Added feature detection (SUPPORT_RGB_COLOR) for IKEA tradfri RGB bulbs.
String comparison with manufacturer/device id used because I think there isn't a suitable property/param to identify the RGB capability. Both IKEA WS and RGB have data in the same parameters (x, y, rgb).
Added on the fly conversion of xyb values to rgb list to update method resulting in:
- bulb icon in UI is color scaled with current color (tested with IKEA WS+RGB and FLS-pp RGB)
- UI color picker or color temperature slider is displayed for respective bulb types
see also:
#9603
Tested with the following setup:
Home Assistant 0.53.1
pytradfri 2.2
IKEA tradfri gateway fw 1.1.0015
zigbee rgb PWM module (dresden elektronik FLS-PP lp)
IKEA RGB, WS and dimmable-only bulbs
Description:
Related issue (if applicable): fixes #9603
Pull request in home-assistant.github.io with documentation (if applicable): home-assistant/home-assistant.io#9411
Example entry for
configuration.yaml
(if applicable):Checklist:
If user exposed functionality or configuration variables are added/changed:
If the code communicates with devices, web services, or third-party tools:
tox
run successfully. Your PR cannot be merged unless tests passREQUIREMENTS
variable (example).requirements_all.txt
by runningscript/gen_requirements_all.py
..coveragerc
.If the code does not interact with devices:
tox
run successfully. Your PR cannot be merged unless tests pass