mirror of
https://github.com/home-assistant/core.git
synced 2025-12-24 21:06:19 +00:00
Use async_setup_recorder_instance fixture in recorder migration tests (#121050)
This commit is contained in:
@@ -1478,14 +1478,17 @@ async def async_setup_recorder_instance(
|
||||
):
|
||||
|
||||
async def async_setup_recorder(
|
||||
hass: HomeAssistant, config: ConfigType | None = None
|
||||
hass: HomeAssistant,
|
||||
config: ConfigType | None = None,
|
||||
*,
|
||||
wait_recorder: bool = True,
|
||||
) -> recorder.Recorder:
|
||||
"""Setup and return recorder instance.""" # noqa: D401
|
||||
await _async_init_recorder_component(hass, config, recorder_db_url)
|
||||
await hass.async_block_till_done()
|
||||
instance = hass.data[recorder.DATA_INSTANCE]
|
||||
# The recorder's worker is not started until Home Assistant is running
|
||||
if hass.state is CoreState.running:
|
||||
if hass.state is CoreState.running and wait_recorder:
|
||||
await async_recorder_block_till_done(hass)
|
||||
return instance
|
||||
|
||||
|
||||
Reference in New Issue
Block a user