Commit Graph

5 Commits

Author SHA1 Message Date
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
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
julian d7b17d9cb2 feat(backend): production backend — CSMS, multi-user auth, relays, session store, web panel
One FastAPI process on port 9000 (the charger's hardcoded URL), replacing
discovering/station.py for production:

- csms.py: OCPP 1.6J handlers ported from the proven discovery code; the
  decide() gate now supports per-gun RFID restriction ("connectors": [2])
  enforced at StartTransaction
- users.py: username/password auth (PBKDF2), stateless HMAC sessions
  (cookie + bearer, 30 days), fnmatch permission scopes
  (charger:<cp>:<gun>, relay:<name>, admin) and a user CLI
- relays.py: local tinytuya control of the SmartLife/Tuya WiFi relays
  (no cloud; needs one-time id/local-key extraction via tinytuya wizard)
- store.py: SQLite consumption tracking — who charged, when, how many kWh,
  per-minute energy/power/SoC samples; tx ids survive restarts
- routes.py: /api/* with per-scope checks, allowlist/user CRUD, runtime
  learn-mode flip, session history with visibility rules
- static/: self-contained vanilla-JS PWA — login, per-gun start/stop gated
  by scope + gun readiness, relay toggles, history, admin tab

config.json (password hashes, session secret, Tuya keys) and sessions.db
are gitignored; config.example.json documents the shape. Covered by a
37-check smoke test incl. a fake charge point over the real WS route.
2026-07-11 18:58:09 +02:00
julian 5c88e8fa3c feat(discovering): single-process CSMS on :9000 with discovery API + live session captures
station.py is now one FastAPI/uvicorn process owning port 9000: the OCPP 1.6J
WebSocket (catch-all path) plus an HTTP control API (status, events, tags,
probe, remote start/stop, trigger, unlock, setconfig). Adds the events.jsonl
journal and auto-interrogation on connect.

Includes the captures from the 2026-07-09 live test session: full
GetConfiguration dump of eu092025, real charging transactions on both guns
(RFID + remote start/stop), and the negative Autocharge/MacEnabled results.
Cards A/B + app-remote enrolled in station_config.json.
2026-07-11 18:57:55 +02:00
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