mirror of
https://github.com/home-assistant/core.git
synced 2025-08-24 15:01:36 +02:00
use correct exception
This commit is contained in:
@@ -8,6 +8,7 @@ from aioautomower.exceptions import (
|
||||
ApiException,
|
||||
AuthException,
|
||||
HusqvarnaWSServerHandshakeError,
|
||||
TimeoutException,
|
||||
)
|
||||
from aioautomower.model import MowerAttributes
|
||||
from aioautomower.session import AutomowerSession
|
||||
@@ -73,11 +74,16 @@ class AutomowerDataUpdateCoordinator(DataUpdateCoordinator[dict[str, MowerAttrib
|
||||
await automower_client.auth.websocket_connect()
|
||||
await automower_client.start_listening() # Ensure we catch errors here too
|
||||
self.reconnect_time = DEFAULT_RECONNECT_TIME # Reset reconnect time after successful connection
|
||||
except (HusqvarnaWSServerHandshakeError, Exception) as err:
|
||||
except HusqvarnaWSServerHandshakeError as err:
|
||||
_LOGGER.debug(
|
||||
"Failed to connect to websocket. Trying to reconnect: %s",
|
||||
err,
|
||||
)
|
||||
except TimeoutException as err:
|
||||
_LOGGER.debug(
|
||||
"Failed to listen to websocket. Trying to reconnect: %s",
|
||||
err,
|
||||
)
|
||||
if not hass.is_stopping:
|
||||
await asyncio.sleep(self.reconnect_time)
|
||||
self.reconnect_time = min(self.reconnect_time * 2, MAX_WS_RECONNECT_TIME)
|
||||
|
Reference in New Issue
Block a user