mirror of
https://github.com/home-assistant/core.git
synced 2025-07-22 20:57:21 +00:00
Suez_water: close session after config flow (#132714)
This commit is contained in:
parent
b1c17334f6
commit
f210b74790
@ -37,16 +37,19 @@ async def validate_input(data: dict[str, Any]) -> None:
|
|||||||
data[CONF_PASSWORD],
|
data[CONF_PASSWORD],
|
||||||
counter_id,
|
counter_id,
|
||||||
)
|
)
|
||||||
if not await client.check_credentials():
|
|
||||||
raise InvalidAuth
|
|
||||||
except PySuezError as ex:
|
|
||||||
raise CannotConnect from ex
|
|
||||||
|
|
||||||
if counter_id is None:
|
|
||||||
try:
|
try:
|
||||||
data[CONF_COUNTER_ID] = await client.find_counter()
|
if not await client.check_credentials():
|
||||||
|
raise InvalidAuth
|
||||||
except PySuezError as ex:
|
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):
|
class SuezWaterConfigFlow(ConfigFlow, domain=DOMAIN):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user