Reduce some linear searches to cleanup the device registry (#112277)

Some of the data we had to search for was already available
in a dict or underlying data structure. Make it available
instead of having to build it every time.

There are more places these can be used, but I only did
the device registry cleanup for now
This commit is contained in:
J. Nick Koston 2024-03-04 15:59:12 -10:00 committed by GitHub
parent e357c4d5e5
commit 2c179dc5fb
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 56 additions and 14 deletions

View file

@ -1462,6 +1462,11 @@ class ConfigEntries:
"""Return entry with matching entry_id."""
return self._entries.data.get(entry_id)
@callback
def async_entry_ids(self) -> list[str]:
"""Return entry ids."""
return list(self._entries.data)
@callback
def async_entries(
self,