1
0
mirror of https://github.com/home-assistant/core.git synced 2025-12-25 05:26:47 +00:00

Teach alarm_control_panel device trigger about entity registry ids (#60977)

* Teach alarm_control_panel device trigger about entity registry ids

* Lint code

* Address review comment
This commit is contained in:
Erik Montnemery
2023-06-20 14:27:31 +02:00
committed by GitHub
parent 2bc5198390
commit 4a8adae146
4 changed files with 52 additions and 44 deletions

View File

@@ -470,13 +470,15 @@ class EntityRegistry:
return entity_id in self.entities
@callback
def async_get(self, entity_id: str) -> RegistryEntry | None:
"""Get EntityEntry for an entity_id.
def async_get(self, entity_id_or_uuid: str) -> RegistryEntry | None:
"""Get EntityEntry for an entity_id or entity entry id.
We retrieve the RegistryEntry from the underlying dict to avoid
the overhead of the UserDict __getitem__.
"""
return self._entities_data.get(entity_id)
return self._entities_data.get(entity_id_or_uuid) or self.entities.get_entry(
entity_id_or_uuid
)
@callback
def async_get_entity_id(