Skip to content

Commit

Permalink
Suez_water: close session after config flow (#132714)
Browse files Browse the repository at this point in the history
  • Loading branch information
jb101010-2 authored Dec 9, 2024
1 parent b1c1733 commit f210b74
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions homeassistant/components/suez_water/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down

0 comments on commit f210b74

Please sign in to comment.