diff --git a/frigate/config.py b/frigate/config.py index 49195f51b..6d9dc9061 100644 --- a/frigate/config.py +++ b/frigate/config.py @@ -326,7 +326,8 @@ class BirdseyeConfig(FrigateBaseModel): ) -class BirdseyeCameraConfig(FrigateBaseModel): +# uses BaseModel because some global attributes are not available at the camera level +class BirdseyeCameraConfig(BaseModel): enabled: bool = Field(default=True, title="Enable birdseye view for camera.") mode: BirdseyeModeEnum = Field( default=BirdseyeModeEnum.objects, title="Tracking mode for camera." diff --git a/frigate/test/test_config.py b/frigate/test/test_config.py index 83bd94901..66e232135 100644 --- a/frigate/test/test_config.py +++ b/frigate/test/test_config.py @@ -84,7 +84,7 @@ class TestConfig(unittest.TestCase): def test_override_birdseye(self): config = { "mqtt": {"host": "mqtt"}, - "birdseye": { "enabled": True, "mode": "continuous" }, + "birdseye": {"enabled": True, "mode": "continuous"}, "cameras": { "back": { "ffmpeg": { @@ -97,10 +97,7 @@ class TestConfig(unittest.TestCase): "width": 1920, "fps": 5, }, - "birdseye": { - "enabled": False, - "mode": "motion" - }, + "birdseye": {"enabled": False, "mode": "motion"}, } }, } @@ -111,10 +108,10 @@ class TestConfig(unittest.TestCase): assert not runtime_config.cameras["back"].birdseye.enabled assert runtime_config.cameras["back"].birdseye.mode is BirdseyeModeEnum.motion - def test_inherit_birdseye(self): + def test_override_birdseye_non_inheritable(self): config = { "mqtt": {"host": "mqtt"}, - "birdseye": { "enabled": True, "mode": "continuous" }, + "birdseye": {"enabled": True, "mode": "continuous", "height": 1920}, "cameras": { "back": { "ffmpeg": { @@ -135,7 +132,34 @@ class TestConfig(unittest.TestCase): runtime_config = frigate_config.runtime_config assert runtime_config.cameras["back"].birdseye.enabled - assert runtime_config.cameras["back"].birdseye.mode is BirdseyeModeEnum.continuous + + def test_inherit_birdseye(self): + config = { + "mqtt": {"host": "mqtt"}, + "birdseye": {"enabled": True, "mode": "continuous"}, + "cameras": { + "back": { + "ffmpeg": { + "inputs": [ + {"path": "rtsp://10.0.0.1:554/video", "roles": ["detect"]} + ] + }, + "detect": { + "height": 1080, + "width": 1920, + "fps": 5, + }, + } + }, + } + frigate_config = FrigateConfig(**config) + assert config == frigate_config.dict(exclude_unset=True) + + runtime_config = frigate_config.runtime_config + assert runtime_config.cameras["back"].birdseye.enabled + assert ( + runtime_config.cameras["back"].birdseye.mode is BirdseyeModeEnum.continuous + ) def test_override_tracked_objects(self): config = {