dd2dd53d7e
- zone-anpr-poc: H.264 instead of MJPEG (load, delay, a car in the zone, staff traffic, bad weather); the relay-less test copy is left running - event-driven-refactor (new): the user's decisions of 2026-11-23, what is not decided, what they touch in today's code; waits for the user's guidelines - passage-confirmation: the 2026-11-19 phase order superseded; where the video work lives - vision-hardening, zone-anpr-poc-review: on-screen label read as a plate (moved by the user), day-time oversized box, still pause carried over - pointers on vision-service, camera-live-view, lane-presence-and-anpr-entry, dingtian-vs-mqtt, entry gates, standing decisions, open questions, overview, index Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RZgP5oZdzvo92Eouc9eRv5
55 lines
2.8 KiB
Markdown
55 lines
2.8 KiB
Markdown
---
|
|
type: decision
|
|
tags: [parking, decision, devices, transport]
|
|
sources: []
|
|
updated: 2026-11-23
|
|
status: settled
|
|
---
|
|
|
|
# Transport for the Relay Controller: HTTP/UDP now, MQTT parked
|
|
|
|
**Decision (2026-06-15): use direct HTTP + UDP for the [[dingtian-relay]] controller now. MQTT is
|
|
deliberately skipped, but kept on the radar** for when the system scales.
|
|
|
|
## Options the device supports
|
|
|
|
The Dingtian relay board speaks several protocols: Dingtian string (UDP/TCP), Dingtian binary
|
|
(UDP, optional multicast/password), **HTTP CGI**, **HTTP input-link push** (`input_link_url`),
|
|
**Modbus** (RTU/TCP/ASCII), and **MQTT**.
|
|
|
|
## Why not MQTT (yet)
|
|
|
|
- **A broker is new infrastructure** on a deliberately **single-purpose hardened appliance**
|
|
([[disk-os-hardening]]) — another service to install, secure, supervise, and keep alive.
|
|
- **Extra failure mode on the critical path.** Today host→UDP→relay. MQTT inserts a broker on both
|
|
control and event paths; if it stalls, the lane stalls — and there are 3 processes to debug, not 2.
|
|
- **Doesn't fit [[offline-first]] for this scale.** MQTT earns its keep with *many* devices/consumers
|
|
and intermittent links. Here it's **one host + a few devices on one isolated LAN, metres apart** —
|
|
request/response control + a single input event, no fleet.
|
|
- **The device's MQTT input publish is periodic** ("default every 30 s"), so it's not even a clean
|
|
on-press event without relying on unverified on-change behaviour.
|
|
|
|
## Why HTTP/UDP fits
|
|
|
|
- **Relay control:** direct **UDP string protocol** (port 60001) — `11`=relay1 on, `21`=off,
|
|
`T1`=toggle, `11*`=jog/pulse. No deps, no broker.
|
|
- **Input/button events:** the device's **`input_link_url`** can **HTTP POST to the host backend
|
|
when an input fires** — real push, device calls our existing Fastify server directly, no broker.
|
|
(Polling `00` status over UDP every ~50 ms is the self-contained fallback.)
|
|
- Fewest moving parts; matches the local same-origin model already in use.
|
|
|
|
## When to revisit MQTT
|
|
|
|
If the system grows to **many lanes / many controllers**, or multiple subsystems (LPR, payment,
|
|
signage) all need to share events, a broker becomes a worthwhile central event bus. That aligns
|
|
with the [[autonomous-direction|unmanned]] roadmap at multi-lane scale — re-evaluate then. Until
|
|
then, direct HTTP/UDP wins on simplicity and reliability.
|
|
|
|
## The condition is met (2026-11-23)
|
|
|
|
The user decided a bus between the vision side, the server and the booth screen, as part of an
|
|
event-driven refactor of the repository ([[event-driven-refactor]]). That is the case named
|
|
above: several subsystems sharing events. Which bus is not decided, and nothing here says the
|
|
relay controller moves onto it. The objections above (new infrastructure on the appliance, one
|
|
more thing on the path that opens the barrier) still want an answer in that plan.
|