From fa05e5a8a0d909da378abe254626d354df8664e6 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Tue, 20 Apr 2021 05:13:27 -1000 Subject: [PATCH] Fix memory leak in wemo on reload (#49457) --- homeassistant/components/wemo/__init__.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/homeassistant/components/wemo/__init__.py b/homeassistant/components/wemo/__init__.py index a013d1fdd34..6ae016954f2 100644 --- a/homeassistant/components/wemo/__init__.py +++ b/homeassistant/components/wemo/__init__.py @@ -109,7 +109,9 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry): await hass.async_add_executor_job(registry.stop) wemo_discovery.async_stop_discovery() - hass.bus.async_listen_once(EVENT_HOMEASSISTANT_STOP, async_stop_wemo) + entry.async_on_unload( + hass.bus.async_listen_once(EVENT_HOMEASSISTANT_STOP, async_stop_wemo) + ) static_conf = config.get(CONF_STATIC, []) if static_conf: