mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-02-08 20:25:26 +03:00
Don't include null values in config json
This commit is contained in:
parent
c70f4940e9
commit
0810984c40
@ -342,6 +342,10 @@ class MotionConfig(FrigateBaseModel):
|
|||||||
def serialize_mask(self, value: Any, info):
|
def serialize_mask(self, value: Any, info):
|
||||||
return self.raw_mask
|
return self.raw_mask
|
||||||
|
|
||||||
|
@field_serializer("raw_mask", when_used="json")
|
||||||
|
def serialize_raw_mask(self, value: Any, info):
|
||||||
|
return None
|
||||||
|
|
||||||
|
|
||||||
class RuntimeMotionConfig(MotionConfig):
|
class RuntimeMotionConfig(MotionConfig):
|
||||||
raw_mask: Union[str, List[str]] = ""
|
raw_mask: Union[str, List[str]] = ""
|
||||||
@ -373,6 +377,10 @@ class RuntimeMotionConfig(MotionConfig):
|
|||||||
def serialize_mask(self, value: Any, info):
|
def serialize_mask(self, value: Any, info):
|
||||||
return self.raw_mask
|
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")
|
model_config = ConfigDict(arbitrary_types_allowed=True, extra="ignore")
|
||||||
|
|
||||||
|
|
||||||
@ -458,6 +466,10 @@ class FilterConfig(FrigateBaseModel):
|
|||||||
def serialize_mask(self, value: Any, info):
|
def serialize_mask(self, value: Any, info):
|
||||||
return self.raw_mask
|
return self.raw_mask
|
||||||
|
|
||||||
|
@field_serializer("raw_mask", when_used="json")
|
||||||
|
def serialize_raw_mask(self, value: Any, info):
|
||||||
|
return None
|
||||||
|
|
||||||
|
|
||||||
class AudioFilterConfig(FrigateBaseModel):
|
class AudioFilterConfig(FrigateBaseModel):
|
||||||
threshold: float = Field(
|
threshold: float = Field(
|
||||||
|
|||||||
@ -1384,7 +1384,7 @@ def end_event(event_id):
|
|||||||
|
|
||||||
@bp.route("/config")
|
@bp.route("/config")
|
||||||
def 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
|
# remove the mqtt password
|
||||||
config["mqtt"].pop("password", None)
|
config["mqtt"].pop("password", None)
|
||||||
@ -1404,9 +1404,9 @@ def config():
|
|||||||
config["plus"] = {"enabled": current_app.plus_api.is_active()}
|
config["plus"] = {"enabled": current_app.plus_api.is_active()}
|
||||||
|
|
||||||
for detector, detector_config in config["detectors"].items():
|
for detector, detector_config in config["detectors"].items():
|
||||||
detector_config["model"]["labelmap"] = (
|
detector_config["model"][
|
||||||
current_app.frigate_config.model.merged_labelmap
|
"labelmap"
|
||||||
)
|
] = current_app.frigate_config.model.merged_labelmap
|
||||||
|
|
||||||
return jsonify(config)
|
return jsonify(config)
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user