From a99f6f71249180ea5a6766b0d1c38666906546cb Mon Sep 17 00:00:00 2001 From: Aidan Timson Date: Tue, 14 Mar 2023 00:55:37 +0000 Subject: [PATCH] Handle ConnectionClosedException from System Bridge (#89654) Handle unretrieved ConnectionClosedException from System Bridge --- .../components/system_bridge/coordinator.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/homeassistant/components/system_bridge/coordinator.py b/homeassistant/components/system_bridge/coordinator.py index 320c09a6f07..2810bcfac72 100644 --- a/homeassistant/components/system_bridge/coordinator.py +++ b/homeassistant/components/system_bridge/coordinator.py @@ -186,6 +186,12 @@ class SystemBridgeDataUpdateCoordinator( await self.websocket_client.connect( session=async_get_clientsession(self.hass), ) + + self.hass.async_create_task(self._listen_for_data()) + + await self.websocket_client.register_data_listener( + RegisterDataListener(modules=MODULES) + ) except AuthenticationException as exception: self.last_update_success = False self.logger.error("Authentication failed for %s: %s", self.title, exception) @@ -211,12 +217,6 @@ class SystemBridgeDataUpdateCoordinator( self.last_update_success = False self.async_update_listeners() - self.hass.async_create_task(self._listen_for_data()) - - await self.websocket_client.register_data_listener( - RegisterDataListener(modules=MODULES) - ) - self.last_update_success = True self.async_update_listeners()