mirror of
https://github.com/home-assistant/core.git
synced 2025-07-13 16:27:08 +00:00
Fix HOMEASSISTANT_STOP unsubscribe in data update coordinator (#145809)
* initial commit * a better approach * Add comment
This commit is contained in:
parent
ca567aa7fc
commit
9d0fc0d513
@ -138,6 +138,8 @@ class DataUpdateCoordinator(BaseDataUpdateCoordinatorProtocol, Generic[_DataT]):
|
|||||||
|
|
||||||
async def _on_hass_stop(_: Event) -> None:
|
async def _on_hass_stop(_: Event) -> None:
|
||||||
"""Shutdown coordinator on HomeAssistant stop."""
|
"""Shutdown coordinator on HomeAssistant stop."""
|
||||||
|
# Already cleared on EVENT_HOMEASSISTANT_STOP, via async_fire_internal
|
||||||
|
self._unsub_shutdown = None
|
||||||
await self.async_shutdown()
|
await self.async_shutdown()
|
||||||
|
|
||||||
self._unsub_shutdown = self.hass.bus.async_listen_once(
|
self._unsub_shutdown = self.hass.bus.async_listen_once(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user