1
0
mirror of https://github.com/home-assistant/core.git synced 2025-12-24 12:59:34 +00:00

Only load services.yaml for integrations that have it (#112732)

Co-authored-by: J. Nick Koston <nick@koston.org>
This commit is contained in:
Paulus Schoutsen
2024-03-11 14:05:32 -04:00
committed by GitHub
parent ec89886fac
commit 145657dc21
7 changed files with 43 additions and 7 deletions

View File

@@ -633,16 +633,18 @@ async def async_get_all_descriptions(
ints_or_excs = await async_get_integrations(hass, domains_with_missing_services)
integrations: list[Integration] = []
for domain, int_or_exc in ints_or_excs.items():
if type(int_or_exc) is Integration: # noqa: E721
if type(int_or_exc) is Integration and int_or_exc.has_services: # noqa: E721
integrations.append(int_or_exc)
continue
if TYPE_CHECKING:
assert isinstance(int_or_exc, Exception)
_LOGGER.error("Failed to load integration: %s", domain, exc_info=int_or_exc)
contents = await hass.async_add_executor_job(
_load_services_files, hass, integrations
)
loaded = dict(zip(domains_with_missing_services, contents))
if integrations:
contents = await hass.async_add_executor_job(
_load_services_files, hass, integrations
)
loaded = dict(zip(domains_with_missing_services, contents))
# Load translations for all service domains
translations = await translation.async_get_translations(