mirror of
https://github.com/home-assistant/core.git
synced 2025-07-20 11:47:06 +00:00
Avoid linear search in hassio to find devices (#114806)
This commit is contained in:
parent
816ce116bf
commit
86feae421c
@ -371,9 +371,10 @@ class HassioDataUpdateCoordinator(DataUpdateCoordinator): # pylint: disable=has
|
|||||||
# Remove add-ons that are no longer installed from device registry
|
# Remove add-ons that are no longer installed from device registry
|
||||||
supervisor_addon_devices = {
|
supervisor_addon_devices = {
|
||||||
list(device.identifiers)[0][1]
|
list(device.identifiers)[0][1]
|
||||||
for device in self.dev_reg.devices.values()
|
for device in self.dev_reg.devices.get_devices_for_config_entry_id(
|
||||||
if self.entry_id in device.config_entries
|
self.entry_id
|
||||||
and device.model == SupervisorEntityModel.ADDON
|
)
|
||||||
|
if device.model == SupervisorEntityModel.ADDON
|
||||||
}
|
}
|
||||||
if stale_addons := supervisor_addon_devices - set(new_data[DATA_KEY_ADDONS]):
|
if stale_addons := supervisor_addon_devices - set(new_data[DATA_KEY_ADDONS]):
|
||||||
async_remove_addons_from_dev_reg(self.dev_reg, stale_addons)
|
async_remove_addons_from_dev_reg(self.dev_reg, stale_addons)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user