Add new features from new UniFi Protect (#82892)

Co-authored-by: J. Nick Koston <nick@koston.org>
This commit is contained in:
Christopher Bailey 2022-11-29 04:44:31 -05:00 committed by GitHub
parent a5890b2374
commit 596016c2ac
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 166 additions and 17 deletions

View file

@ -406,10 +406,13 @@ class ProtectMediaSource(MediaSource):
event_text = "Motion Event"
elif event_type == EventType.SMART_DETECT.value:
if isinstance(event, Event):
smart_type = event.smart_detect_types[0]
smart_types = event.smart_detect_types
else:
smart_type = SmartDetectObjectType(event["smartDetectTypes"][0])
event_text = f"Smart Detection - {smart_type.name.title()}"
smart_types = [
SmartDetectObjectType(e) for e in event["smartDetectTypes"]
]
smart_type_names = [s.name.title().replace("_", " ") for s in smart_types]
event_text = f"Smart Detection - {','.join(smart_type_names)}"
title += f" {event_text}"
nvr = data.api.bootstrap.nvr