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:
Steven B.
2024-07-31 15:58:48 +01:00
committed by GitHub
parent cb0077f634
commit 31ec27c1c8
8 changed files with 101 additions and 37 deletions

View File

@@ -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: