Avoid linear search of entity registry in rainmachine (#109642)

This commit is contained in:
J. Nick Koston 2024-02-04 14:17:40 -06:00 committed by GitHub
parent 113d38361d
commit 74812261d4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -60,9 +60,10 @@ def async_finish_entity_domain_replacements(
try:
[registry_entry] = [
registry_entry
for registry_entry in ent_reg.entities.values()
if registry_entry.config_entry_id == entry.entry_id
and registry_entry.domain == strategy.old_domain
for registry_entry in ent_reg.entities.get_entries_for_config_entry_id(
entry.entry_id
)
if registry_entry.domain == strategy.old_domain
and registry_entry.unique_id == strategy.old_unique_id
]
except ValueError: