Don't close HA aiohttp session in Overkiz Config Flow (#64052)

This commit is contained in:
Mick Vleeshouwer 2022-01-13 12:35:07 -08:00 committed by GitHub
parent 4bdc0c7120
commit 3fcdaa8a5d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 12 additions and 14 deletions

View File

@ -38,18 +38,16 @@ class ConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
server = SUPPORTED_SERVERS[user_input[CONF_HUB]] server = SUPPORTED_SERVERS[user_input[CONF_HUB]]
session = async_get_clientsession(self.hass) session = async_get_clientsession(self.hass)
async with OverkizClient( client = OverkizClient(
username=username, username=username, password=password, server=server, session=session
password=password, )
server=server,
session=session,
) as client:
await client.login()
# Set first gateway as unique id await client.login()
if gateways := await client.get_gateways():
gateway_id = gateways[0].id # Set first gateway id as unique id
await self.async_set_unique_id(gateway_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( async def async_step_user(
self, user_input: dict[str, Any] | None = None self, user_input: dict[str, Any] | None = None

View File

@ -4,7 +4,7 @@
"config_flow": true, "config_flow": true,
"documentation": "https://www.home-assistant.io/integrations/overkiz", "documentation": "https://www.home-assistant.io/integrations/overkiz",
"requirements": [ "requirements": [
"pyoverkiz==1.1.0" "pyoverkiz==1.1.1"
], ],
"dhcp": [ "dhcp": [
{ {

View File

@ -1740,7 +1740,7 @@ pyotgw==1.1b1
pyotp==2.6.0 pyotp==2.6.0
# homeassistant.components.overkiz # homeassistant.components.overkiz
pyoverkiz==1.1.0 pyoverkiz==1.1.1
# homeassistant.components.openweathermap # homeassistant.components.openweathermap
pyowm==3.2.0 pyowm==3.2.0

View File

@ -1097,7 +1097,7 @@ pyotgw==1.1b1
pyotp==2.6.0 pyotp==2.6.0
# homeassistant.components.overkiz # homeassistant.components.overkiz
pyoverkiz==1.1.0 pyoverkiz==1.1.1
# homeassistant.components.openweathermap # homeassistant.components.openweathermap
pyowm==3.2.0 pyowm==3.2.0