From 30c99ce954b7b888e552deea4a1b91e056360fd1 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Tue, 20 Apr 2021 06:13:50 -1000 Subject: [PATCH] Fix memory leak in insteon (#49466) --- homeassistant/components/insteon/__init__.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/homeassistant/components/insteon/__init__.py b/homeassistant/components/insteon/__init__.py index 509878f9613..2e2d801e1f2 100644 --- a/homeassistant/components/insteon/__init__.py +++ b/homeassistant/components/insteon/__init__.py @@ -96,7 +96,9 @@ async def async_setup_entry(hass, entry): _LOGGER.error("Could not connect to Insteon modem") raise ConfigEntryNotReady from exception - hass.bus.async_listen_once(EVENT_HOMEASSISTANT_STOP, close_insteon_connection) + entry.async_on_unload( + hass.bus.async_listen_once(EVENT_HOMEASSISTANT_STOP, close_insteon_connection) + ) await devices.async_load( workdir=hass.config.config_dir, id_devices=0, load_modem_aldb=0