Send XY color for non-osram hue bulbs (#13665)
* Send XY color for Philips hue bulbs * Review fixes * Comment tweaks
This commit is contained in:
parent
e6006e9beb
commit
1a9727c75a
1 changed files with 8 additions and 2 deletions
|
@ -300,8 +300,14 @@ class HueLight(Light):
|
|||
command['transitiontime'] = int(kwargs[ATTR_TRANSITION] * 10)
|
||||
|
||||
if ATTR_HS_COLOR in kwargs:
|
||||
command['hue'] = int(kwargs[ATTR_HS_COLOR][0] / 360 * 65535)
|
||||
command['sat'] = int(kwargs[ATTR_HS_COLOR][1] / 100 * 255)
|
||||
if self.is_osram:
|
||||
command['hue'] = int(kwargs[ATTR_HS_COLOR][0] / 360 * 65535)
|
||||
command['sat'] = int(kwargs[ATTR_HS_COLOR][1] / 100 * 255)
|
||||
else:
|
||||
# Philips hue bulb models respond differently to hue/sat
|
||||
# requests, so we convert to XY first to ensure a consistent
|
||||
# color.
|
||||
command['xy'] = color.color_hs_to_xy(*kwargs[ATTR_HS_COLOR])
|
||||
elif ATTR_COLOR_TEMP in kwargs:
|
||||
temp = kwargs[ATTR_COLOR_TEMP]
|
||||
command['ct'] = max(self.min_mireds, min(temp, self.max_mireds))
|
||||
|
|
Loading…
Add table
Reference in a new issue