mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-10-07 23:32:48 +03:00
Refactor birdseye activity modes as a list and add alerts/detections (#24012)
* backend * tests * frontend and i18n * e2e test schema * docs
This commit is contained in:
@@ -7,7 +7,7 @@ from unittest.mock import MagicMock, Mock, patch
|
||||
|
||||
import ruamel.yaml
|
||||
|
||||
from frigate.config import FrigateConfig
|
||||
from frigate.config import BirdseyeModeEnum, FrigateConfig
|
||||
from frigate.config.camera.updater import (
|
||||
CameraConfigUpdateEnum,
|
||||
CameraConfigUpdatePublisher,
|
||||
@@ -383,22 +383,15 @@ class TestConfigSetWildcardPropagation(BaseTestHttp):
|
||||
Global birdseye only seeds enabled and mode; the camera copies are what
|
||||
the output process actually reads. Sending just the global object makes
|
||||
a worker guess which cameras were inheriting, and the only available
|
||||
guess (mode still equals the previous global) wrongly claims a camera
|
||||
whose explicit yaml mode happens to match.
|
||||
guess (modes still equals the previous global) wrongly claims a camera
|
||||
whose explicit yaml modes happens to match.
|
||||
"""
|
||||
self.minimal_config["birdseye"] = {
|
||||
"enabled": True,
|
||||
"mode": {"motion": True},
|
||||
"modes": ["motion"],
|
||||
}
|
||||
# explicit override that matches the global value being replaced
|
||||
self.minimal_config["cameras"]["front_door"]["birdseye"] = {
|
||||
"mode": {
|
||||
"continuous": False,
|
||||
"motion": True,
|
||||
"objects": False,
|
||||
"stationary_objects": False,
|
||||
}
|
||||
}
|
||||
self.minimal_config["cameras"]["front_door"]["birdseye"] = {"modes": ["motion"]}
|
||||
|
||||
config_path = self._write_config_file()
|
||||
mock_find_config.return_value = config_path
|
||||
@@ -409,16 +402,7 @@ class TestConfigSetWildcardPropagation(BaseTestHttp):
|
||||
resp = client.put(
|
||||
"/config/set",
|
||||
json={
|
||||
"config_data": {
|
||||
"birdseye": {
|
||||
"mode": {
|
||||
"continuous": True,
|
||||
"motion": False,
|
||||
"objects": False,
|
||||
"stationary_objects": False,
|
||||
}
|
||||
}
|
||||
},
|
||||
"config_data": {"birdseye": {"modes": ["continuous"]}},
|
||||
"update_topic": "config/birdseye",
|
||||
"requires_restart": 0,
|
||||
},
|
||||
@@ -430,7 +414,7 @@ class TestConfigSetWildcardPropagation(BaseTestHttp):
|
||||
mock_publisher.publisher.publish.assert_called_once()
|
||||
topic, settings = mock_publisher.publisher.publish.call_args[0]
|
||||
self.assertEqual(topic, "config/birdseye")
|
||||
self.assertEqual(settings.mode.to_mqtt_payload(), "CONTINUOUS")
|
||||
self.assertEqual(settings.modes, [BirdseyeModeEnum.continuous])
|
||||
|
||||
published = {
|
||||
call[0][0].camera: call[0][1]
|
||||
@@ -445,10 +429,10 @@ class TestConfigSetWildcardPropagation(BaseTestHttp):
|
||||
|
||||
# the override survives, the inheriting camera follows global
|
||||
self.assertEqual(
|
||||
published["front_door"].mode.to_mqtt_payload(), "MOTION"
|
||||
published["front_door"].modes, [BirdseyeModeEnum.motion]
|
||||
)
|
||||
self.assertEqual(
|
||||
published["back_yard"].mode.to_mqtt_payload(), "CONTINUOUS"
|
||||
published["back_yard"].modes, [BirdseyeModeEnum.continuous]
|
||||
)
|
||||
finally:
|
||||
os.unlink(config_path)
|
||||
|
||||
Reference in New Issue
Block a user