Files
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

52 lines
2.2 KiB
Bash

# 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
# status_code values meaning "feeding the grid" (JSON list): 8 on the
# standard units, 7 on INV1's OEM board. Any other code shows as Standby.
FEEDING_STATUS_CODES=[7, 8]
# Readings stamped more than this many seconds in the future (poller clock
# wrong, or local time sent as UTC) are stored at the time they arrive.
MAX_FUTURE_SKEW_SECONDS=300
# Daily energy is estimated by integrating AC power while the energy counters
# aren't decoded; gaps between readings longer than this aren't bridged.
ENERGY_INTEGRATION_MAX_GAP_SECONDS=300
# Browser origins allowed to call the API directly (JSON list). The dashboard
# itself is same-origin and doesn't need this.
CORS_ORIGINS=["*"]