mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 19:27:45 +00:00
Clean up more netgear_lte resources on shutdown (#39065)
This commit is contained in:
parent
2ec546db3d
commit
1ea21b7011
@ -306,17 +306,19 @@ async def _login(hass, modem_data, password):
|
|||||||
await modem_data.async_update()
|
await modem_data.async_update()
|
||||||
hass.data[DATA_KEY].modem_data[modem_data.host] = modem_data
|
hass.data[DATA_KEY].modem_data[modem_data.host] = modem_data
|
||||||
|
|
||||||
async def cleanup(event):
|
|
||||||
"""Clean up resources."""
|
|
||||||
await modem_data.modem.logout()
|
|
||||||
|
|
||||||
hass.bus.async_listen_once(EVENT_HOMEASSISTANT_STOP, cleanup)
|
|
||||||
|
|
||||||
async def _update(now):
|
async def _update(now):
|
||||||
"""Periodic update."""
|
"""Periodic update."""
|
||||||
await modem_data.async_update()
|
await modem_data.async_update()
|
||||||
|
|
||||||
async_track_time_interval(hass, _update, SCAN_INTERVAL)
|
update_unsub = async_track_time_interval(hass, _update, SCAN_INTERVAL)
|
||||||
|
|
||||||
|
async def cleanup(event):
|
||||||
|
"""Clean up resources."""
|
||||||
|
update_unsub()
|
||||||
|
await modem_data.modem.logout()
|
||||||
|
del hass.data[DATA_KEY].modem_data[modem_data.host]
|
||||||
|
|
||||||
|
hass.bus.async_listen_once(EVENT_HOMEASSISTANT_STOP, cleanup)
|
||||||
|
|
||||||
|
|
||||||
async def _retry_login(hass, modem_data, password):
|
async def _retry_login(hass, modem_data, password):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user