Add lighting effects to Hue lights managed by deCONZ (#128292)
* Add more effects for Philips Hue lights * Update tests for light effects
This commit is contained in:
parent
ff6261ccc8
commit
a815661de1
3 changed files with 40 additions and 6 deletions
|
@ -39,7 +39,22 @@ from .hub import DeconzHub
|
|||
DECONZ_GROUP = "is_deconz_group"
|
||||
EFFECT_TO_DECONZ = {
|
||||
EFFECT_COLORLOOP: LightEffect.COLOR_LOOP,
|
||||
"None": LightEffect.NONE,
|
||||
"none": LightEffect.NONE,
|
||||
# Specific to Philips Hue
|
||||
"candle": LightEffect.CANDLE,
|
||||
"cosmos": LightEffect.COSMOS,
|
||||
"enchant": LightEffect.ENCHANT,
|
||||
"fire": LightEffect.FIRE,
|
||||
"fireplace": LightEffect.FIREPLACE,
|
||||
"glisten": LightEffect.GLISTEN,
|
||||
"loop": LightEffect.LOOP,
|
||||
"opal": LightEffect.OPAL,
|
||||
"prism": LightEffect.PRISM,
|
||||
"sparkle": LightEffect.SPARKLE,
|
||||
"sunbeam": LightEffect.SUNBEAM,
|
||||
"sunrise": LightEffect.SUNRISE,
|
||||
"sunset": LightEffect.SUNSET,
|
||||
"underwater": LightEffect.UNDERWATER,
|
||||
# Specific to Lidl christmas light
|
||||
"carnival": LightEffect.CARNIVAL,
|
||||
"collide": LightEffect.COLLIDE,
|
||||
|
@ -208,8 +223,17 @@ class DeconzBaseLight[_LightDeviceT: Group | Light](
|
|||
if device.effect is not None:
|
||||
self._attr_supported_features |= LightEntityFeature.EFFECT
|
||||
self._attr_effect_list = [EFFECT_COLORLOOP]
|
||||
if device.model_id in ("HG06467", "TS0601"):
|
||||
self._attr_effect_list = XMAS_LIGHT_EFFECTS
|
||||
|
||||
# For lights that report supported effects.
|
||||
if isinstance(device, Light):
|
||||
if device.supported_effects is not None:
|
||||
self._attr_effect_list = [
|
||||
EFFECT_TO_DECONZ[el]
|
||||
for el in device.supported_effects
|
||||
if el in EFFECT_TO_DECONZ
|
||||
]
|
||||
if device.model_id in ("HG06467", "TS0601"):
|
||||
self._attr_effect_list = XMAS_LIGHT_EFFECTS
|
||||
|
||||
@property
|
||||
def color_mode(self) -> str | None:
|
||||
|
|
|
@ -1400,7 +1400,12 @@
|
|||
'area_id': None,
|
||||
'capabilities': dict({
|
||||
'effect_list': list([
|
||||
'colorloop',
|
||||
<LightEffect.NONE: 'none'>,
|
||||
<LightEffect.COLOR_LOOP: 'colorloop'>,
|
||||
<LightEffect.CANDLE: 'candle'>,
|
||||
<LightEffect.FIREPLACE: 'fireplace'>,
|
||||
<LightEffect.PRISM: 'prism'>,
|
||||
<LightEffect.SUNRISE: 'sunrise'>,
|
||||
]),
|
||||
'max_color_temp_kelvin': 6535,
|
||||
'max_mireds': 500,
|
||||
|
@ -1448,7 +1453,12 @@
|
|||
'color_temp_kelvin': None,
|
||||
'effect': None,
|
||||
'effect_list': list([
|
||||
'colorloop',
|
||||
<LightEffect.NONE: 'none'>,
|
||||
<LightEffect.COLOR_LOOP: 'colorloop'>,
|
||||
<LightEffect.CANDLE: 'candle'>,
|
||||
<LightEffect.FIREPLACE: 'fireplace'>,
|
||||
<LightEffect.PRISM: 'prism'>,
|
||||
<LightEffect.SUNRISE: 'sunrise'>,
|
||||
]),
|
||||
'friendly_name': 'Gradient light',
|
||||
'hs_color': tuple(
|
||||
|
|
|
@ -413,7 +413,7 @@ async def test_light_state_change(
|
|||
ATTR_ENTITY_ID: "light.hue_go",
|
||||
ATTR_XY_COLOR: (0.411, 0.351),
|
||||
ATTR_FLASH: FLASH_LONG,
|
||||
ATTR_EFFECT: "None",
|
||||
ATTR_EFFECT: "none",
|
||||
},
|
||||
},
|
||||
{
|
||||
|
|
Loading…
Add table
Reference in a new issue