From f04654588385d2c50ff65be7dcc33d25a5995ef7 Mon Sep 17 00:00:00 2001 From: Allen Porter <allen@thebends.org> Date: Sun, 9 Jun 2024 23:18:50 -0700 Subject: [PATCH] Fix nest to cancel event listener on config entry unload (#119257) --- homeassistant/components/nest/__init__.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/homeassistant/components/nest/__init__.py b/homeassistant/components/nest/__init__.py index 96231390119..bdec44a3c85 100644 --- a/homeassistant/components/nest/__init__.py +++ b/homeassistant/components/nest/__init__.py @@ -224,7 +224,9 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: """Close connection when hass stops.""" subscriber.stop_async() - hass.bus.async_listen_once(EVENT_HOMEASSISTANT_STOP, on_hass_stop) + entry.async_on_unload( + hass.bus.async_listen_once(EVENT_HOMEASSISTANT_STOP, on_hass_stop) + ) hass.data[DOMAIN][entry.entry_id] = { DATA_SUBSCRIBER: subscriber, -- GitLab