From 194c20765440c601b21696955c5d3c88427f836f Mon Sep 17 00:00:00 2001 From: Alex X Date: Thu, 30 Jan 2025 16:15:10 +0300 Subject: [PATCH] Fix turn_on for TX Ultimate Ambient Light #1369 --- custom_components/sonoff/light.py | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/custom_components/sonoff/light.py b/custom_components/sonoff/light.py index 2aea56f..4641aa0 100644 --- a/custom_components/sonoff/light.py +++ b/custom_components/sonoff/light.py @@ -1230,18 +1230,11 @@ def set_state(self, params: dict): (k for k, v in T5_EFFECTS.items() if v == params["lightMode"]), None ) - async def async_turn_on( - self, brightness: int = None, effect: str = None, **kwargs - ) -> None: - params = {} - - if effect and effect in T5_EFFECTS: - params["lightMode"] = T5_EFFECTS[effect] + async def async_turn_on(self, effect: str = None, **kwargs) -> None: + if value := T5_EFFECTS.get(effect): + await self.ewelink.send(self.device, {"lightMode": value}) - if not params: - params["lightSwitch"] = "on" - - await self.ewelink.send(self.device, params) + await self.ewelink.send(self.device, {"lightSwitch": "on"}) async def async_turn_off(self, **kwargs) -> None: await self.ewelink.send(self.device, {"lightSwitch": "off"})