Not always asume manufacturername is present (#6484)
This commit is contained in:
parent
5e1c74b430
commit
c625e219c7
1 changed files with 3 additions and 3 deletions
|
@ -379,7 +379,7 @@ class HueLight(Light):
|
||||||
command['transitiontime'] = int(kwargs[ATTR_TRANSITION] * 10)
|
command['transitiontime'] = int(kwargs[ATTR_TRANSITION] * 10)
|
||||||
|
|
||||||
if ATTR_XY_COLOR in kwargs:
|
if ATTR_XY_COLOR in kwargs:
|
||||||
if self.info['manufacturername'] == "OSRAM":
|
if self.info.get('manufacturername') == "OSRAM":
|
||||||
hsv = color_util.color_xy_brightness_to_hsv(
|
hsv = color_util.color_xy_brightness_to_hsv(
|
||||||
*kwargs[ATTR_XY_COLOR],
|
*kwargs[ATTR_XY_COLOR],
|
||||||
ibrightness=self.info['bri'])
|
ibrightness=self.info['bri'])
|
||||||
|
@ -389,7 +389,7 @@ class HueLight(Light):
|
||||||
else:
|
else:
|
||||||
command['xy'] = kwargs[ATTR_XY_COLOR]
|
command['xy'] = kwargs[ATTR_XY_COLOR]
|
||||||
elif ATTR_RGB_COLOR in kwargs:
|
elif ATTR_RGB_COLOR in kwargs:
|
||||||
if self.info['manufacturername'] == "OSRAM":
|
if self.info.get('manufacturername') == "OSRAM":
|
||||||
hsv = color_util.color_RGB_to_hsv(
|
hsv = color_util.color_RGB_to_hsv(
|
||||||
*(int(val) for val in kwargs[ATTR_RGB_COLOR]))
|
*(int(val) for val in kwargs[ATTR_RGB_COLOR]))
|
||||||
command['hue'] = hsv[0]
|
command['hue'] = hsv[0]
|
||||||
|
@ -426,7 +426,7 @@ class HueLight(Light):
|
||||||
command['hue'] = random.randrange(0, 65535)
|
command['hue'] = random.randrange(0, 65535)
|
||||||
command['sat'] = random.randrange(150, 254)
|
command['sat'] = random.randrange(150, 254)
|
||||||
elif self.bridge_type == 'hue':
|
elif self.bridge_type == 'hue':
|
||||||
if self.info['manufacturername'] != "OSRAM":
|
if self.info.get('manufacturername') != "OSRAM":
|
||||||
command['effect'] = 'none'
|
command['effect'] = 'none'
|
||||||
|
|
||||||
self._command_func(self.light_id, command)
|
self._command_func(self.light_id, command)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue