From 779c7a7db78b0da613aba49e836f3a92bfabdabf Mon Sep 17 00:00:00 2001 From: epenet <6771947+epenet@users.noreply.github.com> Date: Mon, 2 Nov 2026 20:43:57 +0100 Subject: [PATCH] Report Freebox connection timeouts as cannot connect (#190079) Co-authored-by: Claude Opus 5.5 --- homeassistant/components/freebox/config_flow.py | 3 ++- tests/components/freebox/test_config_flow.py | 3 +++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/homeassistant/components/freebox/config_flow.py b/homeassistant/components/freebox/config_flow.py index f757952b7aaa..357b4057ace6 100644 --- a/homeassistant/components/freebox/config_flow.py +++ b/homeassistant/components/freebox/config_flow.py @@ -3,6 +3,7 @@ import logging from typing import Any, override +from aiohttp import ClientError from freebox_api.exceptions import AuthorizationError, HttpRequestError import probatio @@ -92,7 +93,7 @@ class FreeboxFlowHandler(ConfigFlow, domain=DOMAIN): # rejected token forever. await async_forget_registration(self.hass, self._data[CONF_HOST]) - except HttpRequestError: + except HttpRequestError, ClientError, TimeoutError: _LOGGER.error( "Error connecting to the Freebox router at %s", self._data[CONF_HOST] ) diff --git a/tests/components/freebox/test_config_flow.py b/tests/components/freebox/test_config_flow.py index 2c1e2a1f074a..de5181263f6a 100644 --- a/tests/components/freebox/test_config_flow.py +++ b/tests/components/freebox/test_config_flow.py @@ -3,6 +3,7 @@ from ipaddress import ip_address from unittest.mock import MagicMock, patch +from aiohttp import ClientConnectionError from freebox_api.exceptions import ( AuthorizationError, HttpRequestError, @@ -187,6 +188,8 @@ async def test_abort_if_already_setup(hass: HomeAssistant) -> None: [ (AuthorizationError, "register_failed"), (HttpRequestError, "cannot_connect"), + (ClientConnectionError, "cannot_connect"), + (TimeoutError, "cannot_connect"), (InvalidTokenError, "unknown"), ], )