Commit Graph
12 Commits
Author SHA1 Message Date
bonaminandClaude Opus 5.5 80f82c8c63 feat(settings): save display settings without an API key
Asking for the key every time a phone changes a chart option was friction
the owner doesn't want. These settings only change how data is displayed
(averaging, scale, chart range, language default), so PUT /api/settings is
now open. Inverter edits (name, kWp, ...) and ingest still need the key.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-22 18:24:16 +03:00
bonaminandClaude Opus 5.5 9ac86e2588 docs: settings API, per-inverter offline window, language
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-22 18:15:38 +03:00
bonaminandClaude Opus 5.5 0b74842560 feat(frontend): settings page, Greek translation, comparison and chart options
The end user is Greek and the owner wants to confirm at a glance that
every inverter is working without one cloud-shaded reading raising doubt.

- Settings page (gear in the header), stored on the server and shared
  by every viewer; saving asks for the API key once per device.
- Output comparison: latest reading or average of the last 3/5 (evens out
  a passing cloud); bar scale auto (round ceiling above the best) /
  highest = 100% / custom kW; percentage vs fleet median, best inverter
  or the custom kW.
- Power chart: 30 min to last month plus "last production run", a
  per-visit range picker on the card, optional light/strong smoothing.
  Series reporting slower than the chart bucket (INV5, every 5 min) are
  now interpolated across short gaps — on 1-min buckets their line used
  to vanish entirely; night gaps still break the line.
- Greek/English: per-device switch in the header, shared default in
  settings, Greek number/date formats; issue texts translated from
  code + params.
- AC voltage shown as phase (L-N) or line (L-L, x√3, matching the
  inverter screens); lifetime total says how many inverters it covers;
  the inverter's own status text appears on its card.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-22 18:15:38 +03:00
bonaminandClaude Opus 5.5 c24770af1c feat(poller): simulate the five-inverter contract
The fake poller now matches the 2026-10-22 data contract: INV1/INV3 send
no currents/DC/energy, INV2/INV4 add currents and MPPT1 voltage, INV5
reports via the cloud every 5 min with real daily/lifetime counters and
keeps sending 0 W / Standby at night while the others go silent. Status
codes are the normalized 8/1. Lets the dashboard be tried against the
real mix of missing fields and cadences.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-22 18:15:38 +03:00
bonaminandClaude Opus 5.5 8029468fb1 feat(api): shared view settings, recent readings, last production run
Groundwork for the dashboard settings page and the five-inverter contract:

- GET/PUT /api/settings stores display options (comparison averaging,
  scale and reference, power chart range and smoothing, voltage display,
  default language) in the meta table. Shared by every viewer since there
  are no accounts; PUT needs the API key so a public visitor can't change
  everyone's view. Unknown keys are ignored, missing ones take defaults.
- /api/summary returns each inverter's last few readings (recent_power) so
  the comparison can average out one reading taken under a passing cloud.
- Offline is now judged per inverter: a couple of missed cycles at the
  unit's own cadence (INV5 is cloud-polled every ~5 min), never below
  ONLINE_WINDOW_SECONDS. Before, INV5 flapped offline between reports.
- /api/power?last_run=true covers the latest production run, split at
  night silences; units reporting 0 W overnight don't join runs.
- Issues carry params so clients can render them in Greek.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-22 17:59:33 +03:00
bonaminandClaude Opus 5.5 c725b748c7 fix(db): allow a request's SQLite connection to cross threads
FastAPI runs a sync dependency's setup, the endpoint and the teardown on
whichever threadpool worker is free, so a connection opened on one thread
was used/closed on another and sqlite3 raised ProgrammingError — 500s on
/api/power, /api/energy/daily and /api/summary under concurrent requests
(the dashboard fires three at once). Each request still gets its own
connection, used by one thread at a time.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-21 09:55:48 +03:00
bonaminandClaude Opus 5.5 42c7d18207 docs: record the verified register map and inverter IDs
P06D is a latched 21450 (not power), P052/P05A static, P063 frozen; power
is computed V*I. Lists what's sent, what isn't, the unmapped diagnostics,
the INV1-INV5 IP assignments, and that timestamps must be real UTC. The
simulator now sends the same payload shape.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-21 09:43:56 +03:00
bonaminandClaude Opus 5.5 d01cef991f feat: match the verified on-site poller payload
The on-site agent found that the DC (P052/P054/P05A/P05C) and energy (P063)
registers are static/frozen and ac_power_total_w is now computed V*I, so
the backend and dashboard have to cope with those fields being absent.

- Feeding/Standby from status_code (FEEDING_STATUS_CODES, default 7 and 8:
  INV1's OEM board uses 7). Online but not feeding = Standby; a standby
  inverter while peers produce is still caught by the underperformance
  check. Missing error_code stays "no fault".
- Daily energy falls back to AC power integrated between readings, flagged
  estimated (≈ in the UI); out-of-order (spooled) readings recompute the
  day. Existing databases get the column and a rebuild on startup.
- Totals are null instead of 0 when there's no energy data; lifetime shows
  "not available yet". Parameters the poller doesn't send are hidden on the
  detail page, DC lines only drawn when DC data exists.
- Timestamps more than 5 min in the future are stored at receive time and
  counted in clamped_future — the example payload carried local Athens time
  labelled +00:00.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-21 09:43:55 +03:00
bonaminandClaude Opus 5.5 0b0e4b7d6d docs(poller): test the endpoint with a real inverter id, not TEST
Any id posted becomes a permanent inverter card, and there's no delete yet.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-21 09:02:22 +03:00
bonaminandClaude Opus 5.5 9d41c77668 docs(poller): brief for the agent building the on-site poller
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-21 09:02:12 +03:00
bonaminandClaude Opus 5.5 b5c7663fd7 fix(deploy): run deploy-host.sh from its own checkout, any clone path
The hard-coded /home/bonamin/refusol-datalogger didn't match the real
clone (repo is refusol-datalogging). README clone URL updated too.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-21 08:53:54 +03:00
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