diff --git a/homeassistant/components/suez_water/config_flow.py b/homeassistant/components/suez_water/config_flow.py index ac09cf4a1d3bea..2a1edea35f1480 100644 --- a/homeassistant/components/suez_water/config_flow.py +++ b/homeassistant/components/suez_water/config_flow.py @@ -37,16 +37,19 @@ async def validate_input(data: dict[str, Any]) -> None: data[CONF_PASSWORD], counter_id, ) - if not await client.check_credentials(): - raise InvalidAuth - except PySuezError as ex: - raise CannotConnect from ex - - if counter_id is None: try: - data[CONF_COUNTER_ID] = await client.find_counter() + if not await client.check_credentials(): + raise InvalidAuth except PySuezError as ex: - raise CounterNotFound from ex + raise CannotConnect from ex + + if counter_id is None: + try: + data[CONF_COUNTER_ID] = await client.find_counter() + except PySuezError as ex: + raise CounterNotFound from ex + finally: + await client.close_session() class SuezWaterConfigFlow(ConfigFlow, domain=DOMAIN):