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:
2026-10-21 07:42:48 +03:00
co-authored by Claude Opus 5.5
commit d4b584e364
59 changed files with 10849 additions and 0 deletions
+44
View File
@@ -0,0 +1,44 @@
import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'
import tailwindcss from '@tailwindcss/vite'
import { VitePWA } from 'vite-plugin-pwa'
export default defineConfig({
server: {
host: '0.0.0.0',
port: 5173,
proxy: {
'/api': {
target: process.env.VITE_API_PROXY || 'http://localhost:8000',
changeOrigin: true,
},
},
},
plugins: [
react(),
tailwindcss(),
VitePWA({
registerType: 'autoUpdate',
manifest: {
name: 'Solar Monitor',
short_name: 'Solar',
description: 'Live status and output of the Refusol inverters',
start_url: '/',
display: 'standalone',
background_color: '#0d0d0d',
theme_color: '#0d0d0d',
icons: [
{ src: '/icons/icon-192.png', sizes: '192x192', type: 'image/png', purpose: 'any' },
{ src: '/icons/icon-512.png', sizes: '512x512', type: 'image/png', purpose: 'any' },
{ src: '/icons/icon-maskable-512.png', sizes: '512x512', type: 'image/png', purpose: 'maskable' },
],
},
workbox: {
globPatterns: ['**/*.{js,css,html,ico,png,svg}'],
// Live data must never come from the cache
navigateFallbackDenylist: [/^\/api/],
runtimeCaching: [],
},
}),
],
})