Clarify Axle Energy API error messages (#182569)

This commit is contained in:
Anthony
2026-09-18 14:57:42 +00:00
committed by GitHub
parent 988d09b6a3
commit ff59823e3c
3 changed files with 11 additions and 3 deletions
@@ -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
@@ -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": {
@@ -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(