feat(firmware): relay-proxy PoC — NodeMCU as a Dingtian DT-R004 + cloud proxy/watchdog

A NodeMCU v3 (ESP8266) that speaks the Dingtian wire contract (binary UDP 60000 with
relay_pw, string UDP 60001, config CGI incl. the setconfig gotcha, userset.cgi, Digest
input push) so the booth's existing driver needs no change, plus a heartbeat/command/
watchdog path to an ephemeral cloud stand-in (poc/cloud-standin.mjs). Verified at park-lab:
the booth's assign flow configured it like real hardware and a button press reached the
booth (401→Digest→200) and the cloud with the booth's status. Watchdog probes /health and
power-cycles the PC via a spare relay with backoff. IO behind one interface for the ESP32/
Dingtian port.

wiki: relay-proxy-firmware page; esp32-flashability-test runbook (esptool lock test);
dingtian-relay "can we flash our own firmware" (vendor locks the standard SKU);
site-device-installation: booth ufw must allow device-net → 3000 (push targets PORT, not
Caddy's 80); open-questions: cloud takeover vs signed ledger (parked).

.gitignore: firmware venv/.pio/secrets.h.
This commit is contained in:
2026-10-22 12:08:20 +02:00
parent e842f036e2
commit c08e232339
19 changed files with 1162 additions and 1 deletions
+28 -1
View File
@@ -2,7 +2,7 @@
type: entity
tags: [parking, hardware, access-control, relay]
sources: []
updated: 2026-06-14
updated: 2026-10-22
---
# Dingtian Relay Controller
@@ -170,6 +170,33 @@ On assign the driver runs `harden()` (the [[device-registry|HardenableDevice]] c
> drop connections (ECONNRESET), locking out the API the driver depends on — recoverable only by
> factory reset. `harden()` deliberately never touches it.
## Can we flash our own firmware? (2026-10-22)
The DT-R0xx boards are **ESP32-WROOM-32D** designs (the module is visible in product photos; the
community ESPHome/Tasmota configs target ESP32). Relays/inputs are behind **74HC595 / 74HC165
shift registers** (SDI GPIO13, CLK GPIO14, RCK GPIO15, PL GPIO32, Q7 GPIO16); Ethernet is a
**JL1101 PHY** (MDC 23, MDIO 18, clock out 17, power 0). Community firmware exists: Tasmota
templates (Dingtian ships them in its own download centre) and an ESPHome external component
`dtr0xx_io`.
**But the vendor sells two SKUs.** The *Standard Firmware Version* (default shipment) is locked —
dtwonder: "The standard finished firmware version is not intended for user firmware flashing";
ESPHome devices page: "ask for relay board with test firmware, otherwise the ESP32 will be locked".
The *Development Board Version* ships with a bare "GPIO test firmware" and is meant for ESPHome /
Tasmota / ESP-IDF. The lock mechanism is not documented publicly (flash encryption, secure boot,
or UART-download-disable eFuses are all plausible on an ESP32 — eFuses are irreversible). No
forum post reports successfully unlocking a standard unit. Flashing a dev unit is plain ESP32
serial flashing (NRST↔DTR, 3.3 V USB-UART, hold the boot switch while powering).
**Implication for us:** our bench unit (DT-R004, V3.1.5461A, standard SKU) should be assumed
**not flashable** until tested — runbook: [[esp32-flashability-test]]; a dev-SKU unit would be. Custom firmware would let us close the open CGI/UDP
control plane (the hardening gaps above) by putting [[challenge-response-auth]] on the device —
effectively the [[esp32-custom-controller]] path on vendor hardware (no [[atecc608]] footprint,
so the key would live in ESP32 eFuse/NVS under flash encryption). That remains **deferred**
([[open-questions]] #6); if revisited, order the dev SKU and note the relay-GPIO pull-down
"relays blip on at boot" report on Tasmota — a boot-time relay pulse on a barrier is unacceptable
([[barrier-not-a-door]]) and must be verified before any field use.
## `relayPassword` field + the "offline despite ping" gotcha (2026-06-24)
`relay_pw` is in **every** binary frame — control AND the status read `healthCheck()` uses. With a