diff --git a/custom_components/volkswagen_we_connect_id/config_flow.py b/custom_components/volkswagen_we_connect_id/config_flow.py index 06fa864..957ebca 100644 --- a/custom_components/volkswagen_we_connect_id/config_flow.py +++ b/custom_components/volkswagen_we_connect_id/config_flow.py @@ -6,6 +6,7 @@ import voluptuous as vol from weconnect import weconnect +from weconnect.errors import AuthentificationError from homeassistant import config_entries from homeassistant.core import HomeAssistant @@ -35,8 +36,6 @@ async def validate_input(hass: HomeAssistant, data: dict[str, Any]) -> dict[str, updatePictures=False, ) - # TODO: ADD Validation on credentials - await hass.async_add_executor_job(we_connect.login) await hass.async_add_executor_job(update, we_connect) @@ -70,7 +69,7 @@ async def async_step_user( info = await validate_input(self.hass, user_input) except CannotConnect: errors["base"] = "cannot_connect" - except InvalidAuth: + except AuthentificationError: errors["base"] = "invalid_auth" except Exception: # pylint: disable=broad-except _LOGGER.exception("Unexpected exception") @@ -85,7 +84,3 @@ async def async_step_user( class CannotConnect(HomeAssistantError): """Error to indicate we cannot connect.""" - - -class InvalidAuth(HomeAssistantError): - """Error to indicate there is invalid auth."""