mirror of
https://github.com/home-assistant/core.git
synced 2026-10-07 06:50:41 -04:00
Create new websession if more than one entry in Tesla (#47886)
* Create new websession if more than one entry closes #47506 * Remove extraneous count * Always create new session * Update docs
This commit is contained in:
@@ -133,7 +133,8 @@ async def async_setup_entry(hass, config_entry):
|
||||
"""Set up Tesla as config entry."""
|
||||
hass.data.setdefault(DOMAIN, {})
|
||||
config = config_entry.data
|
||||
websession = aiohttp_client.async_get_clientsession(hass)
|
||||
# Because users can have multiple accounts, we always create a new session so they have separate cookies
|
||||
websession = aiohttp_client.async_create_clientsession(hass)
|
||||
email = config_entry.title
|
||||
if email in hass.data[DOMAIN] and CONF_SCAN_INTERVAL in hass.data[DOMAIN][email]:
|
||||
scan_interval = hass.data[DOMAIN][email][CONF_SCAN_INTERVAL]
|
||||
|
||||
@@ -147,7 +147,8 @@ async def validate_input(hass: core.HomeAssistant, data):
|
||||
"""
|
||||
|
||||
config = {}
|
||||
websession = aiohttp_client.async_get_clientsession(hass)
|
||||
websession = aiohttp_client.async_create_clientsession(hass)
|
||||
|
||||
try:
|
||||
controller = TeslaAPI(
|
||||
websession,
|
||||
|
||||
Reference in New Issue
Block a user