Skip to content

Commit 194c207

Browse files
committed
Fix turn_on for TX Ultimate Ambient Light #1369
1 parent 23b1d2a commit 194c207

File tree

1 file changed

+4
-11
lines changed

1 file changed

+4
-11
lines changed

custom_components/sonoff/light.py

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1230,18 +1230,11 @@ def set_state(self, params: dict):
12301230
(k for k, v in T5_EFFECTS.items() if v == params["lightMode"]), None
12311231
)
12321232

1233-
async def async_turn_on(
1234-
self, brightness: int = None, effect: str = None, **kwargs
1235-
) -> None:
1236-
params = {}
1237-
1238-
if effect and effect in T5_EFFECTS:
1239-
params["lightMode"] = T5_EFFECTS[effect]
1233+
async def async_turn_on(self, effect: str = None, **kwargs) -> None:
1234+
if value := T5_EFFECTS.get(effect):
1235+
await self.ewelink.send(self.device, {"lightMode": value})
12401236

1241-
if not params:
1242-
params["lightSwitch"] = "on"
1243-
1244-
await self.ewelink.send(self.device, params)
1237+
await self.ewelink.send(self.device, {"lightSwitch": "on"})
12451238

12461239
async def async_turn_off(self, **kwargs) -> None:
12471240
await self.ewelink.send(self.device, {"lightSwitch": "off"})

0 commit comments

Comments
 (0)