feat(v1): edit detection sensitivity from the settings tab

Adds write_local_event_tuning and a sensitivity group (confirm window,
horizontal angle, require-rapid-drop, require-lower-body) that persists to
the untracked local config and applies next start. 79 tests pass.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
ila
2026-07-22 00:00:51 +08:00
co-authored by Claude Opus 4.8
parent 922609f236
commit d3cd8ecb55
7 changed files with 123 additions and 4 deletions
+26
View File
@@ -129,6 +129,32 @@ def test_write_local_camera_source_round_trips_through_load_config(tmp_path):
assert config.source_id == "hik"
def test_write_local_event_tuning_round_trips_and_preserves_other_fields(tmp_path):
from v1.config import write_local_event_tuning
config_file = tmp_path / "config.local.json"
_write_config(
config_file,
{"id": "seed", "host": "192.0.2.10", "username": "u", "password": "p"},
)
write_local_event_tuning(
config_file,
require_rapid_drop=True,
require_lower_body=True,
horizontal_angle_threshold_degrees=35.0,
confirm_window_seconds=2.5,
)
config = load_config(config_file)
assert config.event.require_rapid_drop is True
assert config.event.require_lower_body is True
assert config.event.horizontal_angle_threshold_degrees == 35.0
assert config.event.confirm_window_seconds == 2.5
# unrelated event fields are preserved from the seed
assert config.event.cooldown_seconds == 10.0
def test_public_example_config_has_no_embedded_credentials():
from pathlib import Path