diff --git a/homeassistant/components/axle_energy/config_flow.py b/homeassistant/components/axle_energy/config_flow.py index 2d2772f385af..c547be556541 100644 --- a/homeassistant/components/axle_energy/config_flow.py +++ b/homeassistant/components/axle_energy/config_flow.py @@ -2,7 +2,12 @@ from typing import Any, override -from aioaxlevpp import AxleAuthenticationError, AxleClient, AxleError +from aioaxlevpp import ( + AxleAuthenticationError, + AxleClient, + AxleConnectionError, + AxleError, +) import probatio from homeassistant.config_entries import ConfigFlow, ConfigFlowResult @@ -37,8 +42,10 @@ class AxleConfigFlow(ConfigFlow, domain=DOMAIN): await client.get_event() except AxleAuthenticationError: return {"base": "invalid_auth"} - except AxleError: + except AxleConnectionError: return {"base": "cannot_connect"} + except AxleError: + return {"base": "cannot_retrieve"} return {} @override diff --git a/homeassistant/components/axle_energy/strings.json b/homeassistant/components/axle_energy/strings.json index 79e5dd84542d..468bff368d30 100644 --- a/homeassistant/components/axle_energy/strings.json +++ b/homeassistant/components/axle_energy/strings.json @@ -5,6 +5,7 @@ }, "error": { "cannot_connect": "[%key:common::config_flow::error::cannot_connect%]", + "cannot_retrieve": "[%key:component::axle_energy::exceptions::cannot_connect::message%]", "invalid_auth": "[%key:common::config_flow::error::invalid_auth%]" }, "step": { diff --git a/tests/components/axle_energy/test_config_flow.py b/tests/components/axle_energy/test_config_flow.py index 1faf6ecdf08e..aad671f8372d 100644 --- a/tests/components/axle_energy/test_config_flow.py +++ b/tests/components/axle_energy/test_config_flow.py @@ -36,7 +36,7 @@ async def test_user(hass: HomeAssistant) -> None: [ (AxleAuthenticationError(), "invalid_auth"), (AxleConnectionError(), "cannot_connect"), - (AxleError(), "cannot_connect"), + (AxleError(), "cannot_retrieve"), ], ) async def test_user_errors(