don't apply max severity when alerts/detections are disabled

This commit is contained in:
Josh Hawkins 2024-12-16 09:27:52 -06:00
parent a138f0e732
commit fc1a69c51e
2 changed files with 21 additions and 10 deletions

View File

@ -184,7 +184,7 @@ class EventProcessor(threading.Thread):
) )
# keep these from being set back to false because the event # keep these from being set back to false because the event
# may have started while recordings and snapshots were enabled # may have started while recordings/snapshots/alerts/detections were enabled
# this would be an issue for long running events # this would be an issue for long running events
if self.events_in_process[event_data["id"]]["has_clip"]: if self.events_in_process[event_data["id"]]["has_clip"]:
event_data["has_clip"] = True event_data["has_clip"] = True
@ -199,7 +199,9 @@ class EventProcessor(threading.Thread):
Event.end_time: end_time, Event.end_time: end_time,
Event.zones: list(event_data["entered_zones"]), Event.zones: list(event_data["entered_zones"]),
Event.thumbnail: event_data["thumbnail"], Event.thumbnail: event_data["thumbnail"],
Event.has_clip: event_data["has_clip"], Event.has_clip: event_data["has_clip"]
if event_data.get("max_severity")
else False,
Event.has_snapshot: event_data["has_snapshot"], Event.has_snapshot: event_data["has_snapshot"],
Event.model_hash: first_detector.model.model_hash, Event.model_hash: first_detector.model.model_hash,
Event.model_type: first_detector.model.model_type, Event.model_type: first_detector.model.model_type,

View File

@ -64,18 +64,27 @@ class TrackedObject:
def max_severity(self) -> Optional[str]: def max_severity(self) -> Optional[str]:
review_config = self.camera_config.review review_config = self.camera_config.review
if self.obj_data["label"] in review_config.alerts.labels and ( if (
not review_config.alerts.required_zones self.camera_config.review.alerts.enabled
or set(self.entered_zones) & set(review_config.alerts.required_zones) and self.obj_data["label"] in review_config.alerts.labels
and (
not review_config.alerts.required_zones
or set(self.entered_zones) & set(review_config.alerts.required_zones)
)
): ):
return SeverityEnum.alert return SeverityEnum.alert
if ( if (
not review_config.detections.labels self.camera_config.review.detections.enabled
or self.obj_data["label"] in review_config.detections.labels and (
) and ( not review_config.detections.labels
not review_config.detections.required_zones or self.obj_data["label"] in review_config.detections.labels
or set(self.entered_zones) & set(review_config.detections.required_zones) )
and (
not review_config.detections.required_zones
or set(self.entered_zones)
& set(review_config.detections.required_zones)
)
): ):
return SeverityEnum.detection return SeverityEnum.detection