add enabled config to zones

This commit is contained in:
Josh Hawkins 2026-01-15 12:09:31 -06:00
parent 9128881924
commit e9aebbe53f
3 changed files with 12 additions and 0 deletions

View File

@ -197,6 +197,10 @@ class CameraState:
if draw_options.get("zones"): if draw_options.get("zones"):
for name, zone in self.camera_config.zones.items(): for name, zone in self.camera_config.zones.items():
# skip disabled zones
if not zone.enabled:
continue
thickness = ( thickness = (
8 8
if any( if any(

View File

@ -18,6 +18,10 @@ class ZoneConfig(BaseModel):
title="Zone name", title="Zone name",
description="A user-friendly name for the zone, displayed in the Frigate UI. If not set, a formatted version of the zone name will be used.", description="A user-friendly name for the zone, displayed in the Frigate UI. If not set, a formatted version of the zone name will be used.",
) )
enabled: bool = Field(
default=True,
title="Whether this zone is active. Disabled zones are ignored at runtime.",
)
filters: dict[str, FilterConfig] = Field( filters: dict[str, FilterConfig] = Field(
default_factory=dict, default_factory=dict,
title="Zone filters", title="Zone filters",

View File

@ -188,6 +188,10 @@ class TrackedObject:
# check each zone # check each zone
for name, zone in self.camera_config.zones.items(): for name, zone in self.camera_config.zones.items():
# skip disabled zones
if not zone.enabled:
continue
# if the zone is not for this object type, skip # if the zone is not for this object type, skip
if len(zone.objects) > 0 and obj_data["label"] not in zone.objects: if len(zone.objects) > 0 and obj_data["label"] not in zone.objects:
continue continue