При startup controller iterate'т FrigateBridge mappings и рендерит:
- offline_<cell>.png с camera label из placeholder_label (или frigate_camera
как fallback) — для каждого pad
- offline.png generic — для cells без mapping
Filter cuda_grid looks up "offline_<pad>.png" first per-cell, fallback к
"offline.png". User меняет yaml placeholder_label → restart controller →
PNGs регенерируются. Никаких ручных PNG manipulations.
Russian text supported (PIL + freetype, vs single-byte path в filter).
Pattern:
frigate.mappings:
- frigate_camera: parking_overview
placeholder_label: Парковка
cell: 0
...
При stale input на cell 0 → filter blits offline_0.png с "Парковка — НЕТ
СИГНАЛА" (текст желтый, transparent bg — filter сам fill'ит black за иконкой).
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Pipeline filter state (overlays, layout, cell_map, audio) живёт в RAM
ffmpeg process. При recreate container (compose up, OOM, NVENC crash,
config change) state lost — controller'у нужно re-push.
Раньше user'у приходилось вручную:
curl POST /layout/.../set
docker restart cuda-grid-controller # для browser/dynamic re-register
Теперь автоматизировано:
PipelineMonitor polls ZMQ каждые 3 sec (no-op set_layout).
On timeout/error → mark instance lost.
First success after lost → trigger restore:
1. set_layout к state.active_layout
2. set_audio_output_enabled к state.audio_output_enabled
3. re-push все overlays из state.overlays
4. browser/dynamic/frigate hooks: mark_all_unregistered() —
их loops автоматически re-add на next iteration
Verified test: docker restart cuda-grid-pipeline → 10 sec downtime →
monitor logs lost+restored+restore_done с count=6 overlays.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Frigate publishes 5-10 detection events/sec при motion → каждое emit ZMQ
overlay update к pipeline (mutex acquire, atlas rebuild). Это блокирует
render thread и вызывает TV stutter (см. cuda-grid-filter-stutter memory
2026-05-21 диагностика).
Throttle config:
bbox_min_interval_sec: 0.25 # max 4 updates/sec на event_id
bbox_delta_threshold: 0.02 # skip если все coords changed < 2% camera dim
State в self._event_bbox_last: event_id → (timestamp, nx, ny, nw, nh).
Cleanup в _remove_event_overlay (event end).
С default 0.25s + 0.02 threshold:
5-10 ev/sec → ~2-4 ev/sec applied (rate-limit), плюс stationary objects
не апдейтятся вообще (delta filter). Render-thread load на bbox flow
снижается 60-80%.
Эффект — можно вернуть bbox_overlay=true в controller.yaml без risk
TV stutter. Diagnostic-disable из 2026-05-21 теперь не нужен.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Hysteresis (FrigateBridgeCfg.auto_hysteresis_sec, default 3.0):
_update_auto_layout schedules debounced apply через asyncio.Task.
Каждый новый state event cancels pending timer (reset). Apply только
когда state стабилен N sec — short motion blips не дёргают layout.
Реверт set_mpp_main dispatch (mpp main fixed = parking):
Earlier attempt с streamselect@mpp_main + split=4 крашил pipeline
("Error while filtering: Invalid argument" — too complex filter graph).
Rolled back в infra; controller dispatch соответственно не пытается
set_mpp_main больше.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Issue: при layout switch overlays исчезали — каждый cuda_grid instance
(quad/single/mpp) имеет свой overlay state. add_overlay шёл только в один
target (cuda_grid@cg) → quad имел overlays, single/mpp без.
Fix:
InstanceCfg.overlay_filter_targets: list[str] (e.g. [cuda_grid@cg,
cuda_grid@cg_s, cuda_grid@cg_m]) — fallback к [filter_target] если empty.
Dispatcher._overlay_broadcast(cmd, arg) — sends к каждому target.
_overlay_add/remove/clear + _reload_icon now use broadcast.
Auto-layout debounce/hysteresis:
FrigateBridgeCfg.auto_hysteresis_sec (default 3.0)
_update_auto_layout schedules debounced apply через asyncio.Task;
каждый новый state event cancels pending timer (reset). Apply только
когда state стабилен N sec — short motion blips не дёргают layout.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Logic update в FrigateBridge._update_auto_layout:
0 active → quad
1 active → single, main_cam = active
2+ active → main_plus_preview, mpp_main = highest priority active
Dispatcher.set_mpp_main — ZMQ streamselect@mpp_main map <index>
Config.mpp_main_filter_target = "streamselect@mpp_main"
При каждом auto-layout change controller отправляет 3 ZMQ:
streamselect@main_cam map N (single layout main)
streamselect@mpp_main map N (mpp layout main, может быть тот же N)
streamselect@layout map L (final layout selector)
Preview cells в mpp остаются fixed mapping (cell1=cam1/front_yard, cell2=cam2/gate_lpr,
cell3=cam3/back_yard). Если main_cam = cam1/2/3 — preview slot этой cam visible duplicate.
Acceptable v2 trade-off (user warned).
Live verified: 4+ active cameras → mpp, gate_lpr в main slot (priority=10 highest).
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
FrigateCameraMapping +priority +main_cam_index — для auto-layout decision.
FrigateBridgeCfg.auto_layout flag — toggle через REST.
Logic (FrigateBridge._update_auto_layout):
0 active cameras → quad (default overview)
1+ active → single, main_cam = highest priority active
Equal priority → first active wins (deterministic)
Dispatcher.set_main_cam — ZMQ streamselect@main_cam map <index>
Config.main_cam_filter_target = "streamselect@main_cam"
REST:
GET /auto-layout/{instance} — current toggle state
POST /auto-layout/{instance} — { enabled: bool }
при включении сразу применяет
UI:
+ checkbox "auto" в Layout card — toggleAuto() hits POST /auto-layout
Live verified: enable → immediately picks layout=single, main=gate_lpr
(priority=10, highest active). Visual confirms gate_lpr full screen.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
User feedback: 4px motion border слишком жирная, к тому же много false motion
от Frigate (зоны/чувствительность будут tune'иться позже). Уменьшаем default
до 1px чтобы borders не мешали visually. Width конфигурируется (1..16).
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Frigate publishes на /motion/state ("ON"/"OFF") — а bare /motion это SET-topic
для control. Subscribe pattern был неправильный → bridge не получал motion events
→ red border не загорался при motion.
Live verified после fix: real motion от parking/gate_lpr/back_yard cameras
триггерит upsert cell_<N>_border с motion theme (red #FF0000, 4px, opacity 1.0).
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Permanent 1-2px рамка вокруг каждой cell для visual разделения.
При motion ON → рамка светится красным (config'и BorderTheme).
Logic:
_ensure_borders() Lazy init 4 borders (id="cell_N_border") при первом event
с idle стилем (#808080 width=2 opacity=0.4)
_set_border_state(motion=bool) Upsert тот же overlay с motion (#FF0000 width=4 opacity=1.0)
или idle styling
_cell_states set'у активных cams per cell ("inst:cell" → set(cam_names))
— border ON если хоть один cam имеет motion, OFF только когда
все cams cleared
BorderTheme:
idle_color/width/opacity subtle разделитель
motion_color/width/opacity alarm подсветка
configurable через cfg.frigate.border_theme
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>