From a073a6b01efd433ef4d02d73ff0a2e0b9f27f515 Mon Sep 17 00:00:00 2001 From: Markus Jacobsen Date: Mon, 5 May 2025 14:23:02 +0200 Subject: [PATCH] Fix hassfest expecting strings file for custom components (#135789) Co-authored-by: Joost Lekkerkerker Co-authored-by: Robert Resch --- script/hassfest/services.py | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/script/hassfest/services.py b/script/hassfest/services.py index 3a0ebed76fe..70f0a63ca76 100644 --- a/script/hassfest/services.py +++ b/script/hassfest/services.py @@ -233,7 +233,7 @@ def validate_services(config: Config, integration: Integration) -> None: # noqa ) if service_schema is None: continue - if "name" not in service_schema: + if "name" not in service_schema and integration.core: try: strings["services"][service_name]["name"] except KeyError: @@ -242,7 +242,7 @@ def validate_services(config: Config, integration: Integration) -> None: # noqa f"Service {service_name} has no name {error_msg_suffix}", ) - if "description" not in service_schema: + if "description" not in service_schema and integration.core: try: strings["services"][service_name]["description"] except KeyError: @@ -257,7 +257,7 @@ def validate_services(config: Config, integration: Integration) -> None: # noqa if "fields" in field_schema: # This is a section continue - if "name" not in field_schema: + if "name" not in field_schema and integration.core: try: strings["services"][service_name]["fields"][field_name]["name"] except KeyError: @@ -266,7 +266,7 @@ def validate_services(config: Config, integration: Integration) -> None: # noqa f"Service {service_name} has a field {field_name} with no name {error_msg_suffix}", ) - if "description" not in field_schema: + if "description" not in field_schema and integration.core: try: strings["services"][service_name]["fields"][field_name][ "description" @@ -296,13 +296,14 @@ def validate_services(config: Config, integration: Integration) -> None: # noqa if "fields" not in section_schema: # This is not a section continue - try: - strings["services"][service_name]["sections"][section_name]["name"] - except KeyError: - integration.add_error( - "services", - f"Service {service_name} has a section {section_name} with no name {error_msg_suffix}", - ) + if "name" not in section_schema and integration.core: + try: + strings["services"][service_name]["sections"][section_name]["name"] + except KeyError: + integration.add_error( + "services", + f"Service {service_name} has a section {section_name} with no name {error_msg_suffix}", + ) def validate(integrations: dict[str, Integration], config: Config) -> None: