Files
charging_station/wiki/raw/FINDINGS_AND_REQUIREMENTS.md
julian 2e5960fae3 feat: bootstrap wiki for Anfu home EV charger OCPP integration project
- Created initial wiki structure with CLAUDE.md schema, index.md, and log.md.
- Ingested findings and requirements document into the wiki.
- Added concepts for authorization methods, network topology, OCPP protocol, and troubleshooting.
- Documented entities including the Anfu charger, JC-6620 controller, and CSMS toolkit.
- Established configuration files for Obsidian app settings and workspace layout.
- Implemented core plugins and appearance settings for the wiki.
2026-07-09 15:29:26 +02:00

5.6 KiB
Raw Permalink Blame History

Anfu Home Charger — OCPP Integration: Findings & Requirements

Last updated: 2026-07-09

1. Goal

Run a private, self-hosted OCPP 1.6J backend (CSMS) for a home EV charger. No billing, no public charging. Authorization should be possible via:

  1. RFID cards already owned (tap to charge).
  2. By vehicle / chassis, if the hardware supports it (see §7 — has a caveat).
  3. A mobile / web app (start/stop charging), hosted securely behind an existing NetBird private network.

2. Hardware & Topology

The charging pile contains three networked devices behind its own router:

10.0.10.0/24  (upstream / WAN — main gateway lives here)
      │
   ┌──┴───────────────┐
   │  Four-Faith router │  WAN gets a 10.0.10.x address; NAT boundary
   └──┬───────────────┘
      │  LAN = 192.168.2.1  (mask 255.255.255.0)
      ├── 192.168.2.228  JC-6620 OCPP communication controller  ← the OCPP client
      ├── 192.168.2.118  EV charging controller (main control board), DHCP
      └── 192.168.2.114  maintenance PC (LAN side)
  • Wiring is the manufacturer's star topology: the EV charging controller and the JC-6620's fixed-IP (right) port each connect to a router LAN1–4 port.
  • The JC-6620 (192.168.2.228) is the device that opens the outbound OCPP WebSocket to the CSMS. It talks to the EV controller locally on port 2403.

3. CSMS software (this repo)

File Purpose
csms.py Minimal OCPP 1.6J server — accepts everything, logs raw frames. Discovery/tester.
rawlisten.py Dumb TCP listener on :9000 — shows whether any bytes arrive. Fallback diagnostic.
station.py The real controller. Allowlist-based auth + "learn mode" + hooks for remote start/stop.
station_config.json { "learn_mode": bool, "authorized": { "<idTag>": {name, kind} } }
seen_tags.json Auto-recorded log of every idTag observed (for discovery).

Runtime: Python venv with websockets (16.0) + ocpp. Server listens on ws://0.0.0.0:9000/<chargePointId>.

4. Charger-side configuration (touchscreen)

  • General Settings → Charger INEO: URL = ws://<CSMS-IP>:9000, ChargerID = <any>
  • Back Office → Universal: Billing Mode = BackgroundBilling, Communication Method = Ethernet, JC-6620 IP = 192.168.2.228, Port = 2403
  • JC-6620 network config (静态 IP): IP 192.168.2.228, mask 255.255.255.0, default gateway (默认网关) 192.168.2.1 (DNS not needed — CSMS is a bare IP).

5. Findings / gotchas (hard-won — check these first if it breaks)

  1. CSMS host firewall must allow inbound TCP 9000. Windows silently drops otherwise → looks like "charger never connects."
  2. Billing Mode must be BackgroundBilling. Until it is, the OCPP client never dials out at all (zero TCP SYNs). This was the blocker for the first connection.
  3. Communication Method must be Ethernet (not 4G/SIM).
  4. URL / network changes require a pile power-cycle to take effect.
  5. JC-6620 default gateway must be 192.168.2.1. It shipped as 192.168.2.228 (pointing at itself) — which reaches a same-subnet CSMS but cannot route to the WAN. This is why a 192.168.2.x CSMS worked but a 10.0.10.x CSMS did not, until the gateway was fixed.
  6. No port-forwarding needed on the charger router. The JC-6620 is the client and dials outbound; NAT handles LAN→WAN. Port-forwarding would only matter for inbound.
  7. The CSMS host needs a stable IP. The touchscreen URL is hardcoded, so the host must not change address (static IP or a DHCP reservation).

6. Verified working

  • ✅ Local CSMS at 192.168.2.114:9000 — JC-6620 connected, full BootNotification exchange.
  • ✅ Remote / WAN CSMS at 10.0.10.203:9000 (on the router's WAN subnet) — connected after fixing the JC-6620 default gateway. Confirms the CSMS can live upstream / off-subnet.

7. Requirements to build next

All three authorization methods funnel through one gate in station.py — decide(id_tag) → Accepted/Rejected against the allowlist. So the build is:

  • Allowlist enforcement — already implemented. Learn mode captures ids; flip learn_mode=false to enforce.
  • RFID cards — tap each card once in learn mode, harvest its idTag from seen_tags.json, add to authorized with a name. Works with existing cards.
  • By vehicle / chassis — ⚠️ needs a physical test. True VIN / Plug & Charge (ISO 15118) is unlikely on a basic AC unit. The lighter option is Autocharge: some chargers auto-send a per-vehicle idTag on plug-in (no card). Test = plug car in without tapping; if a stable idTag appears in seen_tags.json, whitelist it as kind:"car". If nothing appears, "by chassis" is not achievable on this hardware.
  • Mobile / web app — a web control panel (mobile-friendly, no app store) exposing Start/Stop via OCPP RemoteStartTransaction / RemoteStopTransaction, plus live status and clickable allowlist management. Bind to 0.0.0.0, reach it over NetBird. Optional access token/PIN for defense-in-depth.

8. Open decisions (for you)

  • Final host for the always-on CSMS + app: the LAN PC, the 10.0.10.203 machine, or a dedicated always-on box (e.g. a Pi on the charger LAN joined to NetBird)?
  • Web app auth: rely on NetBird network isolation only, or also require a PIN/token?
  • Autocharge: do we run the plug-in test to see if "by chassis" is even possible?
  • IP stability: static IP vs DHCP reservation for the chosen host.