Files
bonaminandClaude Opus 5.5 d4b584e364 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>
2026-10-21 07:42:48 +03:00

38 lines
1.5 KiB
Markdown

# Refusol Solar Monitor — notes for Claude
See README.md for stack, API and health rules.
## Priorities
What matters most to the owner, in order:
1. Is each inverter operational or has it failed?
2. Current power per inverter, side by side — a big gap means a blown string
fuse / breaker on one array.
More data is welcome, but never at the expense of those two.
## Conventions
- Mirrors `C:\development\bellsystems-cp` infra: compose with backend +
frontend + nginx containers, one host port proxied by Nginx Proxy Manager,
`.env` from `.env.example`, deploy by `git pull` + `docker compose up -d --build`
on the VPS (`deploy-host.sh`). Repo lives on gitea.bonamin.net.
- Frontend must work well on phones (it's mostly used there) and stays an
installable PWA. A Flutter app may come later — keep everything the UI
needs available through the REST API.
- Parameters are defined once in `backend/app/fields.py`. The parameter map
and scaling factors are still being researched; keep the schema tolerant
(all fields optional, unknown keys land in `extra`).
- Chart colors: one categorical slot per inverter by its position in the
sorted inverter list (`--series-N` tokens in `frontend/src/index.css`).
Status colors are only for health and always come with an icon + label.
## Commits
Commit every change with a descriptive conventional message
(`feat(scope): ...`, `fix(scope): ...`, `docs: ...`), explaining why.
## Checks
- `cd backend && .venv/Scripts/python -m pytest`
- `cd frontend && npm run build`