Skip to content

Commit

Permalink
ensure that the gateway is ready before setup subdevices
Browse files Browse the repository at this point in the history
  • Loading branch information
xZetsubou committed Oct 20, 2023
1 parent 6243fa9 commit e0d93f6
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion custom_components/localtuya/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ async def _make_connection(self):
if self._node_id:
gateway = self._gwateway
self._gwateway = self.get_gateway() if not gateway else gateway
if not self._gwateway.connected:
if not self._gwateway.connected or self._gwateway.is_connecting:
return
self._interface = self._gwateway._interface
self.info(f"Connect Sub Device {name} through gateway {host}")
Expand Down Expand Up @@ -333,6 +333,7 @@ def _new_entity_handler(entity_id):
connect_sub_devices = [
device.async_connect() for device in self._sub_devices.values()
]
self._connect_task = None
await asyncio.gather(*connect_sub_devices)

self._connect_task = None
Expand Down

0 comments on commit e0d93f6

Please sign in to comment.