mirror of
https://github.com/home-assistant/core.git
synced 2025-12-24 21:06:19 +00:00
Remove async_get_device_class_lookup from entity_registry (#114212)
This function was only ever used in homekit, and since there is now an index of devices in the entity registry, homekit no longer uses it. I searched github code for all references to async_get_device_class_lookup and the only think I could find using it were forks of core. It seems unlikely that any custom components are affected by removing this function
This commit is contained in:
@@ -643,29 +643,6 @@ class EntityRegistry(BaseRegistry):
|
||||
run_immediately=True,
|
||||
)
|
||||
|
||||
@callback
|
||||
def async_get_device_class_lookup(
|
||||
self, domain_device_classes: set[tuple[str, str | None]]
|
||||
) -> dict[str, dict[tuple[str, str | None], str]]:
|
||||
"""Return a lookup of entity ids for devices which have matching entities.
|
||||
|
||||
Entities must match a set of (domain, device_class) tuples.
|
||||
The result is indexed by device_id, then by the matching (domain, device_class)
|
||||
"""
|
||||
lookup: dict[str, dict[tuple[str, str | None], str]] = {}
|
||||
for entity in self.entities.values():
|
||||
if not entity.device_id:
|
||||
continue
|
||||
device_class = entity.device_class or entity.original_device_class
|
||||
domain_device_class = (entity.domain, device_class)
|
||||
if domain_device_class not in domain_device_classes:
|
||||
continue
|
||||
if entity.device_id not in lookup:
|
||||
lookup[entity.device_id] = {domain_device_class: entity.entity_id}
|
||||
else:
|
||||
lookup[entity.device_id][domain_device_class] = entity.entity_id
|
||||
return lookup
|
||||
|
||||
@callback
|
||||
def async_is_registered(self, entity_id: str) -> bool:
|
||||
"""Check if an entity_id is currently registered."""
|
||||
|
||||
Reference in New Issue
Block a user