Not always asume manufacturername is present (#6484)
parent
5e1c74b430
commit
c625e219c7
|
@ -379,7 +379,7 @@ class HueLight(Light):
|
|||
command['transitiontime'] = int(kwargs[ATTR_TRANSITION] * 10)
|
||||
|
||||
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(
|
||||
*kwargs[ATTR_XY_COLOR],
|
||||
ibrightness=self.info['bri'])
|
||||
|
@ -389,7 +389,7 @@ class HueLight(Light):
|
|||
else:
|
||||
command['xy'] = kwargs[ATTR_XY_COLOR]
|
||||
elif ATTR_RGB_COLOR in kwargs:
|
||||
if self.info['manufacturername'] == "OSRAM":
|
||||
if self.info.get('manufacturername') == "OSRAM":
|
||||
hsv = color_util.color_RGB_to_hsv(
|
||||
*(int(val) for val in kwargs[ATTR_RGB_COLOR]))
|
||||
command['hue'] = hsv[0]
|
||||
|
@ -426,7 +426,7 @@ class HueLight(Light):
|
|||
command['hue'] = random.randrange(0, 65535)
|
||||
command['sat'] = random.randrange(150, 254)
|
||||
elif self.bridge_type == 'hue':
|
||||
if self.info['manufacturername'] != "OSRAM":
|
||||
if self.info.get('manufacturername') != "OSRAM":
|
||||
command['effect'] = 'none'
|
||||
|
||||
self._command_func(self.light_id, command)
|
||||
|
|
Loading…
Reference in New Issue