mirror of
https://github.com/home-assistant/core.git
synced 2025-08-04 05:05:09 +02:00
Allow system and helper integrations to provide entity_component icons (#109045)
This commit is contained in:
18
homeassistant/components/automation/icons.json
Normal file
18
homeassistant/components/automation/icons.json
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
{
|
||||||
|
"entity_component": {
|
||||||
|
"_": {
|
||||||
|
"default": "mdi:robot",
|
||||||
|
"state": {
|
||||||
|
"off": "mdi:robot-off",
|
||||||
|
"unavailable": "mdi:robot-confused"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"services": {
|
||||||
|
"turn_on": "mdi:robot",
|
||||||
|
"turn_off": "mdi:robot-off",
|
||||||
|
"toggle": "mdi:robot",
|
||||||
|
"trigger": "mdi:robot",
|
||||||
|
"reload": "mdi:robot"
|
||||||
|
}
|
||||||
|
}
|
@@ -70,14 +70,14 @@ def icon_schema(integration_type: str) -> vol.Schema:
|
|||||||
),
|
),
|
||||||
}
|
}
|
||||||
|
|
||||||
base_schema = vol.Schema(
|
schema = vol.Schema(
|
||||||
{
|
{
|
||||||
vol.Optional("services"): state_validator,
|
vol.Optional("services"): state_validator,
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
if integration_type == "entity":
|
if integration_type in ("entity", "helper", "system"):
|
||||||
return base_schema.extend(
|
schema = schema.extend(
|
||||||
{
|
{
|
||||||
vol.Required("entity_component"): vol.All(
|
vol.Required("entity_component"): vol.All(
|
||||||
cv.schema_with_slug_keys(
|
cv.schema_with_slug_keys(
|
||||||
@@ -89,20 +89,22 @@ def icon_schema(integration_type: str) -> vol.Schema:
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
return base_schema.extend(
|
if integration_type not in ("entity", "system"):
|
||||||
{
|
schema = schema.extend(
|
||||||
vol.Optional("entity"): vol.All(
|
{
|
||||||
cv.schema_with_slug_keys(
|
vol.Optional("entity"): vol.All(
|
||||||
cv.schema_with_slug_keys(
|
cv.schema_with_slug_keys(
|
||||||
icon_schema_slug(vol.Optional),
|
cv.schema_with_slug_keys(
|
||||||
slug_validator=translation_key_validator,
|
icon_schema_slug(vol.Optional),
|
||||||
|
slug_validator=translation_key_validator,
|
||||||
|
),
|
||||||
|
slug_validator=cv.slug,
|
||||||
),
|
),
|
||||||
slug_validator=cv.slug,
|
ensure_not_same_as_default,
|
||||||
),
|
)
|
||||||
ensure_not_same_as_default,
|
}
|
||||||
)
|
)
|
||||||
}
|
return schema
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
def validate_icon_file(config: Config, integration: Integration) -> None: # noqa: C901
|
def validate_icon_file(config: Config, integration: Integration) -> None: # noqa: C901
|
||||||
|
Reference in New Issue
Block a user