Avoid linear search in ps4 to find devices (#114814)

This commit is contained in:
J. Nick Koston 2024-04-03 23:53:04 -10:00 committed by GitHub
parent 0710f4c661
commit cc96bc44a0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -350,16 +350,17 @@ class PS4Device(MediaPlayerEntity):
self._attr_unique_id = entry.unique_id self._attr_unique_id = entry.unique_id
self.entity_id = entry.entity_id self.entity_id = entry.entity_id
break break
for device in d_registry.devices.values(): for device in d_registry.devices.get_devices_for_config_entry_id(
if self._entry_id in device.config_entries: self._entry_id
self._attr_device_info = DeviceInfo( ):
identifiers=device.identifiers, self._attr_device_info = DeviceInfo(
manufacturer=device.manufacturer, identifiers=device.identifiers,
model=device.model, manufacturer=device.manufacturer,
name=device.name, model=device.model,
sw_version=device.sw_version, name=device.name,
) sw_version=device.sw_version,
break )
break
else: else:
_sw_version = status["system-version"] _sw_version = status["system-version"]