Skip to content

Commit

Permalink
Mitigate session closed error in Netgear LTE (#110412)
Browse files Browse the repository at this point in the history
  • Loading branch information
tkdrob authored Feb 16, 2024
1 parent d4a2dc7 commit 2ac7d11
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions homeassistant/components/netgear_lte/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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

Expand Down

0 comments on commit 2ac7d11

Please sign in to comment.