mirror of
https://github.com/home-assistant/core.git
synced 2025-04-23 16:57:53 +00:00
Allow entity platforms without entity_component in icon validation (#113422)
* Allow entity platforms without entity_component * Rename variable --------- Co-authored-by: jbouwh <jan@jbsoft.nl>
This commit is contained in:
parent
7359d66d32
commit
36123717be
@ -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(
|
||||
@ -78,7 +78,7 @@ def icon_schema(integration_type: str) -> vol.Schema:
|
||||
)
|
||||
|
||||
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")
|
||||
@ -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)
|
||||
|
Loading…
x
Reference in New Issue
Block a user