mirror of
https://github.com/python-kasa/python-kasa.git
synced 2025-08-06 10:44:04 +00:00
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:
@@ -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:
|
||||
|
Reference in New Issue
Block a user