mirror of
https://github.com/python-kasa/python-kasa.git
synced 2025-08-06 10:44:04 +00:00
Fix iot light effect brightness (#1092)
Fixes issue where the brightness of the `iot` light effect is set properly on the light effect but read back incorrectly from the light.
This commit is contained in:
@@ -106,14 +106,23 @@ class LightStripEffect(SmartModule, SmartLightEffect):
|
||||
"""
|
||||
brightness_module = self._device.modules[Module.Brightness]
|
||||
if effect == self.LIGHT_EFFECTS_OFF:
|
||||
state = self._device.modules[Module.Light].state
|
||||
await self._device.modules[Module.Light].set_state(state)
|
||||
if self.effect in self._effect_mapping:
|
||||
# TODO: We could query get_lighting_effect here to
|
||||
# get the custom effect although not sure how to find
|
||||
# custom effects
|
||||
effect_dict = self._effect_mapping[self.effect]
|
||||
else:
|
||||
effect_dict = self._effect_mapping["Aurora"]
|
||||
effect_dict = {**effect_dict}
|
||||
effect_dict["enable"] = 0
|
||||
await self.set_custom_effect(effect_dict)
|
||||
return
|
||||
|
||||
if effect not in self._effect_mapping:
|
||||
raise ValueError(f"The effect {effect} is not a built in effect.")
|
||||
else:
|
||||
effect_dict = self._effect_mapping[effect]
|
||||
effect_dict = {**effect_dict}
|
||||
|
||||
# Use explicitly given brightness
|
||||
if brightness is not None:
|
||||
|
Reference in New Issue
Block a user