Files
charging_station/wiki/overview.md
T
julian 3326c8d16c 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.
2026-07-11 18:58:20 +02:00

5.0 KiB

type, updated, tags
type updated tags
meta 2026-07-11
synthesis

Overview — Anfu Home Charger OCPP Project

Goal: a private, self-hosted ocpp backend (CSMS) for a home EV charger. No billing, no public charging. Authorization via existing RFID cards ✅ and a mobile-friendly web app reached over netbird (by-vehicle ❌ closed — firmware never forwards a vehicle id). Scope expanded 2026-07-11: the same backend also controls the household wifi-relays, locally via tinytuya.

Current state (2026-07-11)

Connectivity: ✅ solved. The jc-6620 controller inside the anfu-charger reliably dials out to the CSMS — verified both on the charger's own LAN (192.168.2.114:9000) and across the NAT boundary on the WAN subnet (10.0.10.203:9000). Getting here required the fixes catalogued in troubleshooting; the network layout is in network-topology.

Software: production backend built (2026-07-11), including the web panel. station.py was ported into the ../backend/ package: one FastAPI process on port 9000 = CSMS WebSocket + /api/* (charger control, allowlist CRUD, runtime learn-mode flip) + wifi-relays on/off/toggle + multi-user auth (username/password, per-resource scopes: gun 1 / gun 2 / per-relay / admin, per-gun-restrictable RFID cards — authorization) + consumption tracking (SQLite: who charged, when, how many kWh, per-minute meter samples) + the PWA control panel at / (login, scope-filtered start/stop buttons, relay toggles, history, admin). Smoke-tested (37 checks incl. a fake charge point over the real WS route); ⚠️ not yet run against the live charger or a real phone. The csms-toolkit (../discovering/) remains as diagnostic tooling.

Capabilities: ✅ known. The live probe (2026-07-09-discovery-eu092025) identified the pile as SimpleCharge "MultiSocketCharger" (fw 1.24.0620.1, OCPP ID eu092025) with two guns, RemoteTrigger (verified), SmartCharging, Reservation, a 6-entry local auth list, and per-minute meter data including SoC. Only Autocharge remains unknown (physical test pending; MacEnabled is a lead — authorization).

Authorization: 2 of 3 methods ✅ verified live (2026-07-09 test session, both cars plugged, both guns charging simultaneously):

  • RFID ✅ — card …393 tapped → Authorize → real charging session on gun 2 (DC, ~26 kW avg, 1.8 kWh delivered). Card enrolled as "RFID card A".
  • Remote (app path) ✅ — RemoteStart and RemoteStop both Accepted and executed on gun 1; app-remote token enrolled.
  • By vehicle ❌ closed — three escalating tests (plain plug-in, MacEnabled=true live, MacEnabled=true after power-cycle) all negative; this firmware never forwards a vehicle ID over OCPP (authorization).

Hardware surprise: this is a DC-capable multi-standard charger (gun 1 EU, gun 2 Chinese GB/T @ 30 kW), not the assumed basic AC unit — see anfu-charger.

What's next

  1. Cut the live charger over to the backend — stop station.py, run python -m backend.main from the repo root, verify the JC-6620 reconnects and a card tap still authorizes (allowlist already migrated to backend/config.json).
  2. Create the real users — python -m backend.users add <name> --scopes ... for each household member (the API stays open until the first user exists).
  3. Extract the Tuya local keys (tinytuya wizard — steps in wifi-relays) and fill backend/config.json → relays become controllable.
  4. Flip learn mode off — both cards + the app token are enrolled; switchable from the panel's Admin tab or POST /api/mode?learn=false, no restart. (Only wait if more cards need tapping.)
  5. Test the panel from a phone — it's built and serving at http://<host>:9000/; verify login, a real button-push start on a ready gun, and add-to-home-screen over netbird.
  6. Resolve the ❓ remote-stop restart question — did the gun-2 session auto-restart from auth cache after RemoteStop, or was the card re-tapped? Affects the app's Stop button UX (authorization).

Open decisions ❓

Decision Options Status
Always-on host for CSMS + app LAN PC · the 10.0.10.203 machine · dedicated box (e.g. Pi on charger LAN, joined to NetBird) open — now also needs subnet reachability to the [[wifi-relays
Web app auth — ✅ resolved 2026-07-11: username+password login with per-resource scopes (gun 1 / gun 2 / per-relay / admin) — see authorization. Bootstrap: create the first admin user via python -m backend.users add
Autocharge / by vehicle — ❌ closed 2026-07-09: not supported by this firmware (authorization)
Host IP stability static IP · DHCP reservation open (required either way — touchscreen URL is hardcoded)

Sources