Improve performance of filtering HomeKit entities (#111201)

Get the underlying filter with get_filter to avoid the wrapper
This commit is contained in:
J. Nick Koston 2024-02-23 08:42:01 -10:00 committed by GitHub
parent 3877a56d23
commit b3a8a75e75
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -798,10 +798,11 @@ class HomeKit:
}
)
entity_states = []
entity_states: list[State] = []
entity_filter = self._filter.get_filter()
for state in self.hass.states.async_all():
entity_id = state.entity_id
if not self._filter(entity_id):
if not entity_filter(entity_id):
continue
if ent_reg_ent := ent_reg.async_get(entity_id):