docs(wiki): discovery results, architecture, auth model, backend + relay pages

Ingests the 2026-07-09 live session (source page + raw GetConfiguration
dump): charger identified as SimpleCharge MultiSocketCharger, 60 kW DC
dual-standard (gun 1 EU/CCS, gun 2 GB/T); RFID and remote start/stop
verified; by-vehicle auth closed as not supported (three escalating tests
incl. MacEnabled=true after power-cycle); touchscreen-shows-VIN observation
with the DataTransferVendorId long-shot lead.

Adds/updates: architecture plan (FastAPI + PWA, phases 1-3 done), backend
entity, wifi-relays entity (Tuya local-control path + key extraction steps),
authorization concept (API user/scope model, per-gun cards), overview,
runbook, index, log.
This commit is contained in:
2026-07-11 18:58:20 +02:00
parent d7b17d9cb2
commit 3326c8d16c
12 changed files with 713 additions and 31 deletions
+14 -3
View File
@@ -1,6 +1,6 @@
---
type: entity
updated: 2026-07-09
updated: 2026-07-11
tags: [software, csms]
---
@@ -8,6 +8,8 @@ tags: [software, csms]
The Python scripts that play the CSMS (backend) side of the [[ocpp|OCPP]] link. Currently discovery/tester-grade; `station.py` is the seed of the real controller. Per [[2026-07-09-findings-and-requirements]]:
> [!warning] Superseded for production (2026-07-11): `station.py` was ported into the [[backend]] package (`../backend/`), which adds allowlist CRUD, optional API token auth, and [[wifi-relays|Tuya relay]] control. `discovering/` stays as the discovery/diagnostic toolkit (`csms.py`, `rawlisten.py`, fake charge point) — don't run `station.py` and the backend at the same time; both bind port 9000.
| File | Purpose |
|---|---|
| `csms.py` | Minimal OCPP 1.6J server — accepts everything, logs raw frames. Discovery/tester. |
@@ -16,10 +18,19 @@ The Python scripts that play the CSMS (backend) side of the [[ocpp|OCPP]] link.
| `station_config.json` | `{ "learn_mode": bool, "authorized": { "<idTag>": {name, kind} } }` |
| `seen_tags.json` | Auto-recorded log of every idTag observed (discovery / Autocharge testing). |
- **Runtime:** Python venv with `websockets` 16.0 + `ocpp`; listens on `ws://0.0.0.0:9000/<chargePointId>`.
- **Runtime:** Python venv with `fastapi` + `uvicorn` + `ocpp` (2026-07-09: `station.py` moved from raw `websockets` to a single FastAPI/uvicorn process — the phase-1 shape from [[architecture-plan]]).
- **Single port 9000:** the OCPP WebSocket (`ws://0.0.0.0:9000/<chargePointId>`, any path) *and* the discovery HTTP API share it, so the hardcoded touchscreen URL never changes.
- **The one gate:** every [[authorization]] method funnels through `decide(id_tag)` in `station.py` — Accepted/Rejected against the allowlist.
- **Host requirements:** inbound TCP 9000 open (Windows firewall silently drops otherwise — see [[troubleshooting]]) and a stable IP, since the [[anfu-charger|charger touchscreen]] URL is hardcoded.
## Discovery API (in `station.py`, docs at `http://<host>:9000/docs`)
- Auto-interrogation on every charger connect: `GetConfiguration` (all keys) + `TriggerMessage(StatusNotification)` → saved to `discovery_<id>.json` (first real capture: [[2026-07-09-discovery-eu092025]])
- **Event journal:** every OCPP event (connect/disconnect, boot, status, authorize, start/stop transaction, meter values) is appended as one JSON line to `events.jsonl` — permanent, restart-proof, greppable; tail it via `GET /events?limit=N&event=<kind>`
- `GET /status` (chargers, guns, transactions, auth events) · `GET /tags` (seen + authorized)
- `POST /probe` · `/start` · `/stop[/{tx}]` · `/trigger/{status|meter|heartbeat|boot}` · `/unlock/{connector}` · `/setconfig?key=&value=`
- With one charger connected, `?cp=` may be omitted. ✅ Verified end-to-end against both a fake charge point and the real charger.
## Still to build
The web control panel (remote start/stop, live status, allowlist management) served behind [[netbird|NetBird]] — see [[overview]] for the plan and open host decision.
The web control panel (remote start/stop, live status, allowlist management) served behind [[netbird|NetBird]] — now on the [[backend]], see [[overview]] for the plan and open host decision.