Fix memory leak in ambient_station on reload (#49455)

This commit is contained in:
J. Nick Koston 2021-04-20 06:17:08 -10:00 committed by GitHub
parent 3164eef059
commit 20ead7902a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -355,7 +355,11 @@ async def async_setup_entry(hass, config_entry):
async def _async_disconnect_websocket(*_):
await ambient.client.websocket.disconnect()
hass.bus.async_listen_once(EVENT_HOMEASSISTANT_STOP, _async_disconnect_websocket)
config_entry.async_on_unload(
hass.bus.async_listen_once(
EVENT_HOMEASSISTANT_STOP, _async_disconnect_websocket
)
)
return True