Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow entity platforms without entity_component in icon validation #113422

Merged
merged 2 commits into from
Mar 14, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions script/hassfest/icons.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def ensure_not_same_as_default(value: dict) -> dict:
return value


def icon_schema(integration_type: str) -> vol.Schema:
def icon_schema(integration_type: str, no_entity_platforms: bool) -> vol.Schema:
"""Create a icon schema."""

state_validator = cv.schema_with_slug_keys(
Expand Down Expand Up @@ -78,7 +78,7 @@ def icon_schema_slug(marker: type[vol.Marker]) -> dict[vol.Marker, Any]:
)

if integration_type in ("entity", "helper", "system"):
if integration_type != "entity":
if integration_type != "entity" or no_entity_platforms:
field = vol.Optional("entity_component")
else:
field = vol.Required("entity_component")
Expand Down Expand Up @@ -126,7 +126,9 @@ def validate_icon_file(config: Config, integration: Integration) -> None: # noq
integration.add_error("icons", f"Invalid JSON in {name}: {err}")
return

schema = icon_schema(integration.integration_type)
no_entity_platforms = name in ("notify", "image_processing")

schema = icon_schema(integration.integration_type, no_entity_platforms)

try:
schema(icons)
Expand Down