Migrate camera listeners to use run_immediately (#113840)

None of these need a call_soon
This commit is contained in:
J. Nick Koston 2024-03-19 13:58:59 -10:00 committed by GitHub
parent 8a9f69b22a
commit ec3db0a6aa
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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"