From 3326c8d16c13042617a7aef49de4fbcb44b9c816 Mon Sep 17 00:00:00 2001 From: Julian Cuni Date: Sat, 11 Jul 2026 18:58:20 +0200 Subject: [PATCH] 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. --- wiki/concepts/authorization.md | 59 ++- wiki/entities/anfu-charger.md | 17 +- wiki/entities/backend.md | 57 +++ wiki/entities/csms-toolkit.md | 17 +- wiki/entities/wifi-relays.md | 28 ++ wiki/index.md | 14 +- wiki/log.md | 56 +++ wiki/notes/architecture-plan.md | 47 +++ wiki/notes/discovery-runbook.md | 38 ++ wiki/overview.md | 32 +- wiki/raw/discovery_eu092025.json | 336 ++++++++++++++++++ wiki/sources/2026-07-09-discovery-eu092025.md | 43 +++ 12 files changed, 713 insertions(+), 31 deletions(-) create mode 100644 wiki/entities/backend.md create mode 100644 wiki/entities/wifi-relays.md create mode 100644 wiki/notes/architecture-plan.md create mode 100644 wiki/notes/discovery-runbook.md create mode 100644 wiki/raw/discovery_eu092025.json create mode 100644 wiki/sources/2026-07-09-discovery-eu092025.md diff --git a/wiki/concepts/authorization.md b/wiki/concepts/authorization.md index 0905bc3..7fcd104 100644 --- a/wiki/concepts/authorization.md +++ b/wiki/concepts/authorization.md @@ -1,24 +1,42 @@ --- type: concept -updated: 2026-07-09 +updated: 2026-07-11 tags: [auth, requirements] --- # Authorization Methods -The three planned ways to authorize a charging session. Architecturally they all collapse to one gate: **`decide(id_tag)` in `station.py`** ([[csms-toolkit]]) returns Accepted/Rejected against the allowlist in `station_config.json`. Per [[2026-07-09-findings-and-requirements]]: +The three planned ways to authorize a charging session. Architecturally they all collapse to one gate: **`decide(id_tag, connector)` in the [[backend]]** (`backend/csms.py`; formerly `station.py` in [[csms-toolkit]]) returns Accepted/Rejected against the allowlist in `backend/config.json`. Per [[2026-07-09-findings-and-requirements]]. On top of these charger-side methods sits the **per-user API permission system** (last section). -## 1. RFID cards — ✅ mechanism built, enrollment pending +## 1. RFID cards — ✅ verified live (2026-07-09) -Use the cards already owned. Flow: enable learn mode → tap each card once → harvest its idTag from `seen_tags.json` → add to `authorized` with a name (`kind: "card"`) → set `learn_mode=false` to enforce. +First card tapped on the real charger: idTag `1000000000000393` → Authorize → StartTransaction on gun 2 → **actual charging session started** (tx 1, meter_start 3,513.857 kWh). Enrolled as "RFID card A". Second card captured the same session: `1000000000000395` → "RFID card B". The ids are sequential — the cards ship as a numbered batch. Remaining: tap any further cards, then set `learn_mode=false` to enforce. -## 2. By vehicle / chassis — ⚠️ needs a physical test +> [!warning] Session restarted after remote stop (❓ verify mechanism) +> ~65 s after a RemoteStop on gun 2 (cable left plugged), a **new** transaction began with the same card id. Either the owner re-tapped, or the charger auto-restarts from its authorization cache (`AuthorizationCacheEnabled=true`). Matters for app UX: "stop" may not stick while the cable stays in. Test: remote-stop and touch nothing for 5 min. -True VIN-based **ISO 15118 Plug & Charge is unlikely** on a basic AC unit. The realistic option is **Autocharge**: some chargers automatically send a per-vehicle idTag when a car plugs in, no card tap needed. +Flow for each new card: tap once in learn mode → harvest its idTag from `seen_tags.json` / `GET /api/allowlist` → add to `authorized` with a name (`kind: "card"`). -**The test:** plug the car in *without* tapping a card. If a stable idTag shows up in `seen_tags.json`, whitelist it as `kind: "car"` and "by vehicle" works. If nothing appears, this method is not achievable on the [[anfu-charger|Anfu hardware]] — drop it. +Since 2026-07-11 a card can be **restricted per gun**: an optional `"connectors": [2]` on its allowlist entry makes `decide()` reject it on any other connector. The check fires at `StartTransaction` (the only message that carries the connector); the preceding `Authorize` (tap) still says Accepted — harmless on this charger, because `AuthorizeRemoteTxRequests=false` makes `StartTransaction` the decisive call anyway (see the probe facts below). ✅ verified with a fake charge point: gun-2-only card → `Invalid`/tx 0 on gun 1, Accepted on gun 2. -## 3. Mobile / web app — 📋 to build +## 2. By vehicle / chassis — ❌ CLOSED: not supported (2026-07-09) + +Exhaustively tested on the real hardware; the charger never forwards any vehicle identifier as an OCPP idTag. Three escalating tests, all negative (full record in `discovering/events.jsonl`): + +1. **Plain plug-in, no card** (both cars, both guns, ~15:03Z and ~15:08Z): connector → `Preparing`, then silence. No Autocharge out of the box. +2. **`MacEnabled=true` live** (ChangeConfiguration Accepted, no reboot; EU/CCS car replugged 15:22Z): no idTag in 5+ min. +3. **`MacEnabled=true` after a full power-cycle** (setting confirmed persisted post-reboot via re-probe; EU car replugged 15:33:51Z): no idTag in ~3.5 min. This was the definitive variant, since this charger family applies some settings only on boot ([[troubleshooting]] #4). + +`MacEnabled` reverted to `false` afterwards. Whatever that key does, it is not Autocharge-style idTag forwarding — despite the charger demonstrably holding a DC handshake with the car (it reports the car's SoC). The EVCCID/VIN exists inside the charger but firmware `1.24.0620.1` never surfaces it over OCPP. + +> [!note] Confirmed: the charger *has* the VIN (owner observation, 2026-07-09) +> The **touchscreen displays the chassis number (VIN) of Chinese cars** — direct proof the GB/T 27930 BRM handshake delivers the VIN to the charger. The identity dead-ends at the UI; it's purely an OCPP-mapping gap in the firmware, not a hardware limit. Two long-shot future leads: (1) a firmware update; (2) the writable, empty `DataTransferVendorId` config key — setting it might make the charger emit vendor-specific `DataTransfer` frames (which `station.py` already logs) that could include the VIN. + +**Consequence:** vehicle-based auth is off the table. Households authorize via **RFID cards ✅** and the **app remote-start ✅** — both verified. (If a future firmware update changes this, retest with the same three steps.) + +## 3. Mobile / web app — ✅ control path verified live (2026-07-09) + +The exact calls the app will make were proven on the real charger with a car plugged in: `RemoteStartTransaction(connector=1, idTag="app-remote")` → Accepted → StartTransaction → Charging; `RemoteStopTransaction(tx)` → Accepted → StopTransaction (`reason: Remote`). Both guns ran **simultaneous transactions** (card on gun 2, remote on gun 1). The `app-remote` idTag is enrolled in the allowlist as `kind:"app"`. What remains is only the UI: A mobile-friendly web control panel (no app store): @@ -26,3 +44,28 @@ A mobile-friendly web control panel (no app store): - Live charger status - Clickable allowlist management - Bound to `0.0.0.0`, reached only over [[netbird|NetBird]]; optional PIN/token for defense-in-depth (❓ open decision, see [[overview]]) +- Must be **per-gun**: the charger has two connectors ([[2026-07-09-discovery-eu092025]]) + +## Who may control what — API users & scopes (built 2026-07-11) + +The [[backend]] now has real multi-user authorization on top of the three methods above, because not every household member may control everything. Requirement (owner, 2026-07-11): some users control gun 1 only, some gun 2, some only certain [[wifi-relays|relays]]. + +- **Users** live in `backend/config.json` → `"users"`: username + PBKDF2 password hash + scope list + a personal `id_tag` (`app-`) used for their remote starts, so charging sessions are **attributable per person**. +- **Login**: `POST /api/login` (username/password) → 30-day HMAC-signed session, delivered as an HttpOnly cookie (for the PWA) and as a bearer token (for curl). Stateless — survives backend restarts; deleting a user kills their sessions. +- **Scopes** (fnmatch wildcards work): + + | Scope | Grants | + |---|---| + | `charger:eu092025:1` | start/stop/unlock gun 1 | + | `charger:eu092025:2` | same for gun 2 | + | `relay:` / `relay:*` | switch those relays (others are invisible to the user) | + | `admin` | everything, incl. allowlist/user CRUD, learn-mode flip, setconfig, events | + +- **Bootstrap**: zero users = open API (startup warns loudly). First user: `venv\Scripts\python -m backend.users add --scopes admin`. +- ✅ Verified by the 28-check smoke test (login, wrong password, cookie + bearer, per-scope 403s, relay visibility filtering, user CRUD, session invalidation on delete). ⚠️ Not yet exercised from a real browser/PWA (doesn't exist yet). + +This resolves the ❓ "web app auth" open decision in [[overview]]: username+password with per-resource scopes, chosen over plain tokens by the owner. + +## Facts from the live probe that shape this design + +Per [[2026-07-09-discovery-eu092025]]: `AuthorizeRemoteTxRequests=false`, so remote starts don't trigger a separate Authorize — the `decide()` gate fires when the charger sends `StartTransaction`. The on-charger offline allowlist (`LocalAuthList`) holds max **6 idTags** and is currently disabled; enough for a household if we ever want tap-to-charge to survive CSMS downtime. diff --git a/wiki/entities/anfu-charger.md b/wiki/entities/anfu-charger.md index bbb970a..cb69c01 100644 --- a/wiki/entities/anfu-charger.md +++ b/wiki/entities/anfu-charger.md @@ -6,7 +6,9 @@ tags: [hardware] # Anfu Home Charger (charging pile) -The physical home EV charger this whole project revolves around. It is not a single device but a small network of three, behind its own Four-Faith router (see [[network-topology]]). Per [[2026-07-09-findings-and-requirements]]: +The physical home EV charger this whole project revolves around. Identity per the live probe ([[2026-07-09-discovery-eu092025]]): **SimpleCharge "MultiSocketCharger"**, serial `24310588`, firmware `1.24.0620.1`, OCPP ID **`eu092025`** — with **two guns** (connectors 1 and 2). + +It is not a single device but a small network of three, behind its own Four-Faith router (see [[network-topology]]). Per [[2026-07-09-findings-and-requirements]]: - **[[jc-6620|JC-6620]]** (`192.168.2.228`) — OCPP communication controller; the OCPP client that dials the CSMS - **EV charging controller** (`192.168.2.118`, DHCP) — the main control board that actually manages charging; the JC-6620 talks to it on port 2403 @@ -25,8 +27,15 @@ The physical home EV charger this whole project revolves around. It is not a sin > [!warning] Power-cycle required > URL or network changes only take effect after power-cycling the pile. -## Capabilities in question +## Capabilities (per the live probe, [[2026-07-09-discovery-eu092025]], and the live charging test) + +> [!warning] Superseded: "basic AC unit" (assumed in [[2026-07-09-findings-and-requirements]]) +> The first live charging session (2026-07-09) showed gun 2 delivering **30.6 kW at 309.6 V / 98.8 A with SoC reporting** — that's **DC fast charging**, not AC. This is a DC-capable multi-standard charger. - ✅ OCPP 1.6J over WebSocket — verified working -- ⚠️ Autocharge (per-vehicle idTag on plug-in) — needs a physical test; see [[authorization]] -- ❌ True ISO 15118 Plug & Charge — unlikely on a basic AC unit +- ✅ **DC fast charger, 60 kW** (owner-confirmed) with **two guns** — `NumberOfConnectors=2`: **gun 1 = EU standard (CCS), gun 2 = Chinese standard (GB/T)**; 30.6 kW observed on gun 2 while both guns charged simultaneously +- ⚠️ Telemetry quirk: while charging, gun 1's periodic samples read 0 W / 0 V (though SoC updated and energy was delivered — 349 Wh per Transaction.End); gun 2's samples looked sane. Watch whether gun 1 metering is lazy/lagged. +- ✅ Feature profiles: Core, **RemoteTrigger** (verified), **SmartCharging** (Power-based profiles, max 3 periods), Reservation, LocalAuthListManagement (max **6** entries), FirmwareManagement +- ✅ Meter data every 60 s while charging: Energy, Power, **SoC**, Voltage, Current +- ❌ Autocharge / vehicle ID over OCPP — **tested and closed 2026-07-09**: no idTag ever forwarded, even with `MacEnabled=true` after a power-cycle ([[authorization]]); the charger clearly holds the DC handshake (reports SoC) but firmware `1.24.0620.1` keeps the vehicle identity to itself +- ❌ True ISO 15118 Plug & Charge — nothing in the config suggests it diff --git a/wiki/entities/backend.md b/wiki/entities/backend.md new file mode 100644 index 0000000..9dcec93 --- /dev/null +++ b/wiki/entities/backend.md @@ -0,0 +1,57 @@ +--- +type: entity +updated: 2026-07-11 +tags: [software, csms, backend, relays, auth] +--- + +# Backend (`../backend/`) + +The production successor to [[csms-toolkit|station.py]] (built 2026-07-11): one FastAPI/uvicorn process on **port 9000** that is both the private CSMS for the [[anfu-charger]] and the controller for the [[wifi-relays|Tuya WiFi relays]] — phases 1–2 of the [[architecture-plan]]. + +``` +backend/ (run: venv\Scripts\python -m backend.main, from the repo root) +├── main.py app assembly + entrypoint (uvicorn :9000), serves the panel +├── csms.py OCPP 1.6J ChargePoint handlers, decide() gate, remote start/stop +├── relays.py tinytuya local control of the SmartLife relays +├── routes.py REST under /api/* (login + per-scope permission checks) +├── users.py passwords (PBKDF2), sessions (HMAC), scope matcher, user CLI +├── store.py SQLite session store: who charged, when, how many kWh + meter samples +├── config.py config.json load/save +├── journal.py events.jsonl + seen_tags.json (raw ground truth) +├── static/ the web panel PWA (index.html, manifest, service worker, icon) +├── config.json users + allowlist + relay registry — GITIGNORED (password +│ hashes, session secret, Tuya local keys); see config.example.json +└── sessions.db SQLite (gitignored, auto-created) +``` + +## Surfaces (all on :9000 — the touchscreen URL never changes) + +- `ws://:9000/` — OCPP WebSocket (catch-all path, the JC-6620 dials in) +- `GET /` — **the web panel** (mobile-first PWA, vanilla JS, self-contained; login → tabs Control / History / Admin, buttons filtered by the user's scopes; polls `/api/status` every 5 s) +- `POST /api/login|logout`, `GET /api/me` — username/password → 30-day session (cookie + bearer) +- `GET /api/sessions?limit&cp&connector` — **charging history: who / when / kWh** (visibility: own sessions + guns within scope; admin sees all); `GET /api/sessions/{tx}/samples` — per-minute energy/power/SoC for charts +- `GET /api/status` — mode, connected chargers, gun states, active transactions, auth events, relays (filtered to what the caller may control) +- `GET /api/events?limit&event=` — tail the journal (admin) +- `POST /api/charger/start|stop[/{tx}]|unlock/{n}` — gun-scoped; `trigger/{...}|setconfig|probe` — admin +- `GET/PUT/DELETE /api/allowlist[/{idTag}]` + `POST /api/mode?learn=` — admin; **learn mode flips at runtime, no restart** +- `GET/PUT/DELETE /api/users[/{name}]` — user CRUD (admin), enables a PWA admin page later +- `GET /api/relays[?live=true]`, `GET /api/relays/{name}`, `POST /api/relays/{name}/on|off|toggle` — relay-scoped +- `/docs` — interactive OpenAPI docs + +## Design facts + +- Carried over from the proven discovery code: the `decide()` gate ([[authorization]]) — now with optional per-gun card restriction (`"connectors": [2]`) — the `_WSAdapter` WebSocket bridge, learn mode, the JSONL event journal. `DataTransfer` frames are journaled too (the VIN long-shot lead in [[authorization]]). +- **Multi-user auth** (2026-07-11, replaced the interim `api_token`): username/password users with permission scopes — `charger::`, `relay:`, `admin` — full model in [[authorization]]. Stdlib crypto only (PBKDF2 + HMAC sessions). Zero users = open API (startup warns); bootstrap via `python -m backend.users add --scopes admin`. +- Remote starts run under the calling user's own idTag (`app-`, auto-enrolled) → per-person session attribution. +- **Consumption tracking** (`store.py`, 2026-07-11): every `StartTransaction` opens a row in `sessions.db` with a resolved "who" (allowlist name or username); `StopTransaction` closes it and computes Wh from the meter diff; `MeterValues` rows land in a `samples` table (energy/power/SoC, kW→W normalized). Transaction ids continue from `MAX(tx)` across restarts, and stop-by-tx falls back to the store so sessions running through a backend restart stay stoppable. +- Relay calls are blocking tinytuya I/O, run via `asyncio.to_thread` so the OCPP socket never stalls. +- Venv at repo root (`../venv/`, Python 3.13); deps pinned in `backend/requirements.txt` (fastapi, uvicorn, websockets, ocpp, tinytuya) — the auth system added none. +- ✅ Smoke-tested 2026-07-11 (37 checks): REST surface, allowlist CRUD incl. gun-restricted cards, login/sessions/scopes, user CRUD, the full consumption pipeline (start → meter sample → stop → kWh → visibility filtering), static panel serving, and a fake charge point over the real WS route. ⚠️ Not yet run against the live charger or a real phone browser; relays unconfigured until the [[wifi-relays|key extraction]] is done. + +## Web panel notes + +Vanilla JS on purpose (no framework, no CDN — the panel must work with NetBird-only reachability). Start button enables only when the gun reports `Preparing`/`Available` **and** the user holds that gun's scope. Gun cards show who is charging and since when; History tab lists who/when/kWh; Admin tab (admin scope only) manages allowlist (incl. per-gun cards + "seen but not enrolled" quick-enroll), users, and the learn/enforce toggle. Trivial service worker = installable ("add to home screen") without cache-staleness risk. + +## Deliberately deferred + +SSE live push (the panel polls), per-session charts from the `samples` table (data is already collected), auto-interrogation on connect (manual `POST /api/charger/probe`). diff --git a/wiki/entities/csms-toolkit.md b/wiki/entities/csms-toolkit.md index 90f8de7..0bc467d 100644 --- a/wiki/entities/csms-toolkit.md +++ b/wiki/entities/csms-toolkit.md @@ -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": { "": {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/`. +- **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/`, 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://:9000/docs`) + +- Auto-interrogation on every charger connect: `GetConfiguration` (all keys) + `TriggerMessage(StatusNotification)` → saved to `discovery_.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=` +- `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. diff --git a/wiki/entities/wifi-relays.md b/wiki/entities/wifi-relays.md new file mode 100644 index 0000000..59127cd --- /dev/null +++ b/wiki/entities/wifi-relays.md @@ -0,0 +1,28 @@ +--- +type: entity +updated: 2026-07-11 +tags: [hardware, relays, tuya] +--- + +# WiFi Relays (SmartLife / Tuya) + +Several WiFi relays scattered around the property, currently driven by the **SmartLife app** (owner report, 2026-07-11). Scope expansion: the [[backend]] should control them too, so one self-hosted system runs both the [[anfu-charger|charger]] and the relays. + +## What they are + +SmartLife = Tuya's consumer app, so these are **Tuya WiFi devices**. The "discovered by Bluetooth at first" behavior the owner observed is Tuya's standard BLE-assisted *pairing* (the phone passes WiFi credentials over BLE once); after provisioning the relays live on WiFi and speak **Tuya's local protocol on TCP 6668**, which the `tinytuya` library drives directly — **no Tuya cloud in the loop** for day-to-day control. SmartLife keeps working in parallel; local and app control don't conflict. + +## Control path (implemented in `backend/relays.py`, ⚠️ awaiting keys) + +Local control needs each device's **id + local key**, extracted once via Tuya's own API: + +1. Create a (free) account at `iot.tuya.com` → Cloud → create a project (data center matching the SmartLife account region). +2. Link the SmartLife app account to the project (Devices → Link App Account → scan QR in SmartLife). +3. From the repo root: `venv\Scripts\python -m tinytuya wizard` — enter the project's API id/secret; it dumps every paired device's `id`, `key`, `ip`, and protocol `version`. +4. Copy each relay into `backend/config.json` → `"relays"` (shape in `config.example.json`). The Tuya cloud account is never needed again unless a device is re-paired (**re-pairing regenerates the local key**). + +Recommended: DHCP reservations for the relays and pinned `"ip"` entries in the config — `"ip": "auto"` works via UDP broadcast discovery but is slower and only finds relays on the same L2 segment as the backend host (❓ verify which subnet the relays are on vs. the future always-on host, see [[network-topology]]). + +## API (see [[backend]]) + +`GET /api/relays?live=true` (poll all), `GET /api/relays/{name}`, `POST /api/relays/{name}/on|off|toggle`. ⚠️ Untested against the physical relays until the keys are in the config. diff --git a/wiki/index.md b/wiki/index.md index 043e0bc..6cbc1ee 100644 --- a/wiki/index.md +++ b/wiki/index.md @@ -1,6 +1,6 @@ --- type: meta -updated: 2026-07-09 +updated: 2026-07-11 tags: [index] --- @@ -16,20 +16,24 @@ Catalog of every wiki page. Updated on every ingest. (Schema/conventions live in - [[anfu-charger]] — the charging pile: its three internal devices + working touchscreen config - [[jc-6620]] — the OCPP communication controller / client; its IPs and shipped-gateway gotcha -- [[csms-toolkit]] — the Python CSMS scripts in `../discovering/` and what each does +- [[backend]] — the production backend in `../backend/`: CSMS + REST API + relay control + user auth + consumption store + web panel, all on :9000 +- [[csms-toolkit]] — the Python CSMS scripts in `../discovering/`; discovery/diagnostic tooling (production role superseded by [[backend]]) +- [[wifi-relays]] — the Tuya/SmartLife WiFi relays; local tinytuya control path + key-extraction steps - [[netbird]] — the private overlay network; security boundary for the future web panel ## Concepts - [[network-topology]] — charger LAN behind the Four-Faith router, NAT direction, what's verified -- [[authorization]] — the three auth methods (RFID ✅ / Autocharge ⚠️ / web app 📋) and the `decide()` gate +- [[authorization]] — charger auth methods (RFID ✅ / by-vehicle ❌ / app ✅), per-gun cards, and the API user/scope permission system - [[troubleshooting]] — ordered "charger won't connect" checklist of hard-won gotchas - [[ocpp]] — OCPP 1.6J basics and how the roles/messages map to this project ## Notes -*(none yet — filed answers to questions go here)* +- [[architecture-plan]] — stack decision (FastAPI + PWA now, Flutter optional later) and 6-phase build plan +- [[discovery-runbook]] — step-by-step physical test session: Autocharge first, then RFID taps, then remote start ## Sources -- [[2026-07-09-findings-and-requirements]] — founding findings/requirements doc (ingested 2026-07-09, 1 raw file) +- [[2026-07-09-findings-and-requirements]] — founding findings/requirements doc (ingested 2026-07-09) +- [[2026-07-09-discovery-eu092025]] — live GetConfiguration capability dump from the real charger: 2 guns, feature profiles, meter data (ingested 2026-07-09) diff --git a/wiki/log.md b/wiki/log.md index bad1b51..91d461e 100644 --- a/wiki/log.md +++ b/wiki/log.md @@ -15,3 +15,59 @@ Instantiated the LLM-wiki pattern for the charging-station project: schema (`CLA ## [2026-07-09] ingest | Findings & Requirements (founding source) Ingested `raw/FINDINGS_AND_REQUIREMENTS.md` → [[2026-07-09-findings-and-requirements]]. Seeded [[overview]] plus entities ([[anfu-charger]], [[jc-6620]], [[csms-toolkit]], [[netbird]]) and concepts ([[network-topology]], [[authorization]], [[troubleshooting]], [[ocpp]]). Open decisions tracked in [[overview]]. + +## [2026-07-09] query | Stack decision → architecture plan filed + +Discussed backend (Fastify vs FastAPI), web frontend, and Flutter. Decided: FastAPI single-process CSMS+API+PWA; Flutter deferred to optional phase 2. Filed as [[architecture-plan]]; index updated. + +## [2026-07-09] ingest | Live capability probe of the real charger (eu092025) + +Built discovery layer into station.py (single FastAPI process on :9000 — OCPP WS + HTTP API with /status /tags /probe /start /stop /trigger /unlock /setconfig; auto-GetConfiguration on connect). The real charger connected during testing: SimpleCharge MultiSocketCharger, fw 1.24.0620.1, TWO guns, RemoteTrigger verified. Ingested raw/discovery_eu092025.json → [[2026-07-09-discovery-eu092025]]; updated [[anfu-charger]], [[authorization]], [[csms-toolkit]], [[overview]]. + +## [2026-07-09] meta | Discovery runbook filed + +Filed [[discovery-runbook]]: physical test session plan (Autocharge plug-in test first, then RFID card taps, optional remote start). Awaiting hardware results. + +## [2026-07-09] meta | Event journal added to station.py + +All OCPP events now persist to events.jsonl (one JSON line each) with a GET /events tail endpoint — so the upcoming Autocharge/RFID/charging test session is fully recorded for later ingest. Verified with fake charger + live eu092025 reconnect. Updated [[csms-toolkit]]. + +## [2026-07-09] ingest | First live plug-in test: no Autocharge by default + +Car plugged into gun 2 (no card): StatusNotification Available->Preparing at 15:02:59Z, then silence — no Authorize/StartTransaction/idTag in ~2 min. Preliminary: no Autocharge out of the box; MacEnabled=true retry pending. Updated [[authorization]]. + +## [2026-07-09] ingest | Full live test session: RFID + remote start/stop verified, no Autocharge, charger is DC + +Live session with both cars: card ...393 -> Authorize -> charging on gun 2 (GB/T DC, 30.6 kW observed, 1807 Wh delivered); RemoteStart/RemoteStop proven on gun 1 (EU, 349 Wh); two cars plugged without cards produced no idTag (Autocharge negative, MacEnabled retry remains). Superseded "basic AC unit" assumption. Card + app-remote enrolled in allowlist. Updated [[authorization]], [[anfu-charger]], [[overview]]. Raw record: discovering/events.jsonl. + +## [2026-07-09] ingest | Card B captured; gun 2 re-stop; possible auto-restart after remote stop + +Card B (...395) tapped and enrolled. Gun 2 had started a NEW session (same card id ...393, ~65 s after the previous remote stop, cable still plugged) — stopped it remotely (tx 3, 2264 Wh). Open question ❓: re-tap or auth-cache auto-restart? Noted in [[authorization]]. + +## [2026-07-09] meta | Charger confirmed 60 kW DC; MacEnabled flipped to true + +Owner confirmed: 60 kW DC fast charger (gun 1 EU/CCS, gun 2 GB/T). No vehicle id observed via OCPP yet, but DC handshake means the charger receives EVCCID (CCS) / possibly VIN (GB/T). Set MacEnabled=true (ChangeConfiguration Accepted, live). Replug test pending. Updated [[anfu-charger]], [[authorization]]. + +## [2026-07-09] ingest | "By vehicle" auth definitively closed; charger is 60 kW DC + +Owner confirmed 60 kW DC. Final Autocharge variant: power-cycled pile with MacEnabled=true (setting persisted, verified by post-reboot probe), EU car replugged 15:33:51Z -> no idTag in ~3.5 min. Closed method 2 as NOT SUPPORTED; MacEnabled reverted to false. Updated [[authorization]], [[overview]], [[anfu-charger]], [[discovery-runbook]]. Remaining next steps: learn_mode off, PWA panel, remote-stop-restart question. + +## [2026-07-09] ingest | Touchscreen shows VIN of Chinese (GB/T) cars + +Owner observation: the pile's own UI displays the chassis/VIN for GB/T cars -> confirms the BRM handshake delivers the VIN to the charger; firmware just never maps it to an OCPP idTag. Noted in [[authorization]] with the DataTransferVendorId long-shot lead. + +## [2026-07-11] ingest | Scope expansion: backend also controls the Tuya/SmartLife WiFi relays + +Owner: the backend should also drive the WiFi relays currently on the SmartLife app (BLE-assisted pairing = standard Tuya onboarding; they're Tuya WiFi devices). Decision: local control via tinytuya (TCP 6668), no Tuya cloud in the day-to-day loop; one-time id/local-key extraction via `tinytuya wizard` pending. Created [[wifi-relays]]; updated [[architecture-plan]], [[overview]]. + +## [2026-07-11] meta | Production backend built (../backend/) — architecture-plan phases 1-2 + +Ported station.py into the `backend/` package: one FastAPI process on :9000 = OCPP CSMS + /api/* (charger control, allowlist CRUD, runtime learn-mode flip, optional api_token auth) + /api/relays/* (tinytuya via asyncio.to_thread). Allowlist migrated to backend/config.json (gitignored — holds Tuya local keys; config.example.json documents shape). Smoke-tested: 13 checks incl. fake CP BootNotification/Authorize over the real WS route. Not yet cut over on the live charger. Created [[backend]]; updated [[csms-toolkit]] (superseded-for-production callout), [[architecture-plan]], [[overview]], [[index]]. + +## [2026-07-11] meta | Multi-user auth system: username/password + per-resource scopes + +Owner requirement: per-user permissions (gun 1 vs gun 2 of eu092025, per-relay or all relays). Owner chose username+password over plain tokens; per-gun RFID restriction included. Built into [[backend]]: users.py (PBKDF2 passwords, stateless HMAC sessions 30d, cookie+bearer, fnmatch scopes charger:: / relay: / admin), login/me/users CRUD endpoints, scope checks on every route, relay visibility filtering, remote starts attributed via per-user idTag, decide() enforces optional "connectors" on allowlist entries at StartTransaction. Zero users = open API (bootstrap via `python -m backend.users add`). Smoke test grown 13 -> 28 checks, all passing. Resolved the "web app auth" open decision. Updated [[authorization]] (new scopes section + per-gun cards), [[backend]], [[overview]]. + +## [2026-07-11] meta | Consumption tracking (SQLite) + the PWA control panel + +Owner requirement: button-push start when a gun is ready (and permitted) + "who charged when and how many kWh". Built store.py (sessions.db: sessions with resolved who/started/ended/Wh + per-minute samples energy/power/SoC; tx ids survive restarts; stop falls back to store after restart), /api/sessions with visibility rules (own + in-scope guns; admin all), and the phase-3 web panel in backend/static/ (vanilla JS PWA at /: login, gun cards with scope- and readiness-gated Start/Stop, relay toggles, history tab, admin tab with allowlist/users/mode). Fixed a sqlite connection leak (with-connect commits but never closes). Smoke test 28 -> 37 checks, all passing. Updated [[backend]], [[architecture-plan]] (phases 1-3 all done), [[overview]], [[index]]. diff --git a/wiki/notes/architecture-plan.md b/wiki/notes/architecture-plan.md new file mode 100644 index 0000000..35ea312 --- /dev/null +++ b/wiki/notes/architecture-plan.md @@ -0,0 +1,47 @@ +--- +type: note +updated: 2026-07-11 +tags: [architecture, decision, plan] +--- + +# Architecture & Build Plan + +Filed 2026-07-09 from a stack discussion (Flutter? Fastify vs FastAPI? web frontend?). Extends the requirements in [[2026-07-09-findings-and-requirements]] and the roadmap in [[overview]]. + +> [!note] Scope expansion (2026-07-11): the backend also controls the household [[wifi-relays|Tuya/SmartLife WiFi relays]] — locally via tinytuya, same process, under `/api/relays/*`. This strengthens the FastAPI/one-process decision: charger + relays + panel behind one NetBird-reachable port. + +## Stack decision + +**Backend: FastAPI (Python) — decided.** + +The deciding constraint: the backend *is* the CSMS. `RemoteStartTransaction`/`RemoteStopTransaction` can only be sent down the live OCPP WebSocket the [[jc-6620|JC-6620]] holds open, so the API server and the OCPP server must share process state. The proven code ([[csms-toolkit]]) is already Python on the `ocpp` library; Fastify would mean rewriting OCPP in Node (immature libraries) or a two-process IPC design. FastAPI hosts everything in one uvicorn process on one port: + +``` +FastAPI app (uvicorn, :9000, on the always-on host) +├── / OCPP 1.6J WebSocket (catch-all) ← JC-6620 dials in here +├── /api/* REST: status, charger start/stop, allowlist CRUD, sessions +├── /api/relays/* Tuya relay control (tinytuya, local protocol) +├── /api/events journal tail (SSE live push later, for the panel) +└── / static PWA (the web panel) +``` + +(The `ocpp` ChargePoint class only needs send/recv; a FastAPI WebSocket route wraps it. Keep port 9000 so the charger touchscreen URL doesn't change — [[troubleshooting]] #4: changing it needs a power-cycle.) + +**Web frontend: mobile-first PWA, no build pipeline — decided.** +Plain HTML/JS (Alpine.js or htmx + SSE), served by FastAPI. Features: status card, start/stop, allowlist management, session history. PWA manifest → "add to home screen". Reached only over [[netbird|NetBird]]. + +**Flutter mobile app: phase 2, optional.** +The PWA covers ~95% of the value. Flutter earns its keep only for push notifications ("charging complete") or as a learning project. It would consume the same REST API (FastAPI's OpenAPI spec → typed Dart client codegen), so nothing built now is wasted. Phone needs the NetBird client either way. + +**Storage: SQLite** (single file) for sessions/meter values/seen tags; the allowlist can migrate from `station_config.json` into it once the panel manages it. JSON files were fine for discovery; history queries want a real table. → ✅ implemented 2026-07-11 as `backend/store.py` (`sessions` + `samples` tables); allowlist/users stayed in config.json — right size for a household, revisit only if it grows. + +## Build phases + +1. **Productionize the CSMS** — ✅ done 2026-07-11 as the [[backend]] package (`../backend/`); SQLite session store added same day (JSONL journal stays as raw ground truth). +2. **REST API** — ✅ done 2026-07-11: status, remote start/stop, allowlist CRUD, runtime learn-mode flip, **relay on/off/toggle**, multi-user login with permission scopes, **session history (who/when/kWh)**. ⚠️ Relay half awaits the [[wifi-relays|local-key extraction]]. +3. **Web panel (PWA)** — ✅ built 2026-07-11 (`backend/static/`, vanilla JS instead of Alpine — zero dependencies): login, per-gun status + start/stop gated by scopes and gun readiness, relay toggles, consumption history, admin tab. ⚠️ Untested on a real phone. +4. **Deploy** — pick the always-on host (❓ open, [[overview]]), run as a service (systemd or NSSM on Windows), static IP / DHCP reservation, firewall rule for :9000, joined to NetBird. +5. **Hardware tasks** — RFID enrollment via learn mode; the Autocharge plug-in test ([[authorization]]) to settle "by vehicle". +6. **(Optional) Flutter app** — consumes the same API; adds push notifications. + +Phases 1–3 are pure software and can proceed before the host decision; only phase 4 needs it. diff --git a/wiki/notes/discovery-runbook.md b/wiki/notes/discovery-runbook.md new file mode 100644 index 0000000..08dc74e --- /dev/null +++ b/wiki/notes/discovery-runbook.md @@ -0,0 +1,38 @@ +--- +type: note +updated: 2026-07-09 +tags: [runbook, discovery, hardware-test] +--- + +# Discovery Test Runbook — Autocharge + RFID Session + +> [!note] Executed 2026-07-09 — all tests done, results in [[authorization]] and [[overview]] +> Test A (Autocharge): ❌ negative through all variants incl. `MacEnabled=true` + power-cycle. Test B (RFID): ✅ cards A+B captured & enrolled. Test C (remote start/stop): ✅ both verified. Kept as the template for any future retest (e.g. after a firmware update). + +The physical test session to settle the open [[authorization]] questions. Prereq: `station.py` running (`venv\Scripts\python station.py` in `../discovering/`), learn mode ON, charger `eu092025` connected. Watch at `http://10.0.10.203:9000/status`, `/tags`, or `/docs`. + +## Order matters + +Do the Autocharge test **before** ever tapping a card in this session — the first plug-in is the clean observation. + +## Test A — Autocharge (plug in, no card) + +Connect a gun to a car. Do not tap anything. + +| Observation | Conclusion | Next step | +|---|---|---| +| New idTag in console / `/tags` | ✅ Autocharge works | Let it charge ~2 min (captures first MeterValues/SoC), stop, whitelist the id as `kind:"car"` | +| Connector "Preparing", no idTag | No Autocharge by default | Retry after `POST /setconfig?key=MacEnabled&value=true` (lead from [[2026-07-09-discovery-eu092025]]) | +| Nothing | "By vehicle" not supported | Close the open decision in [[overview]] as ❌ | + +## Test B — RFID cards + +Tap each owned card once. Each should log `[LEARN] NEW idTag=...` and appear in `/tags`. **Write down the physical tap order** so the ids can be named in the allowlist. + +## Test C (optional) — remote start + +With a car plugged in: `curl -X POST "http://10.0.10.203:9000/start?connector=1"` — this is exactly what the future web panel will do. Expect `{"remote_start":"Accepted"}` then a `StartTransaction` (note: `AuthorizeRemoteTxRequests=false`, so no separate Authorize). + +## Afterwards + +Feed results back into the wiki (ingest `seen_tags.json` observations), name cards in `station_config.json` → `authorized`, and once all household ids are enrolled: set `learn_mode: false` and restart — the charger is then enforcing. diff --git a/wiki/overview.md b/wiki/overview.md index 7a10c56..8a2477e 100644 --- a/wiki/overview.md +++ b/wiki/overview.md @@ -1,34 +1,44 @@ --- type: meta -updated: 2026-07-09 +updated: 2026-07-11 tags: [synthesis] --- # Overview — Anfu Home Charger OCPP Project -**Goal:** a private, self-hosted [[ocpp|OCPP 1.6J]] backend (CSMS) for a home EV charger. No billing, no public charging. Three ways to authorize a charge: existing RFID cards, by vehicle (if the hardware allows — ⚠️ untested), and a mobile-friendly web app reached over [[netbird|NetBird]]. +**Goal:** a private, self-hosted [[ocpp|OCPP 1.6J]] 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|NetBird]] (by-vehicle ❌ closed — firmware never forwards a vehicle id). **Scope expanded 2026-07-11:** the same backend also controls the household [[wifi-relays|Tuya/SmartLife WiFi relays]], locally via tinytuya. -## Current state (2026-07-09) +## Current state (2026-07-11) **Connectivity: ✅ solved.** The [[jc-6620|JC-6620]] controller inside the [[anfu-charger|charging pile]] 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: discovery-grade.** The [[csms-toolkit]] (`../discovering/`) can accept connections, log frames, and enforce an allowlist with learn mode. It is a tester/foundation, not yet the always-on production service. +**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|Tuya relay]] 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. -**Authorization: designed, partially built.** All three methods funnel through one gate — `decide(id_tag)` in `station.py`. See [[authorization]] for the plan per method. +**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. **RFID enrollment** — tap each card in learn mode, harvest idTags from `seen_tags.json`, add to the allowlist, then flip `learn_mode=false`. (Mechanism already implemented.) -2. **Autocharge test** — ⚠️ plug the car in *without* tapping a card; if a stable idTag appears, "by vehicle" works. If not, it's off the table for this hardware. See [[authorization]]. -3. **Web control panel** — Start/Stop via OCPP `RemoteStartTransaction`/`RemoteStopTransaction`, live status, allowlist management. Served behind NetBird. +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 --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://:9000/`; verify login, a real button-push start on a ready gun, and add-to-home-screen over [[netbird|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 | -| Web app auth | NetBird isolation only · also PIN/token | open | -| Autocharge | run the plug-in test or skip "by chassis" | open — needs physical test | +| 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|relays]] for local Tuya control | +| 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 diff --git a/wiki/raw/discovery_eu092025.json b/wiki/raw/discovery_eu092025.json new file mode 100644 index 0000000..f8eec1f --- /dev/null +++ b/wiki/raw/discovery_eu092025.json @@ -0,0 +1,336 @@ +{ + "charge_point": "eu092025", + "probed_at": "2026-07-09T13:49:56.843881+00:00", + "boot_info": { + "vendor": "SimpleCharge", + "model": "MultiSocketCharger", + "charge_point_serial_number": "24310588", + "firmware_version": "1.24.0620.1", + "iccid": "", + "imsi": "" + }, + "configuration": [ + { + "key": "AllowOfflineTxForUnknownId", + "readonly": false, + "value": "false" + }, + { + "key": "AuthorizationCacheEnabled", + "readonly": false, + "value": "true" + }, + { + "key": "AuthorizeRemoteTxRequests", + "readonly": false, + "value": "false" + }, + { + "key": "ClockAlignedDataInterval", + "readonly": false, + "value": "0" + }, + { + "key": "ConnectorPhaseRotationMaxLength", + "readonly": true, + "value": "1" + }, + { + "key": "ConnectionTimeOut", + "readonly": false, + "value": "60" + }, + { + "key": "GetConfigurationMaxKeys", + "readonly": true, + "value": "30" + }, + { + "key": "HeartbeatInterval", + "readonly": false, + "value": "7200" + }, + { + "key": "LocalAuthorizeOffline", + "readonly": false, + "value": "false" + }, + { + "key": "LocalPreAuthorize", + "readonly": false, + "value": "0" + }, + { + "key": "MaxEnergyOnInvalidId", + "readonly": false, + "value": "0" + }, + { + "key": "MeterValueSampleInterval", + "readonly": false, + "value": "60" + }, + { + "key": "NumberOfConnectors", + "readonly": true, + "value": "2" + }, + { + "key": "ResetRetries", + "readonly": false, + "value": "0" + }, + { + "key": "StopTransactionOnEVSideDisconnect", + "readonly": false, + "value": "1" + }, + { + "key": "StopTransactionOnInvalidId", + "readonly": false, + "value": "1" + }, + { + "key": "TransactionMessageAttempts", + "readonly": false, + "value": "50" + }, + { + "key": "TransactionMessageRetryInterval", + "readonly": false, + "value": "60" + }, + { + "key": "WebSocketPingInterval", + "readonly": false, + "value": "60" + }, + { + "key": "LocalAuthListEnabled", + "readonly": false, + "value": "false" + }, + { + "key": "LocalAuthListMaxLength", + "readonly": true, + "value": "6" + }, + { + "key": "SendLocalListMaxLength", + "readonly": true, + "value": "6" + }, + { + "key": "ChargeProfileMaxStackLevel", + "readonly": true, + "value": "3" + }, + { + "key": "UnlockConnectorOnEVSideDisconnect", + "readonly": false, + "value": "1" + }, + { + "key": "SendJCMeterValuesType", + "readonly": true, + "value": "1" + }, + { + "key": "ChargingScheduleAllowedChargingRateUnit", + "readonly": true, + "value": "Power" + }, + { + "key": "ChargingScheduleMaxPeriods", + "readonly": true, + "value": "3" + }, + { + "key": "MaxChargingProfilesInstalled", + "readonly": true, + "value": "1" + }, + { + "key": "LocalListVersion", + "readonly": true, + "value": "-1" + }, + { + "key": "MeterValuesAlignedData", + "readonly": false, + "value": "Energy.Active.Import.Register,Power.Active.Import,SoC,Voltage,Current.Import" + }, + { + "key": "MeterValuesSampledData", + "readonly": false, + "value": "Energy.Active.Import.Register,Power.Active.Import,SoC,Voltage,Current.Import" + }, + { + "key": "StopTxnAlignedData", + "readonly": false, + "value": "SoC" + }, + { + "key": "StopTxnSampledData", + "readonly": false, + "value": "Energy.Active.Import.Register" + }, + { + "key": "ConnectorPhaseRotation", + "readonly": false, + "value": "RST" + }, + { + "key": "SupportedFeatureProfiles", + "readonly": true, + "value": "Core,FirmwareManagement,LocalAuthListManagement,Reservation,SmartCharging,RemoteTrigger" + }, + { + "key": "Url", + "readonly": false, + "value": "http://10.0.10.203:9000" + }, + { + "key": "Vendor", + "readonly": true, + "value": "JC" + }, + { + "key": "Model", + "readonly": true, + "value": "MultiSocketCharger" + }, + { + "key": "TimeZone", + "readonly": false, + "value": "0" + }, + { + "key": "ProtocolName", + "readonly": true, + "value": "ocpp1.6" + }, + { + "key": "QRCodeTextOfConnector-1", + "readonly": false, + "value": "" + }, + { + "key": "QRCodeTextOfConnector-2", + "readonly": false, + "value": "" + }, + { + "key": "QRCodeTextOfConnector-3", + "readonly": false, + "value": "" + }, + { + "key": "AuthorizationKey", + "readonly": false, + "value": "" + }, + { + "key": "AuthorizationUser", + "readonly": true, + "value": "" + }, + { + "key": "CpoName", + "readonly": false, + "value": "" + }, + { + "key": "OutputLimitRate", + "readonly": false, + "value": "100" + }, + { + "key": "PeakPrice", + "readonly": false, + "value": "1.0000" + }, + { + "key": "OffPeakPrice", + "readonly": false, + "value": "0.5000" + }, + { + "key": "IdleFeePerMinute", + "readonly": false, + "value": "0.0100" + }, + { + "key": "IdleTime", + "readonly": false, + "value": "5" + }, + { + "key": "MacEnabled", + "readonly": false, + "value": "false" + }, + { + "key": "FreeChargeMode", + "readonly": false, + "value": "false" + }, + { + "key": "KeepConnectOTAServer", + "readonly": false, + "value": "true" + }, + { + "key": "DataTransferVendorId", + "readonly": false, + "value": "" + }, + { + "key": "MeterValuesAlignedDataMaxLength", + "readonly": true, + "value": "5" + }, + { + "key": "MeterValuesSampledDataMaxLength", + "readonly": true, + "value": "5" + }, + { + "key": "StopTxnAlignedDataMaxLength", + "readonly": true, + "value": "5" + }, + { + "key": "StopTxnSampledDataMaxLength", + "readonly": true, + "value": "5" + }, + { + "key": "SupportedFeatureProfilesMaxLength", + "readonly": true, + "value": "6" + }, + { + "key": "ReserveConnectorZeroSupported", + "readonly": true, + "value": "false" + }, + { + "key": "ConnectorSwitch3to1PhaseSupported", + "readonly": true, + "value": "false" + }, + { + "key": "ChargePointID", + "readonly": false, + "value": "eu092025" + } + ], + "unknown_keys": null, + "trigger_status_notification": "Accepted", + "connectors_seen": { + "0": "Available", + "1": "Available", + "2": "Available" + } +} \ No newline at end of file diff --git a/wiki/sources/2026-07-09-discovery-eu092025.md b/wiki/sources/2026-07-09-discovery-eu092025.md new file mode 100644 index 0000000..26519f3 --- /dev/null +++ b/wiki/sources/2026-07-09-discovery-eu092025.md @@ -0,0 +1,43 @@ +--- +type: source +updated: 2026-07-09 +ingested: 2026-07-09 +raw: raw/discovery_eu092025.json +tags: [discovery, capabilities, ocpp] +--- + +# Discovery Probe — Live Capability Dump from "eu092025" + +**Raw source:** [discovery_eu092025.json](../raw/discovery_eu092025.json) — the answer the real charger gave to `GetConfiguration` (all keys) + `TriggerMessage`, captured live on 2026-07-09 by the new auto-interrogation in [[csms-toolkit]]. This replaces guesswork with the charger's own capability sheet. + +## TL;DR + +The pile identifies as **SimpleCharge "MultiSocketCharger"**, serial `24310588`, firmware `1.24.0620.1`, OCPP charge-point ID **`eu092025`**, and it has **two guns** (`NumberOfConnectors=2`; connectors 1 and 2, plus 0 = the whole unit — all reported "Available"). It supports far more than we assumed: **RemoteTrigger ✅ (verified), SmartCharging, Reservation, LocalAuthListManagement, FirmwareManagement**. + +## Key configuration facts + +| Key | Value | Meaning for us | +|---|---|---| +| `NumberOfConnectors` | **2** | Two guns — the app/UI must be per-connector, not per-charger | +| `SupportedFeatureProfiles` | Core, FirmwareManagement, LocalAuthListManagement, Reservation, SmartCharging, RemoteTrigger | RemoteTrigger already verified working ✅ | +| `AuthorizeRemoteTxRequests` | `false` | Remote starts skip a separate Authorize — our `decide()` gate still fires at StartTransaction ([[authorization]]) | +| `LocalAuthListMaxLength` | **6** | On-charger offline allowlist holds only 6 idTags — enough for a household | +| `LocalAuthListEnabled` / `LocalAuthorizeOffline` | `false` / `false` | Offline auth currently off; charger is fully CSMS-dependent when offline | +| `MeterValueSampleInterval` | 60 s | Live data every minute during charging | +| `MeterValuesSampledData` | Energy, **Power**, **SoC**, Voltage, Current | Rich live telemetry — even state-of-charge — for the web panel | +| `HeartbeatInterval` / `WebSocketPingInterval` | 7200 s / 60 s | Liveness comes from WS pings, not heartbeats | +| `ConnectionTimeOut` | 60 s | A remote start waits 60 s for a plug-in before expiring | +| `MacEnabled` | `false` | ❓ Suggestive lead for [[authorization|"by vehicle"]] — possibly MAC-based vehicle recognition; worth flipping during the Autocharge test | +| `FreeChargeMode` | `false` | Exists — a "just charge, no auth" escape hatch if we ever want it | +| `Url` | `http://10.0.10.203:9000` | Confirms this PC is the configured CSMS host | +| Pricing keys (`PeakPrice`, `IdleFeePerMinute`, …) | set | Vendor billing leftovers; irrelevant for private use | + +Also present: `QRCodeTextOfConnector-1..3` (writable, empty), `ChargingScheduleAllowedChargingRateUnit=Power` with max 3 schedule periods and 1 installed profile (SmartCharging is real but small), `ReserveConnectorZeroSupported=false`. + +## Boot identity (via TriggerMessage(BootNotification)) + +`vendor=SimpleCharge, model=MultiSocketCharger, serial=24310588, firmware=1.24.0620.1` — note `GetConfiguration` reports `Vendor=JC` (the [[jc-6620|JC-6620]] module vendor) while BootNotification says SimpleCharge (the charger brand). + +## Wiki changes from this ingest + +Updated [[anfu-charger]] (identity + capabilities), [[authorization]] (remote-auth behavior, LocalAuthList, MacEnabled lead), [[csms-toolkit]] (discovery API), [[overview]].