d7b17d9cb2
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.
7 lines
402 B
JavaScript
7 lines
402 B
JavaScript
// Minimal service worker: required for "add to home screen" installability.
|
|
// No caching — the panel is only reachable over NetBird/LAN anyway, and a
|
|
// stale cached UI causes more confusion than a brief offline error.
|
|
self.addEventListener("install", () => self.skipWaiting());
|
|
self.addEventListener("activate", (e) => e.waitUntil(self.clients.claim()));
|
|
self.addEventListener("fetch", () => {});
|