From 4328f887be6fb67b76630f656396d52ecbff2fd3 Mon Sep 17 00:00:00 2001 From: Simone Chemelli Date: Wed, 25 Oct 2023 11:19:06 +0200 Subject: [PATCH] Address late review comments for Comelit login (#102768) --- homeassistant/components/comelit/coordinator.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/homeassistant/components/comelit/coordinator.py b/homeassistant/components/comelit/coordinator.py index 68592ad6ccc..d3bc973429b 100644 --- a/homeassistant/components/comelit/coordinator.py +++ b/homeassistant/components/comelit/coordinator.py @@ -68,15 +68,13 @@ class ComelitSerialBridge(DataUpdateCoordinator): async def _async_update_data(self) -> dict[str, Any]: """Update device data.""" _LOGGER.debug("Polling Comelit Serial Bridge host: %s", self._host) - logged = False try: - logged = await self.api.login() + await self.api.login() except exceptions.CannotConnect as err: _LOGGER.warning("Connection error for %s", self._host) await self.api.close() raise UpdateFailed(f"Error fetching data: {repr(err)}") from err - finally: - if not logged: - raise ConfigEntryAuthFailed + except exceptions.CannotAuthenticate: + raise ConfigEntryAuthFailed return await self.api.get_all_devices()