From ec3db0a6aac9690c229c1fdcf7d2ffdf318e661c Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Tue, 19 Mar 2024 13:58:59 -1000 Subject: [PATCH] Migrate camera listeners to use run_immediately (#113840) None of these need a call_soon --- homeassistant/components/camera/__init__.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/homeassistant/components/camera/__init__.py b/homeassistant/components/camera/__init__.py index 9671288e7ee..bfeab601352 100644 --- a/homeassistant/components/camera/__init__.py +++ b/homeassistant/components/camera/__init__.py @@ -417,7 +417,9 @@ async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool: stream.add_provider("hls") await stream.start() - hass.bus.async_listen_once(EVENT_HOMEASSISTANT_STARTED, preload_stream) + hass.bus.async_listen_once( + EVENT_HOMEASSISTANT_STARTED, preload_stream, run_immediately=True + ) @callback def update_tokens(t: datetime) -> None: @@ -435,7 +437,9 @@ async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool: """Unsubscribe track time interval timer.""" unsub() - hass.bus.async_listen_once(EVENT_HOMEASSISTANT_STOP, unsub_track_time_interval) + hass.bus.async_listen_once( + EVENT_HOMEASSISTANT_STOP, unsub_track_time_interval, run_immediately=True + ) component.async_register_entity_service( SERVICE_ENABLE_MOTION, {}, "async_enable_motion_detection"