mirror of
https://github.com/home-assistant/core.git
synced 2025-05-04 05:59:16 +00:00
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:
parent
482cb0146a
commit
264e70922b
@ -312,6 +312,8 @@ class HueLight(Light):
|
|||||||
@property
|
@property
|
||||||
def effect_list(self):
|
def effect_list(self):
|
||||||
"""Return the list of supported effects."""
|
"""Return the list of supported effects."""
|
||||||
|
if self.is_osram:
|
||||||
|
return [EFFECT_RANDOM]
|
||||||
return [EFFECT_COLORLOOP, EFFECT_RANDOM]
|
return [EFFECT_COLORLOOP, EFFECT_RANDOM]
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@ -371,15 +373,15 @@ class HueLight(Light):
|
|||||||
else:
|
else:
|
||||||
command['alert'] = 'none'
|
command['alert'] = 'none'
|
||||||
|
|
||||||
effect = kwargs.get(ATTR_EFFECT)
|
if ATTR_EFFECT in kwargs:
|
||||||
|
effect = kwargs[ATTR_EFFECT]
|
||||||
if effect == EFFECT_COLORLOOP:
|
if effect == EFFECT_COLORLOOP:
|
||||||
command['effect'] = 'colorloop'
|
command['effect'] = 'colorloop'
|
||||||
elif effect == EFFECT_RANDOM:
|
elif effect == EFFECT_RANDOM:
|
||||||
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.is_philips:
|
else:
|
||||||
command['effect'] = 'none'
|
command['effect'] = 'none'
|
||||||
|
|
||||||
if self.is_group:
|
if self.is_group:
|
||||||
await self.light.set_action(**command)
|
await self.light.set_action(**command)
|
||||||
|
@ -640,7 +640,6 @@ async def test_light_turn_on_service(hass, mock_bridge):
|
|||||||
'bri': 100,
|
'bri': 100,
|
||||||
'on': True,
|
'on': True,
|
||||||
'ct': 300,
|
'ct': 300,
|
||||||
'effect': 'none',
|
|
||||||
'alert': 'none',
|
'alert': 'none',
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -661,7 +660,6 @@ async def test_light_turn_on_service(hass, mock_bridge):
|
|||||||
assert mock_bridge.mock_requests[3]['json'] == {
|
assert mock_bridge.mock_requests[3]['json'] == {
|
||||||
'on': True,
|
'on': True,
|
||||||
'xy': (0.138, 0.08),
|
'xy': (0.138, 0.08),
|
||||||
'effect': 'none',
|
|
||||||
'alert': 'none',
|
'alert': 'none',
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user