Run shelly coordinator shutdown immediately at the stop event (#113633)

There is no need to use a call_soon here as we want to shutdown
right away
This commit is contained in:
J. Nick Koston 2024-03-16 13:36:02 -10:00 committed by GitHub
parent 44cac3c90a
commit 796f4deac2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -179,7 +179,9 @@ class ShellyBlockCoordinator(ShellyCoordinatorBase[BlockDevice]):
self.async_add_listener(self._async_device_updates_handler)
)
entry.async_on_unload(
hass.bus.async_listen_once(EVENT_HOMEASSISTANT_STOP, self._handle_ha_stop)
hass.bus.async_listen_once(
EVENT_HOMEASSISTANT_STOP, self._handle_ha_stop, run_immediately=True
)
)
@callback
@ -408,7 +410,9 @@ class ShellyRpcCoordinator(ShellyCoordinatorBase[RpcDevice]):
self._input_event_listeners: list[Callable[[dict[str, Any]], None]] = []
entry.async_on_unload(
hass.bus.async_listen_once(EVENT_HOMEASSISTANT_STOP, self._handle_ha_stop)
hass.bus.async_listen_once(
EVENT_HOMEASSISTANT_STOP, self._handle_ha_stop, run_immediately=True
)
)
entry.async_on_unload(entry.add_update_listener(self._async_update_listener))