From b10ce492226b47cca0878fa84277efc748b03986 Mon Sep 17 00:00:00 2001 From: Thomas Protzner Date: Mon, 12 Aug 2024 17:14:19 +0000 Subject: [PATCH] use correct exception --- .../components/husqvarna_automower/coordinator.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/homeassistant/components/husqvarna_automower/coordinator.py b/homeassistant/components/husqvarna_automower/coordinator.py index de6e9441d7c..6faa9a88927 100644 --- a/homeassistant/components/husqvarna_automower/coordinator.py +++ b/homeassistant/components/husqvarna_automower/coordinator.py @@ -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)