From 52621f96099f33b4467c14c0f892e8ff920863a1 Mon Sep 17 00:00:00 2001 From: ollo69 <60491700+ollo69@users.noreply.github.com> Date: Thu, 22 Feb 2024 09:53:40 +0100 Subject: [PATCH] Remove reserved UpdateFailed exception in AsusWRT (#110910) * Remove reserved UpdateFailed exception in AsusWRT * Restore UpdateFailed exception in decorator --- homeassistant/components/asuswrt/bridge.py | 10 ++-------- homeassistant/components/asuswrt/config_flow.py | 2 +- homeassistant/components/asuswrt/router.py | 4 ++-- 3 files changed, 5 insertions(+), 11 deletions(-) diff --git a/homeassistant/components/asuswrt/bridge.py b/homeassistant/components/asuswrt/bridge.py index cc06c225d22..cb04ccdec3f 100644 --- a/homeassistant/components/asuswrt/bridge.py +++ b/homeassistant/components/asuswrt/bridge.py @@ -211,10 +211,7 @@ class AsusWrtLegacyBridge(AsusWrtBridge): async def async_get_connected_devices(self) -> dict[str, WrtDevice]: """Get list of connected devices.""" - try: - api_devices = await self._api.async_get_connected_devices() - except OSError as exc: - raise UpdateFailed(exc) from exc + api_devices = await self._api.async_get_connected_devices() return { format_mac(mac): WrtDevice(dev.ip, dev.name, None) for mac, dev in api_devices.items() @@ -343,10 +340,7 @@ class AsusWrtHttpBridge(AsusWrtBridge): async def async_get_connected_devices(self) -> dict[str, WrtDevice]: """Get list of connected devices.""" - try: - api_devices = await self._api.async_get_connected_devices() - except AsusWrtError as exc: - raise UpdateFailed(exc) from exc + api_devices = await self._api.async_get_connected_devices() return { format_mac(mac): WrtDevice(dev.ip, dev.name, dev.node) for mac, dev in api_devices.items() diff --git a/homeassistant/components/asuswrt/config_flow.py b/homeassistant/components/asuswrt/config_flow.py index 047e9b549d8..1e320bdd72d 100644 --- a/homeassistant/components/asuswrt/config_flow.py +++ b/homeassistant/components/asuswrt/config_flow.py @@ -216,7 +216,7 @@ class AsusWrtFlowHandler(ConfigFlow, domain=DOMAIN): if error is not None: return error, None - _LOGGER.info( + _LOGGER.debug( "Successfully connected to the AsusWrt router at %s using protocol %s", host, protocol, diff --git a/homeassistant/components/asuswrt/router.py b/homeassistant/components/asuswrt/router.py index 927eef572f7..d868065be47 100644 --- a/homeassistant/components/asuswrt/router.py +++ b/homeassistant/components/asuswrt/router.py @@ -20,7 +20,7 @@ from homeassistant.helpers import entity_registry as er from homeassistant.helpers.device_registry import DeviceInfo, format_mac from homeassistant.helpers.dispatcher import async_dispatcher_send from homeassistant.helpers.event import async_track_time_interval -from homeassistant.helpers.update_coordinator import DataUpdateCoordinator, UpdateFailed +from homeassistant.helpers.update_coordinator import DataUpdateCoordinator from homeassistant.util import dt as dt_util, slugify from .bridge import AsusWrtBridge, WrtDevice @@ -276,7 +276,7 @@ class AsusWrtRouter: _LOGGER.debug("Checking devices for ASUS router %s", self.host) try: wrt_devices = await self._api.async_get_connected_devices() - except UpdateFailed as exc: + except (OSError, AsusWrtError) as exc: if not self._connect_error: self._connect_error = True _LOGGER.error(