Skip to content

Commit

Permalink
Fix PingHandler - ConnectResetError
Browse files Browse the repository at this point in the history
  • Loading branch information
ReneNulschDE committed Apr 5, 2024
1 parent 71d2f7b commit 8cd76cb
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions custom_components/mbapi2020/websocket.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ async def async_stop(self):

async def initiatiate_connection_reset(self):
"""Initiate a connection reset."""
self._pingwatchdog.cancel()
if self._connection is not None:
await self._connection.close()

Expand All @@ -167,8 +168,8 @@ async def ping(self):
try:
await self._connection.ping()
await self._pingwatchdog.trigger()
except client_exceptions.ClientError as err:
LOGGER.error("remote websocket connection closed: %s", err)
except (client_exceptions.ClientError, ConnectionResetError):
await self._pingwatchdog.trigger()

async def call(self, message):
"""Send a message to the MB websocket servers."""
Expand Down

0 comments on commit 8cd76cb

Please sign in to comment.