mirror of
https://github.com/home-assistant/core.git
synced 2025-08-04 05:05:09 +02:00
Suez_water: close session after config flow (#132714)
This commit is contained in:
@@ -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):
|
||||
|
Reference in New Issue
Block a user