From f54bbf915c27e15a6e8d427b44f37e14fcfb235f Mon Sep 17 00:00:00 2001 From: Nicolas Mowen Date: Mon, 19 Feb 2024 06:34:35 -0700 Subject: [PATCH] Add field for alert labels --- frigate/config.py | 4 ++++ frigate/review/maintainer.py | 11 +++++++++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/frigate/config.py b/frigate/config.py index 3e240b9c8..4264842d8 100644 --- a/frigate/config.py +++ b/frigate/config.py @@ -58,6 +58,7 @@ if os.path.isdir("/run/secrets"): ).read_text() DEFAULT_TRACKED_OBJECTS = ["person"] +DEFAULT_ALERT_OBJECTS = ["person", "car"] DEFAULT_LISTEN_AUDIO = ["bark", "fire_alarm", "scream", "speech", "yell"] DEFAULT_DETECTORS = {"cpu": {"type": "cpu"}} DEFAULT_DETECT_DIMENSIONS = {"width": 1280, "height": 720} @@ -512,6 +513,9 @@ class ZoneConfig(BaseModel): class ObjectConfig(FrigateBaseModel): track: List[str] = Field(default=DEFAULT_TRACKED_OBJECTS, title="Objects to track.") + alert: List[str] = Field( + default=DEFAULT_ALERT_OBJECTS, title="Objects to create alerts for." + ) filters: Dict[str, FilterConfig] = Field(default={}, title="Object filters.") mask: Union[str, List[str]] = Field(default="", title="Object mask.") diff --git a/frigate/review/maintainer.py b/frigate/review/maintainer.py index 88b41001e..fd409b8fc 100644 --- a/frigate/review/maintainer.py +++ b/frigate/review/maintainer.py @@ -113,7 +113,10 @@ class ReviewSegmentMaintainer(threading.Thread): segment.detections.add(object["id"]) segment.objects.add(object["label"]) - if object["has_clip"]: + if ( + object["has_clip"] + and object["label"] in camera_config.objects.alert + ): segment.severity = SeverityEnum.alert if len(object["current_zones"]) > 0: @@ -150,7 +153,11 @@ class ReviewSegmentMaintainer(threading.Thread): zones: set = set() for object in active_objects: - if not has_sig_object and object["has_clip"]: + if ( + not has_sig_object + and object["has_clip"] + and object["label"] in camera_config.objects.alert + ): has_sig_object = True detections.add(object["id"])