Files
charging_station/wiki/log.md
T
julian 70c2fe1210 feat(backend): link cards to users; charger-qualified gun restrictions; config-driven gun labels
- 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
2026-07-11 20:03:36 +02:00

8.1 KiB

type, updated, tags
type updated tags
meta 2026-07-09
log

Log

Append-only, newest at the bottom. Entry format: ## [YYYY-MM-DD] ingest|query|lint|meta | Title — so grep "^## \[" log.md | tail -5 shows recent activity.

[2026-07-09] meta | Wiki bootstrapped

Instantiated the LLM-wiki pattern for the charging-station project: schema (CLAUDE.md), index.md, log.md, and directory layout (sources/, entities/, concepts/, notes/).

[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.

[2026-07-11] meta | Cards linked to users; multi-charger gaps closed

Owner requirements: cards must belong to a person (not float around as "RFID card A (tapped first...)"), and adding a second charger must be clean. Allowlist entries now take "user" (sessions attribute to the person; owner sees their card's history) and charger-qualified "guns": ["eu092025:2"] (fnmatch; replaces the charger-blind "connectors" field). Gun display names moved from hardcoded panel JS to a "chargers" config section served via /api/status. Adding a charger = point it at the same URL with a unique ChargerID + grant charger:: scopes. Panel admin tab: owner dropdown + guns field. Smoke test 37 -> 42 checks. Updated authorization, backend.