mirror of
https://github.com/home-assistant/core.git
synced 2025-07-16 09:47:13 +00: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:
parent
2956eb0902
commit
984fb12fa4
@ -133,7 +133,8 @@ async def async_setup_entry(hass, config_entry):
|
|||||||
"""Set up Tesla as config entry."""
|
"""Set up Tesla as config entry."""
|
||||||
hass.data.setdefault(DOMAIN, {})
|
hass.data.setdefault(DOMAIN, {})
|
||||||
config = config_entry.data
|
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
|
email = config_entry.title
|
||||||
if email in hass.data[DOMAIN] and CONF_SCAN_INTERVAL in hass.data[DOMAIN][email]:
|
if email in hass.data[DOMAIN] and CONF_SCAN_INTERVAL in hass.data[DOMAIN][email]:
|
||||||
scan_interval = hass.data[DOMAIN][email][CONF_SCAN_INTERVAL]
|
scan_interval = hass.data[DOMAIN][email][CONF_SCAN_INTERVAL]
|
||||||
|
@ -147,7 +147,8 @@ async def validate_input(hass: core.HomeAssistant, data):
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
config = {}
|
config = {}
|
||||||
websession = aiohttp_client.async_get_clientsession(hass)
|
websession = aiohttp_client.async_create_clientsession(hass)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
controller = TeslaAPI(
|
controller = TeslaAPI(
|
||||||
websession,
|
websession,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user