Motion events from different cameras are merged into one #110
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
When two cameras both detect motion within 60 seconds of each other, the day view and calendar merge their snapshots into a single event attributed to whichever camera fired first (almost always the first camera in the config). The second camera's motion event is invisible: wrong camera name, wrong thumbnail, wrong view link, and undercounted events on the calendar.
Expected: each camera's motion is detected independently. Simultaneous motion on two cameras shows two events side by side, and the calendar counts them both.
Root cause: group_into_events() in web/routes/clips.py is fed motion snapshots from all cameras as one chronologically-sorted stream, so snapshots from different cameras within gap_seconds of each other land in the same event. The event is then labelled with first_snapshot["camera"].
Plan: add group_events_per_camera() to events.py — partition the snapshot list by camera, run group_into_events() per camera, merge and sort the resulting events by start time. Swap both call sites in clips.py (day_view and days_list). TDD with five new tests in tests/test_events.py. Design spec reviewed locally.