Fix effects on HUE integration for Osram bulbs (#22789)

* Fix hue effect for others

* New suggestion

* switched implementation to remove colorloop for osram bulbs

* Check ATTR_EFFECT in kwargs

* Fix  tests
This commit is contained in:
Markus Jankowski 2019-05-07 18:53:15 +02:00 committed by Paulus Schoutsen
parent 482cb0146a
commit 264e70922b
2 changed files with 11 additions and 11 deletions

View file

@ -312,6 +312,8 @@ class HueLight(Light):
@property
def effect_list(self):
"""Return the list of supported effects."""
if self.is_osram:
return [EFFECT_RANDOM]
return [EFFECT_COLORLOOP, EFFECT_RANDOM]
@property
@ -371,15 +373,15 @@ class HueLight(Light):
else:
command['alert'] = 'none'
effect = kwargs.get(ATTR_EFFECT)
if effect == EFFECT_COLORLOOP:
command['effect'] = 'colorloop'
elif effect == EFFECT_RANDOM:
command['hue'] = random.randrange(0, 65535)
command['sat'] = random.randrange(150, 254)
elif self.is_philips:
command['effect'] = 'none'
if ATTR_EFFECT in kwargs:
effect = kwargs[ATTR_EFFECT]
if effect == EFFECT_COLORLOOP:
command['effect'] = 'colorloop'
elif effect == EFFECT_RANDOM:
command['hue'] = random.randrange(0, 65535)
command['sat'] = random.randrange(150, 254)
else:
command['effect'] = 'none'
if self.is_group:
await self.light.set_action(**command)