Toggle review alerts and detections (#16482)

* backend

* frontend

* docs

* fix topic name and initial websocket state

* update reference config

* fix mqtt docs

* fix initial topics

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

* fix ws merge

* tweaks
This commit is contained in:
Josh Hawkins
2025-02-11 07:46:25 -07:00
committed by GitHub
parent c54259ecc6
commit 82f8694464
12 changed files with 290 additions and 52 deletions
+12
View File
@@ -13,6 +13,8 @@ DEFAULT_ALERT_OBJECTS = ["person", "car"]
class AlertsConfig(FrigateBaseModel):
"""Configure alerts"""
enabled: bool = Field(default=True, title="Enable alerts.")
labels: list[str] = Field(
default=DEFAULT_ALERT_OBJECTS, title="Labels to create alerts for."
)
@@ -21,6 +23,10 @@ class AlertsConfig(FrigateBaseModel):
title="List of required zones to be entered in order to save the event as an alert.",
)
enabled_in_config: Optional[bool] = Field(
default=None, title="Keep track of original state of alerts."
)
@field_validator("required_zones", mode="before")
@classmethod
def validate_required_zones(cls, v):
@@ -33,6 +39,8 @@ class AlertsConfig(FrigateBaseModel):
class DetectionsConfig(FrigateBaseModel):
"""Configure detections"""
enabled: bool = Field(default=True, title="Enable detections.")
labels: Optional[list[str]] = Field(
default=None, title="Labels to create detections for."
)
@@ -41,6 +49,10 @@ class DetectionsConfig(FrigateBaseModel):
title="List of required zones to be entered in order to save the event as a detection.",
)
enabled_in_config: Optional[bool] = Field(
default=None, title="Keep track of original state of detections."
)
@field_validator("required_zones", mode="before")
@classmethod
def validate_required_zones(cls, v):
+6
View File
@@ -534,6 +534,12 @@ class FrigateConfig(FrigateBaseModel):
camera_config.onvif.autotracking.enabled_in_config = (
camera_config.onvif.autotracking.enabled
)
camera_config.review.alerts.enabled_in_config = (
camera_config.review.alerts.enabled
)
camera_config.review.detections.enabled_in_config = (
camera_config.review.detections.enabled
)
# Add default filters
object_keys = camera_config.objects.track