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>
4.4 KiB
Refusol Solar Inverter Dashboard — Build Brief
Context
Before writing any code, read the existing project at C:\development\bellsystems-cp.
Use it as the reference for all conventions: Docker setup, image naming, registry config,
Nginx Proxy Manager integration, compose structure, environment variable patterns, etc.
Mirror those conventions exactly throughout this project.
What to Build
A full-stack solar inverter monitoring system.
An on-site Python poller script runs on a laptop at the solar installation, reads live data from up to 5 Refusol 020K inverters over the local network, and POSTs readings to this backend every 60 seconds. The frontend displays the data as a live dashboard.
Backend API
Stack: match whatever bellsystems-cp uses. If it uses FastAPI + SQLite, use that.
If it uses Express + PostgreSQL, use that.
Endpoints
| Method | Path | Description |
|---|---|---|
POST |
/api/readings |
Ingest a batch of readings (one per inverter). Auth: X-API-Key header. |
GET |
/api/inverters |
List all known inverters |
GET |
/api/inverters/{id}/latest |
Latest reading for one inverter |
GET |
/api/inverters/{id}/history |
Historical readings. Query params: from, to (ISO timestamps) |
GET |
/api/summary |
Latest reading from every inverter + combined totals |
Reading Schema
Each reading stored per inverter per poll cycle:
inverter_id string
timestamp datetime (UTC)
ac_voltage_l1_v float (Volts)
ac_voltage_l2_v float
ac_voltage_l3_v float
dc_voltage_mppt1_v float (Volts)
dc_voltage_mppt2_v float
dc_current_mppt1_a float (Amps)
dc_current_mppt2_a float
ac_current_l1_a float (Amps)
ac_current_l2_a float
ac_current_l3_a float
ac_power_total_w integer (Watts)
grid_frequency_hz float (Hz)
temperature_c integer (°C)
daily_energy_wh integer (Wh)
total_energy_wh integer (Wh)
Data Retention
Auto-purge readings older than 2 years.
Frontend Dashboard
No login required — public read-only dashboard.
Main page — all inverters
- One card per inverter showing:
- Current power output (W)
- Today's yield (kWh)
- Total lifetime yield (kWh)
- AC voltages (L1/L2/L3)
- Inverter temperature (°C)
- Status badge: Online (reading within last 5 min) / Offline
- Combined total power across all inverters (hero number at top)
- Power chart: last 24 h, one line per inverter
- Daily energy chart: last 30 days, bar chart, combined or per-inverter toggle
Inverter detail page
- All parameters (voltages, currents, power, frequency, temperature, energy)
- Longer history charts (7 day power, 365 day daily energy)
Docker
docker-compose.ymlwith separate containers for backend, frontend (and DB if needed)- Follow
bellsystems-cpfor image naming and private registry push workflow - Expose on a single port that NPM (Nginx Proxy Manager) can proxy to
- Target domain:
solar.bonamin.net - Include
.env.examplewith all required variables documented
Poller Integration
Update refusol_poller.py to POST to the backend after each poll cycle.
Add BACKEND_URL and API_KEY as config variables at the top of the file.
The POST payload for /api/readings should be a JSON array — one object per inverter
polled in that cycle, each matching the reading schema above plus inverter_id.
Confirmed parameter map (do not change these)
# USS protocol over TCP, port 21062, USS address 0
# Scaling factors are reverse-engineered and verified against live inverter data
# P050 AC Voltage L1 raw / 40 → V
# P05B AC Voltage L2 raw / 40 → V
# P064 AC Voltage L3 raw / 40 → V
# P052 DC Voltage MPPT1 raw / 40 → V
# P054 DC Voltage MPPT2 raw / 40 → V
# P05A DC Current MPPT1 raw / 10 → A
# P05C DC Current MPPT2 raw / 10 → A
# P068 AC Current L1 raw / 100 → A
# P069 AC Current L2 raw / 100 → A
# P06A AC Current L3 raw / 100 → A
# P06D AC Power Total raw → W
# P06C Grid Frequency raw / 20 → Hz
# P070 Temperature raw >> 16 → °C
# P063 IND=0 Daily Energy raw * 10 → Wh
# P063 IND=11 Total Energy raw → Wh
Questions?
Ask me for:
- The full
refusol_poller.pysource - Gitea server URL / Docker registry credentials
- Specific port to expose
- Any other VPS / infrastructure detail