Always create a new session in ConfigFlow in Overkiz integration (#66602)

This commit is contained in:
Mick Vleeshouwer 2022-02-15 12:46:52 -08:00 committed by GitHub
parent 5568531f74
commit 98ae7e106c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -19,7 +19,7 @@ from homeassistant.components import dhcp, zeroconf
from homeassistant.config_entries import ConfigEntry from homeassistant.config_entries import ConfigEntry
from homeassistant.const import CONF_PASSWORD, CONF_USERNAME from homeassistant.const import CONF_PASSWORD, CONF_USERNAME
from homeassistant.data_entry_flow import FlowResult from homeassistant.data_entry_flow import FlowResult
from homeassistant.helpers.aiohttp_client import async_get_clientsession from homeassistant.helpers.aiohttp_client import async_create_clientsession
from .const import CONF_HUB, DEFAULT_HUB, DOMAIN, LOGGER from .const import CONF_HUB, DEFAULT_HUB, DOMAIN, LOGGER
@ -46,12 +46,11 @@ class ConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
username = user_input[CONF_USERNAME] username = user_input[CONF_USERNAME]
password = user_input[CONF_PASSWORD] password = user_input[CONF_PASSWORD]
server = SUPPORTED_SERVERS[user_input[CONF_HUB]] server = SUPPORTED_SERVERS[user_input[CONF_HUB]]
session = async_get_clientsession(self.hass) session = async_create_clientsession(self.hass)
client = OverkizClient( async with OverkizClient(
username=username, password=password, server=server, session=session username=username, password=password, server=server, session=session
) ) as client:
await client.login() await client.login()
# Set first gateway id as unique id # Set first gateway id as unique id