Refactor and unify device fetching for UniFi Protect (#77341)
This commit is contained in:
parent
dfc3e7d80f
commit
1fb8fbf5de
10 changed files with 50 additions and 44 deletions
|
@ -10,6 +10,7 @@ from pyunifiprotect.data import (
|
|||
Camera,
|
||||
Event,
|
||||
Light,
|
||||
ModelType,
|
||||
MountType,
|
||||
ProtectAdoptableDeviceModel,
|
||||
ProtectModelWithId,
|
||||
|
@ -409,12 +410,9 @@ def _async_motion_entities(
|
|||
) -> list[ProtectDeviceEntity]:
|
||||
entities: list[ProtectDeviceEntity] = []
|
||||
devices = (
|
||||
data.api.bootstrap.cameras.values() if ufp_device is None else [ufp_device]
|
||||
data.get_by_types({ModelType.CAMERA}) if ufp_device is None else [ufp_device]
|
||||
)
|
||||
for device in devices:
|
||||
if not device.is_adopted:
|
||||
continue
|
||||
|
||||
for description in MOTION_SENSORS:
|
||||
entities.append(ProtectEventBinarySensor(data, device, description))
|
||||
_LOGGER.debug(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue