Add LightEffect module for smart light strips (#918)

Implements the `light_strip_lighting_effect` components for
`smart` devices. Uses a new list of effects captured from a L900 which
are similar to the `iot` effects but include some additional properties
and a few extra effects.

Assumes that a device only implements `light_strip_lighting_effect` or
`light_effect` but not both.
This commit is contained in:
Steven B
2024-05-15 06:16:57 +01:00
committed by GitHub
parent 67b5d7de83
commit 133a839f22
8 changed files with 572 additions and 19 deletions

View File

@@ -21,13 +21,11 @@ class LightEffect(IotModule, LightEffectInterface):
'id': '',
'name': ''}
"""
if (
(state := self.data.get("lighting_effect_state"))
and state.get("enable")
and (name := state.get("name"))
and name in EFFECT_NAMES_V1
):
eff = self.data["lighting_effect_state"]
name = eff["name"]
if eff["enable"]:
return name
return self.LIGHT_EFFECTS_OFF
@property
@@ -67,6 +65,7 @@ class LightEffect(IotModule, LightEffectInterface):
raise ValueError(f"The effect {effect} is not a built in effect.")
else:
effect_dict = EFFECT_MAPPING_V1[effect]
if brightness is not None:
effect_dict["brightness"] = brightness
if transition is not None: