From 91fa612301259ed6069004a0b72b47ae93d17095 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Sat, 16 Mar 2024 14:42:36 -1000 Subject: [PATCH] Run entity component shutdown immediately (#113635) --- homeassistant/helpers/entity_component.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/homeassistant/helpers/entity_component.py b/homeassistant/helpers/entity_component.py index fe2d78c02ed..dc9093b362b 100644 --- a/homeassistant/helpers/entity_component.py +++ b/homeassistant/helpers/entity_component.py @@ -120,7 +120,9 @@ class EntityComponent(Generic[_EntityT]): Note: this is only required if the integration never calls `setup` or `async_setup`. """ - self.hass.bus.async_listen_once(EVENT_HOMEASSISTANT_STOP, self._async_shutdown) + self.hass.bus.async_listen_once( + EVENT_HOMEASSISTANT_STOP, self._async_shutdown, run_immediately=True + ) def setup(self, config: ConfigType) -> None: """Set up a full entity component.