diff --git a/homeassistant/components/vodafone_station/config_flow.py b/homeassistant/components/vodafone_station/config_flow.py index e4a087f6903..45bb263d371 100644 --- a/homeassistant/components/vodafone_station/config_flow.py +++ b/homeassistant/components/vodafone_station/config_flow.py @@ -68,10 +68,14 @@ class VodafoneStationConfigFlow(ConfigFlow, domain=DOMAIN): try: info = await validate_input(self.hass, user_input) + except aiovodafone_exceptions.AlreadyLogged: + errors["base"] = "already_logged" except aiovodafone_exceptions.CannotConnect: errors["base"] = "cannot_connect" except aiovodafone_exceptions.CannotAuthenticate: errors["base"] = "invalid_auth" + except aiovodafone_exceptions.ModelNotSupported: + errors["base"] = "model_not_supported" except Exception: # pylint: disable=broad-except _LOGGER.exception("Unexpected exception") errors["base"] = "unknown" @@ -99,6 +103,8 @@ class VodafoneStationConfigFlow(ConfigFlow, domain=DOMAIN): if user_input is not None: try: await validate_input(self.hass, {**self.entry.data, **user_input}) + except aiovodafone_exceptions.AlreadyLogged: + errors["base"] = "already_logged" except aiovodafone_exceptions.CannotConnect: errors["base"] = "cannot_connect" except aiovodafone_exceptions.CannotAuthenticate: diff --git a/homeassistant/components/vodafone_station/strings.json b/homeassistant/components/vodafone_station/strings.json index 0c2a4a408dd..d0dcb46fd10 100644 --- a/homeassistant/components/vodafone_station/strings.json +++ b/homeassistant/components/vodafone_station/strings.json @@ -12,21 +12,24 @@ "data": { "host": "[%key:common::config_flow::data::host%]", "username": "[%key:common::config_flow::data::username%]", - "password": "[%key:common::config_flow::data::password%]", - "ssl": "[%key:common::config_flow::data::ssl%]" + "password": "[%key:common::config_flow::data::password%]" } } }, "abort": { "already_configured": "[%key:common::config_flow::abort::already_configured_service%]", + "already_logged": "User already logged-in, please try again later.", "reauth_successful": "[%key:common::config_flow::abort::reauth_successful%]", "cannot_connect": "[%key:common::config_flow::error::cannot_connect%]", "invalid_auth": "[%key:common::config_flow::error::invalid_auth%]", + "model_not_supported": "The device model is currently unsupported.", "unknown": "[%key:common::config_flow::error::unknown%]" }, "error": { + "already_logged": "User already logged-in, please try again later.", "cannot_connect": "[%key:common::config_flow::error::cannot_connect%]", "invalid_auth": "[%key:common::config_flow::error::invalid_auth%]", + "model_not_supported": "The device model is currently unsupported.", "unknown": "[%key:common::config_flow::error::unknown%]" } }, diff --git a/tests/components/vodafone_station/test_config_flow.py b/tests/components/vodafone_station/test_config_flow.py index 3d2ef0cf568..41efd8af00c 100644 --- a/tests/components/vodafone_station/test_config_flow.py +++ b/tests/components/vodafone_station/test_config_flow.py @@ -52,6 +52,8 @@ async def test_user(hass: HomeAssistant) -> None: [ (aiovodafone_exceptions.CannotConnect, "cannot_connect"), (aiovodafone_exceptions.CannotAuthenticate, "invalid_auth"), + (aiovodafone_exceptions.AlreadyLogged, "already_logged"), + (aiovodafone_exceptions.ModelNotSupported, "model_not_supported"), (ConnectionResetError, "unknown"), ], ) @@ -152,6 +154,7 @@ async def test_reauth_successful(hass: HomeAssistant) -> None: [ (aiovodafone_exceptions.CannotConnect, "cannot_connect"), (aiovodafone_exceptions.CannotAuthenticate, "invalid_auth"), + (aiovodafone_exceptions.AlreadyLogged, "already_logged"), (ConnectionResetError, "unknown"), ], )