- Allowlist entries take "user": <username> — sessions started with that card attribute to the person, and the owner sees their card's history even without gun-wide permissions (ownership looked up live) - "guns": ["eu092025:2"] (fnmatch) replaces the charger-blind "connectors": [2] restriction — safe with multiple chargers - New "chargers" config section provides per-charger/per-gun display names; the panel no longer hardcodes the Anfu gun labels - Panel admin tab: owner dropdown + guns field on card entries - Smoke test: 42 checks, incl. retroactive history visibility after linking a card and rejection of links to unknown users
7.4 KiB
type, updated, tags
| type | updated | tags | ||
|---|---|---|---|---|
| concept | 2026-07-11 |
|
Authorization Methods
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 — ✅ verified live (2026-07-09)
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.
[!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.
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").
Since 2026-07-11 a card can be linked to a user and restricted per gun:
"user": "julian"on the allowlist entry ties the card to a user account — sessions started with it attribute to that person in the history, and the owner sees their card's sessions even without gun-wide permissions (ownership is looked up live, so linking is retroactive for history visibility)."guns": ["eu092025:2"]restricts the card to specific guns, charger-qualified (fnmatch patterns, so"eu092025:*"= all guns of one charger) — multi-charger-safe by construction. The check fires atStartTransaction(the only message that carries the connector); the precedingAuthorize(tap) still says Accepted — harmless on this charger, becauseAuthorizeRemoteTxRequests=falsemakesStartTransactionthe 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.
Both are editable from the panel's Admin tab (owner dropdown + guns field).
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):
- Plain plug-in, no card (both cars, both guns, ~15:03Z and ~15:08Z): connector →
Preparing, then silence. No Autocharge out of the box. MacEnabled=truelive (ChangeConfiguration Accepted, no reboot; EU/CCS car replugged 15:22Z): no idTag in 5+ min.MacEnabled=trueafter 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
DataTransferVendorIdconfig key — setting it might make the charger emit vendor-specificDataTransferframes (whichstation.pyalready 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):
- Start/Stop via OCPP
RemoteStartTransaction/RemoteStopTransaction - Live charger status
- Clickable allowlist management
- Bound to
0.0.0.0, reached only over 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.
-
Users live in
backend/config.json→"users": username + PBKDF2 password hash + scope list + a personalid_tag(app-<name>) 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:1start/stop/unlock gun 1 charger:eu092025:2same for gun 2 relay:<name>/relay:*switch those relays (others are invisible to the user) admineverything, 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 <name> --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.