Skip to content

Commit 36a7295

Browse files
fix: connection timeouts
1 parent fa2f37f commit 36a7295

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

roborock/local_api.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,17 +48,19 @@ async def async_connect(self) -> None:
4848
async with self._mutex:
4949
try:
5050
if not self.is_connected():
51+
self.sync_disconnect()
5152
async with async_timeout.timeout(QUEUE_TIMEOUT):
5253
_LOGGER.info(f"Connecting to {self.host}")
5354
self.transport, _ = await self.loop.create_connection( # type: ignore
5455
lambda: self, self.host, 58867
5556
)
5657
_LOGGER.info(f"Connected to {self.host}")
5758
except Exception as e:
59+
_LOGGER.warning(f"Failed connecting to {self.host}: {e}")
5860
raise RoborockConnectionException(f"Failed connecting to {self.host}") from e
5961

6062
def sync_disconnect(self) -> None:
61-
if self.transport and not self.loop.is_closed():
63+
if self.transport:
6264
self.transport.close()
6365

6466
async def async_disconnect(self) -> None:

0 commit comments

Comments
 (0)