diff --git a/frigate/config.py b/frigate/config.py index 0b7d38619..a01e349a8 100644 --- a/frigate/config.py +++ b/frigate/config.py @@ -342,6 +342,10 @@ class MotionConfig(FrigateBaseModel): def serialize_mask(self, value: Any, info): return self.raw_mask + @field_serializer("raw_mask", when_used="json") + def serialize_raw_mask(self, value: Any, info): + return None + class RuntimeMotionConfig(MotionConfig): raw_mask: Union[str, List[str]] = "" @@ -373,6 +377,10 @@ class RuntimeMotionConfig(MotionConfig): def serialize_mask(self, value: Any, info): return self.raw_mask + @field_serializer("raw_mask", when_used="json") + def serialize_raw_mask(self, value: Any, info): + return None + model_config = ConfigDict(arbitrary_types_allowed=True, extra="ignore") @@ -458,6 +466,10 @@ class FilterConfig(FrigateBaseModel): def serialize_mask(self, value: Any, info): return self.raw_mask + @field_serializer("raw_mask", when_used="json") + def serialize_raw_mask(self, value: Any, info): + return None + class AudioFilterConfig(FrigateBaseModel): threshold: float = Field( diff --git a/frigate/http.py b/frigate/http.py index 807a14659..9d0973546 100644 --- a/frigate/http.py +++ b/frigate/http.py @@ -1384,7 +1384,7 @@ def end_event(event_id): @bp.route("/config") def config(): - config = current_app.frigate_config.model_dump(mode="json") + config = current_app.frigate_config.model_dump(mode="json", exclude_none=True) # remove the mqtt password config["mqtt"].pop("password", None) @@ -1404,9 +1404,9 @@ def config(): config["plus"] = {"enabled": current_app.plus_api.is_active()} for detector, detector_config in config["detectors"].items(): - detector_config["model"]["labelmap"] = ( - current_app.frigate_config.model.merged_labelmap - ) + detector_config["model"][ + "labelmap" + ] = current_app.frigate_config.model.merged_labelmap return jsonify(config)