Fix memory leak in netatmo (#49464)

This commit is contained in:
J. Nick Koston 2021-04-19 23:03:07 -10:00 committed by GitHub
parent 12853438c5
commit b557d20fbb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 1 deletions

View File

@ -188,7 +188,9 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry):
except pyatmo.ApiError as err:
_LOGGER.error("Error during webhook registration - %s", err)
hass.bus.async_listen_once(EVENT_HOMEASSISTANT_STOP, unregister_webhook)
entry.async_on_unload(
hass.bus.async_listen_once(EVENT_HOMEASSISTANT_STOP, unregister_webhook)
)
if hass.state == CoreState.running:
await register_webhook(None)