Don't close aiohttp session in Overkiz config flow (#68913)

pull/68919/head
Mick Vleeshouwer 2022-03-30 11:40:14 -07:00 committed by GitHub
parent aa6f551b33
commit 6a0a77f986
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 9 deletions

View File

@ -49,15 +49,16 @@ class ConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
server = SUPPORTED_SERVERS[user_input[CONF_HUB]]
session = async_create_clientsession(self.hass)
async with OverkizClient(
client = OverkizClient(
username=username, password=password, server=server, session=session
) as client:
await client.login(register_event_listener=False)
)
# Set first gateway id as unique id
if gateways := await client.get_gateways():
gateway_id = gateways[0].id
await self.async_set_unique_id(gateway_id)
await client.login(register_event_listener=False)
# Set first gateway id as unique id
if gateways := await client.get_gateways():
gateway_id = gateways[0].id
await self.async_set_unique_id(gateway_id)
async def async_step_user(
self, user_input: dict[str, Any] | None = None
@ -139,8 +140,6 @@ class ConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
self, discovery_info: zeroconf.ZeroconfServiceInfo
) -> FlowResult:
"""Handle ZeroConf discovery."""
# abort if we already have exactly this bridge id/host
properties = discovery_info.properties
gateway_id = properties["gateway_pin"]