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

Allow hiding and unhiding group members (#68192)

This commit is contained in:
Erik Montnemery
2022-03-22 12:14:34 +01:00
committed by GitHub
parent b5d2c6e43a
commit 1b955970f8
7 changed files with 359 additions and 14 deletions

View File

@@ -961,6 +961,22 @@ def async_validate_entity_id(registry: EntityRegistry, entity_id_or_uuid: str) -
return entry.entity_id
@callback
def async_resolve_entity_id(
registry: EntityRegistry, entity_id_or_uuid: str
) -> str | None:
"""Validate and resolve an entity id or UUID to an entity id.
Returns None if the entity or UUID is invalid, or if the UUID is not
associated with an entity registry item.
"""
if valid_entity_id(entity_id_or_uuid):
return entity_id_or_uuid
if (entry := registry.entities.get_entry(entity_id_or_uuid)) is None:
return None
return entry.entity_id
@callback
def async_validate_entity_ids(
registry: EntityRegistry, entity_ids_or_uuids: list[str]