Commit Graph

4 Commits

Author SHA1 Message Date
gx 37232ae1b9 controller: Phase 3 — Python sidecar skeleton (MQTT + ZMQ + HTTP + HA Discovery)
cuda-grid-controller (Python 3.11+) — control plane между HA/MQTT/HTTP
и FFmpeg's vf_cuda_grid filter через ZMQ.

Modules (~700 LOC Python):
- config.py — Pydantic schema (broker, instances[], ha_discovery, http, log) + YAML loader
- layouts.py — registry известных layouts (sync с vf_cuda_grid.c Phase 2)
- ha_discovery.py — HA MQTT Discovery payloads (select.layout, sensor.current_layout,
  binary_sensor.online per instance + global device entry)
- zmq_client.py — async ZMQ REQ socket к FFmpeg zmq filter
  (target command args → reply parsing)
- state.py — in-memory ControllerState (active_layout per instance, asyncio.Lock)
- mqtt_loop.py — aiomqtt async loop: subscribe cuda_grid/cmd/<inst>/+/+,
  publish cuda_grid/state/* (retained) + cuda_grid/event/*, LWT, HA status reconnect
- dispatch.py — CommandDispatcher: layout.set action → ZMQ send_command + state update + events
- http_api.py — FastAPI: /health, /layouts, /state, POST /layout/{inst}/set
- __main__.py — typer CLI, asyncio.gather(mqtt_loop, uvicorn.server)

Examples + Dockerfile:
- examples/controller.yaml — 2 instances (livingroom_tv, public_stream)
- Dockerfile — python:3.11-slim, ENTRYPOINT cuda-grid-controller
- README — overview, usage, FFmpeg side filter graph

End-to-end flow ready:
  HA dashboard → MQTT → controller → ZMQ → FFmpeg process_command → layout switch
  ↓
  state публикуется обратно в MQTT → HA UI обновляется

Phase 3 deliverable per gx/vf-cuda-grid#1. Phase 4 = overlays (rect/text/icon).
2026-05-19 21:52:11 +01:00
gx 06be41d245 readme: project overview + architecture diagram + phase table 2026-05-19 20:37:41 +01:00
gx 8a6afa53b3 initial: README + design document (architect-reviewed)
Design document (1124 строки) от ai-systems-architect — покрывает:
- High-level architecture (filter + sidecar + protocols)
- Component design + CUDA composition algorithm
- Layout DSL + dynamic creation
- Overlay system (7 types — rect/text/icon/image/dim/graph/chat)
- Control plane (ZMQ/MQTT/HTTP/HA Discovery, commands IN + events OUT)
- Audio orchestration (domofon ducking use case)
- Multi-instance behaviour (shared inputs, per-screen layout)
- Library choice — Python (FastAPI + asyncio)
- 6 phases implementation plan
- Migration path для cctv-processor (closes gx/cctv#22 Phase 4)
- Overlap analysis с gx/cctv#24 (superseded by cuda-grid-controller)

README — short описание + use cases + architecture diagram + phase table.

Implementation начнётся после ratification design'а и Phase 1 issue.
2026-05-19 20:36:47 +01:00
gx bf51325ca0 Initial commit 2026-05-19 20:35:31 +01:00