feat(anpr): read every frame, settle every plate, debounce per plate
Build & push images / images (push) Successful in 3m9s

Measured on park-2 (i5-9500): a main-stream pull is ~0.1s and /analyze
~0.25s while the host sat under 3% CPU; the loop's fixed 1s sleep was the
limit (one frame per ~1.35s). The camera's picture endpoint is single-
threaded (4 parallel GETs -> two 503s) and the vision service serialises
inference, so no threads: pulls are back-to-back and serial per camera,
~3 fps. ANPR_POLL_MS is now a floor (default 0).

The loop no longer breaks on the first confident plate, and the 12s
camera-level debounce is gone: 40 of 57 plate-driven opens at park-2 had a
push dropped in that blind window, so a tailgating car was never looked at.
Each confident plate is settled once per loop (emit / anpr-skip / decline)
and the loop runs on while the camera keeps pushing, so a second car is
read by the same loop. Debounce is keyed deviceId:plate only; the card/QR
mid-poll guard is per subscriber instead of aborting the loop; the pass
sample is one per plated car. ANPR_POLL_WINDOW_MS=0 is honoured (it used to
fall back to 8s silently).

The camera event model was re-confirmed from 2780 pushes: every push is an
independent VMD/active with activePostCount=1, ~1.2s apart while a car
moves, never inactive. Nothing is held for 30s on the camera side.
This commit is contained in:
2026-10-11 18:17:25 +02:00
parent 7b29331f52
commit d93089a491
5 changed files with 337 additions and 154 deletions
+32
View File
@@ -3496,3 +3496,35 @@ prompt: Cancel aborts, empty proceeds; en/sq texts say optional. [[forgiven-exit
User trimmed the Albanian copy ("Too much fal, falur, falje") and asked for the same in
English: buttons, dialog, results, live-feed reasons, shift figures, the printed Z line and the
signed English fallback now say manual exit; identifiers unchanged. [[forgiven-exit]] §Wording.
## [2026-10-09] incident | park-2 "barrier opened by itself" — it was a manual exit on an empty lane
Operator claimed the exit barrier opened for an unknown car at ~15:50. Ledger + snapshots: the
only server-commanded open was a Dalje Manuale at 15:45:19 (admin account, exit lane empty in
its snapshot); the 15:50 van got no command, no plate, no card. CCTV confirmed. 18 manual exits
that day, all as `admin`, no reason — prepaid cards get "no open session" at the exit readers.
Exposed: pulses logged only on failure; no loop/arm input on the exit side; camera OSD +6 h.
## [2026-10-09] built | Every relay pulse logged + echoed to device_events (kind `relay`)
`pulseBarrier` (apps/server/src/relay-pulse.ts) is now the one pulse path for all six callers;
info line per pulse with relay/controller/direction/identity/source/operator, and a device_events
row for success and failure. [[device-events]] updated.
## [2026-10-09] built | Hikvision clock sync now owns the time ZONE (fixed offset, host-rewritten at DST)
park-2 cameras sat on factory CST-8 (instant right, OSD six hours off, so the drift-only sync
never fired); the G3H firmware ignores the DST rule in a POSIX zone string. `syncClock` writes
the site's current offset as a fixed zone; the monitor re-syncs at the site's UTC-offset edge.
Both park-2 cameras set by hand the same day. [[lpr-camera]] §Clock sync.
## [2026-10-11] built | ANPR bridge reads every frame, settles every plate, debounces per plate
Measured park-2 (i5-9500): pull ~0.1 s, analyze ~0.25 s, host idle — the loop's fixed 1 s sleep was
the limit (1 frame/1.35 s). The camera is single-threaded (4 parallel GETs → 2×503) and `/analyze`
serialises (4 parallel → 1.03 s each), so no threads: back-to-back serial pulls (~3 fps/camera,
`ANPR_POLL_MS` now a floor, default 0). The loop no longer breaks on the first confident plate and the
12 s CAMERA-level debounce is gone (40 of 57 plate opens had a push dropped in that blind window) —
each plate is settled once per loop, debounce keyed `deviceId:plate`, credential-race guard per
subscriber, pass sample per plated car. Also re-confirmed the camera event model: 2780 pushes, all
`activePostCount=1`, median 1.2 s apart, never `inactive` — nothing is held for 30 s on the camera
side. `anpr-entry.ts`, `anpr-entry.test.ts` (20), [[lane-presence-and-anpr-entry]] updated.