mirror of
https://github.com/home-assistant/core.git
synced 2025-07-26 06:37:52 +00:00
Mitigate session closed error in Netgear LTE (#110412)
This commit is contained in:
parent
d4a2dc7116
commit
2ac7d11b8d
@ -212,7 +212,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
||||
host = entry.data[CONF_HOST]
|
||||
password = entry.data[CONF_PASSWORD]
|
||||
|
||||
if DOMAIN not in hass.data:
|
||||
if not (data := hass.data.get(DOMAIN)) or data.websession.closed:
|
||||
websession = async_create_clientsession(hass, cookie_jar=CookieJar(unsafe=True))
|
||||
|
||||
hass.data[DOMAIN] = LTEData(websession)
|
||||
@ -258,7 +258,7 @@ async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
||||
if entry.state == ConfigEntryState.LOADED
|
||||
]
|
||||
if len(loaded_entries) == 1:
|
||||
hass.data.pop(DOMAIN)
|
||||
hass.data.pop(DOMAIN, None)
|
||||
|
||||
return unload_ok
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user