From 4cfbda8f928f81ff0cac27dcaa56f74cca77b5e1 Mon Sep 17 00:00:00 2001 From: Nick Mowen Date: Fri, 27 May 2022 12:39:21 -0600 Subject: [PATCH] Use enum to restrict values --- frigate/config.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/frigate/config.py b/frigate/config.py index 7beaab45c..ae5e9ee80 100644 --- a/frigate/config.py +++ b/frigate/config.py @@ -277,6 +277,13 @@ class RuntimeFilterConfig(FilterConfig): extra = Extra.ignore +class BoundingBoxTriggerEnum(str, Enum): + bottom_center = "bottom-center" + left_center = "left-center" + top_center = "top-center" + right_center = "right-center" + + # this uses the base model because the color is an extra attribute class ZoneConfig(BaseModel): filters: Dict[str, FilterConfig] = Field( @@ -289,8 +296,8 @@ class ZoneConfig(BaseModel): default_factory=list, title="List of objects that can trigger the zone.", ) - bounding_box_trigger: str = Field( - default="bottom-center", + bounding_box_trigger: BoundingBoxTriggerEnum = Field( + default=BoundingBoxTriggerEnum.bottom_center, title="Point of an objects bounding box that triggers this zone.", ) _color: Optional[Tuple[int, int, int]] = PrivateAttr()