Move setup of legacy device_tracker see service to legacy setup task (#114043)

* Move setup of legacy device_tracker see service to legacy setup task

device_tracker can setup synchronously now if there are no legacy
platforms that have to be import to validate the config

The see service is not useful until at least one legacy platform
is loaded so there is no reason to wait for it in the base
setup.

* collapse
This commit is contained in:
J. Nick Koston 2024-03-22 22:40:34 -10:00 committed by GitHub
parent c2771791a3
commit 39c44ad5b7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 9 additions and 16 deletions

View file

@ -69,7 +69,15 @@ def is_on(hass: HomeAssistant, entity_id: str) -> bool:
async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
"""Set up the device tracker."""
await async_setup_legacy_integration(hass, config)
#
# Legacy and platforms load in a non-awaited tracked task
# to ensure device tracker setup can continue and config
# entry integrations are not waiting for legacy device
# tracker platforms to be set up.
#
hass.async_create_task(
async_setup_legacy_integration(hass, config), eager_start=True
)
return True

View file

@ -217,21 +217,6 @@ async def async_setup_integration(hass: HomeAssistant, config: ConfigType) -> No
DOMAIN, SERVICE_SEE, async_see_service, SERVICE_SEE_PAYLOAD_SCHEMA
)
#
# The platforms load in a non-awaited tracked task
# to ensure device tracker setup can continue and config
# entry integrations are not waiting for legacy device
# tracker platforms to be set up.
#
hass.async_create_task(
_async_setup_legacy_integration(hass, config, tracker), eager_start=True
)
async def _async_setup_legacy_integration(
hass: HomeAssistant, config: ConfigType, tracker: DeviceTracker
) -> None:
"""Set up the legacy integration."""
legacy_platforms = await async_extract_config(hass, config)
setup_tasks = [