Skip to content

Commit

Permalink
Fix multichannel switches in some cases #1368
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexxIT committed Apr 26, 2024
1 parent e4821f4 commit a716ddd
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions custom_components/sonoff/core/ewelink/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,12 +158,15 @@ async def send_bulk(self, device: XDevice, params: dict):
break
else:
device["params_bulk"]["switches"].append(new)
return
else:
device["params_bulk"] = params

device["params_bulk"] = params
await asyncio.sleep(0.1)

return await self.send(device, device.pop("params_bulk"))
# this can be called from different threads/loops
# https://github.com/AlexxIT/SonoffLAN/issues/1368
if params := device.pop("params_bulk"):
return await self.send(device, params)

async def send_cloud(self, device: XDevice, params: dict = None, query=True):
if not self.can_cloud(device):
Expand Down

0 comments on commit a716ddd

Please sign in to comment.