feat: solar inverter monitor — FastAPI + SQLite backend, React PWA dashboard
Monitoring for the Refusol 020K inverters. The on-site poller POSTs each 60 s cycle to /api/readings; the dashboard answers first whether every inverter is operating and whether one is producing far less than its peers (string fuse / breaker problems). - Backend: FastAPI + SQLite. Parameters defined once in fields.py (columns auto-added on start); unknown poller keys are kept in `extra` since the parameter map is still being researched. Idempotent ingest, daily energy rollup in site-local days, history downsampling, 2-year retention. - Health: Offline vs Sleeping (sun elevation) vs No data (datalogger silent, detected via empty-batch heartbeats), Fault from error_code, underperformance vs fleet median (per kWp when sizes set), MPPT imbalance. - Frontend: mobile-first React + Tailwind, installable PWA, comparison bars, 24 h power / 30 day energy charts, detail page with all parameters. - Docker: backend + frontend + nginx on one port for NPM, as in bellsystems-cp; deploy-host.sh pulls main and rebuilds. - poller/backend_client.py: stdlib client with offline spool for refusol_poller.py; fake_poller.py simulates the site. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
# Host port the nginx container binds; point NPM (solar.bonamin.net) at it
|
||||
HTTP_PORT=8090
|
||||
|
||||
# Shared secret: the on-site poller sends it as X-API-Key on POST /api/readings,
|
||||
# and the dashboard asks for it when editing inverter settings.
|
||||
# Generate one with: python -c "import secrets; print(secrets.token_urlsafe(32))"
|
||||
API_KEY=change-me
|
||||
|
||||
# Site location — local day boundaries for daily energy, and the sun's
|
||||
# elevation so inverters that switch off at night show "Sleeping", not "Offline".
|
||||
# Leave LATITUDE/LONGITUDE empty to treat every silent inverter as offline.
|
||||
SITE_TIMEZONE=Europe/Athens
|
||||
SITE_LATITUDE=
|
||||
SITE_LONGITUDE=
|
||||
# Sun elevation (degrees) below which inverters are expected to be off
|
||||
DAYLIGHT_MIN_ELEVATION=5
|
||||
|
||||
# Inverter counts as Online if its last reading is newer than this
|
||||
ONLINE_WINDOW_SECONDS=300
|
||||
# Raw readings older than this are purged (daily energy totals are kept)
|
||||
RETENTION_DAYS=730
|
||||
|
||||
# Underperformance alarm: flag an inverter producing less than this fraction
|
||||
# of the fleet median, averaged over the window. Skipped while the fleet makes
|
||||
# less than the minimum (dawn/dusk/heavy cloud). The per-kWp minimum is used
|
||||
# once every inverter has its array size (kWp) set, the W minimum otherwise.
|
||||
UNDERPERFORM_RATIO=0.75
|
||||
UNDERPERFORM_WINDOW_SECONDS=600
|
||||
UNDERPERFORM_MIN_FLEET_W_PER_KWP=50
|
||||
UNDERPERFORM_MIN_FLEET_W=1000
|
||||
|
||||
# String alarm: one MPPT input below this fraction of the other, once the
|
||||
# stronger input exceeds MPPT_MIN_POWER_W (inverters set to 2 MPPTs only)
|
||||
MPPT_IMBALANCE_RATIO=0.5
|
||||
MPPT_MIN_POWER_W=1000
|
||||
|
||||
# Browser origins allowed to call the API directly (JSON list). The dashboard
|
||||
# itself is same-origin and doesn't need this.
|
||||
CORS_ORIGINS=["*"]
|
||||
Reference in New Issue
Block a user