Avoid linear search of the entity registry in ps4 (#109723)
This commit is contained in:
parent
440212ddce
commit
6fce8a5403
2 changed files with 33 additions and 29 deletions
|
@ -344,11 +344,13 @@ class PS4Device(MediaPlayerEntity):
|
|||
_LOGGER.info("Assuming status from registry")
|
||||
e_registry = er.async_get(self.hass)
|
||||
d_registry = dr.async_get(self.hass)
|
||||
for entity_id, entry in e_registry.entities.items():
|
||||
if entry.config_entry_id == self._entry_id:
|
||||
self._attr_unique_id = entry.unique_id
|
||||
self.entity_id = entity_id
|
||||
break
|
||||
|
||||
for entry in e_registry.entities.get_entries_for_config_entry_id(
|
||||
self._entry_id
|
||||
):
|
||||
self._attr_unique_id = entry.unique_id
|
||||
self.entity_id = entry.entity_id
|
||||
break
|
||||
for device in d_registry.devices.values():
|
||||
if self._entry_id in device.config_entries:
|
||||
self._attr_device_info = DeviceInfo(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue