diff --git a/homeassistant/components/trace/__init__.py b/homeassistant/components/trace/__init__.py index d0ec4555376..a7ad576e53d 100644 --- a/homeassistant/components/trace/__init__.py +++ b/homeassistant/components/trace/__init__.py @@ -68,7 +68,9 @@ async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool: _LOGGER.error("Error storing traces", exc_info=exc) # Store traces when stopping hass - hass.bus.async_listen_once(EVENT_HOMEASSISTANT_STOP, _async_store_traces_at_stop) + hass.bus.async_listen_once( + EVENT_HOMEASSISTANT_STOP, _async_store_traces_at_stop, run_immediately=True + ) return True