From c149011e4c1f8e39ce32f418e1eb9ee0897bfd9f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florent=20Thi=C3=A9ry?= Date: Mon, 21 Aug 2023 11:02:14 +0200 Subject: [PATCH 1/3] consider Freebox router does not support Raid if the first enumeration raised an http error, fixes #98274 --- homeassistant/components/freebox/router.py | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/homeassistant/components/freebox/router.py b/homeassistant/components/freebox/router.py index 6111eb85b4cd72..5a333eabe3f2b4 100644 --- a/homeassistant/components/freebox/router.py +++ b/homeassistant/components/freebox/router.py @@ -71,6 +71,7 @@ def __init__( self.devices: dict[str, dict[str, Any]] = {} self.disks: dict[int, dict[str, Any]] = {} + self.supports_raid = True self.raids: dict[int, dict[str, Any]] = {} self.sensors_temperature: dict[str, int] = {} self.sensors_connection: dict[str, float] = {} @@ -159,14 +160,20 @@ async def _update_disks_sensors(self) -> None: async def _update_raids_sensors(self) -> None: """Update Freebox raids.""" - # None at first request + if not self.supports_raid: + return + try: fbx_raids: list[dict[str, Any]] = await self._api.storage.get_raids() or [] except HttpRequestError: - _LOGGER.warning("Unable to enumerate raid disks") - else: - for fbx_raid in fbx_raids: - self.raids[fbx_raid["id"]] = fbx_raid + self.supports_raid = False + _LOGGER.warning( + "This router model apparently does not support raid, will not enumerate further" + ) + return + + for fbx_raid in fbx_raids: + self.raids[fbx_raid["id"]] = fbx_raid async def update_home_devices(self) -> None: """Update Home devices (alarm, light, sensor, switch, remote ...).""" From 147c1a62b8280b3afa85462200554e7739f83f22 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florent=20Thi=C3=A9ry?= Date: Mon, 21 Aug 2023 13:19:28 +0200 Subject: [PATCH 2/3] add router name to warning message --- homeassistant/components/freebox/router.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/homeassistant/components/freebox/router.py b/homeassistant/components/freebox/router.py index 5a333eabe3f2b4..9c76650158c8c6 100644 --- a/homeassistant/components/freebox/router.py +++ b/homeassistant/components/freebox/router.py @@ -168,7 +168,8 @@ async def _update_raids_sensors(self) -> None: except HttpRequestError: self.supports_raid = False _LOGGER.warning( - "This router model apparently does not support raid, will not enumerate further" + "Router %s API does not seem to support raid, will not enumerate further", + self.name, ) return From 71253e1a71eea0907dad48a0d5c23789b59063b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florent=20Thi=C3=A9ry?= Date: Mon, 21 Aug 2023 16:30:20 +0200 Subject: [PATCH 3/3] reduce log level to info, remove details --- homeassistant/components/freebox/router.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/homeassistant/components/freebox/router.py b/homeassistant/components/freebox/router.py index 9c76650158c8c6..f42a386087fe55 100644 --- a/homeassistant/components/freebox/router.py +++ b/homeassistant/components/freebox/router.py @@ -167,8 +167,8 @@ async def _update_raids_sensors(self) -> None: fbx_raids: list[dict[str, Any]] = await self._api.storage.get_raids() or [] except HttpRequestError: self.supports_raid = False - _LOGGER.warning( - "Router %s API does not seem to support raid, will not enumerate further", + _LOGGER.info( + "Router %s API does not support RAID", self.name, ) return