Run more of hassio setup in in tasks (#112151)
* Run more of hassio setup in in tasks There were a few more places were we waited in sequence where we have to make remote api calls that could be moved to tasks * tweak * tweak
This commit is contained in:
parent
a049d0e846
commit
d7507fd8a3
1 changed files with 18 additions and 8 deletions
|
@ -375,6 +375,9 @@ async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool: # noqa:
|
|||
hass.bus.async_listen(EVENT_CORE_CONFIG_UPDATE, push_config)
|
||||
|
||||
push_config_task = hass.async_create_task(push_config(None), eager_start=True)
|
||||
# Start listening for problems with supervisor and making issues
|
||||
hass.data[DATA_KEY_SUPERVISOR_ISSUES] = issues = SupervisorIssues(hass, hassio)
|
||||
issues_task = hass.async_create_task(issues.setup(), eager_start=True)
|
||||
|
||||
async def async_service_handler(service: ServiceCall) -> None:
|
||||
"""Handle service calls for Hass.io."""
|
||||
|
@ -435,8 +438,7 @@ async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool: # noqa:
|
|||
)
|
||||
|
||||
# Fetch data
|
||||
await update_info_data()
|
||||
await push_config_task
|
||||
update_info_task = hass.async_create_task(update_info_data(), eager_start=True)
|
||||
|
||||
async def _async_stop(hass: HomeAssistant, restart: bool) -> None:
|
||||
"""Stop or restart home assistant."""
|
||||
|
@ -459,7 +461,18 @@ async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool: # noqa:
|
|||
async_setup_ingress_view(hass, host)
|
||||
|
||||
# Init add-on ingress panels
|
||||
await async_setup_addon_panel(hass, hassio)
|
||||
panels_task = hass.async_create_task(
|
||||
async_setup_addon_panel(hass, hassio), eager_start=True
|
||||
)
|
||||
|
||||
# Make sure to await the update_info task before
|
||||
# _async_setup_hardware_integration is called
|
||||
# so the hardware integration can be set up
|
||||
# and does not fallback to calling later
|
||||
await panels_task
|
||||
await update_info_task
|
||||
await push_config_task
|
||||
await issues_task
|
||||
|
||||
# Setup hardware integration for the detected board type
|
||||
@callback
|
||||
|
@ -480,7 +493,8 @@ async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool: # noqa:
|
|||
hass.async_create_task(
|
||||
hass.config_entries.flow.async_init(
|
||||
hw_integration, context={"source": "system"}
|
||||
)
|
||||
),
|
||||
eager_start=True,
|
||||
)
|
||||
|
||||
async_setup_hardware_integration_job = HassJob(
|
||||
|
@ -494,10 +508,6 @@ async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool: # noqa:
|
|||
eager_start=True,
|
||||
)
|
||||
|
||||
# Start listening for problems with supervisor and making issues
|
||||
hass.data[DATA_KEY_SUPERVISOR_ISSUES] = issues = SupervisorIssues(hass, hassio)
|
||||
await issues.setup()
|
||||
|
||||
return True
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue