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>
This commit is contained in:
+18
-3
@@ -49,6 +49,10 @@ class IngestResult(BaseModel):
|
||||
received: int
|
||||
stored: int
|
||||
duplicates: int
|
||||
clamped_future: int = Field(
|
||||
description="Readings stamped in the future (clock wrong, or local time sent as UTC); "
|
||||
"stored at the time they were received instead"
|
||||
)
|
||||
|
||||
|
||||
class InverterUpdate(BaseModel):
|
||||
@@ -71,7 +75,7 @@ class Inverter(BaseModel):
|
||||
|
||||
|
||||
Severity = Literal["info", "warning", "critical"]
|
||||
State = Literal["ok", "warning", "fault", "offline", "sleeping", "unknown"]
|
||||
State = Literal["ok", "standby", "warning", "fault", "offline", "sleeping", "unknown"]
|
||||
|
||||
|
||||
class Issue(BaseModel):
|
||||
@@ -82,6 +86,9 @@ class Issue(BaseModel):
|
||||
|
||||
class Health(BaseModel):
|
||||
online: bool = Field(description="A reading arrived within ONLINE_WINDOW_SECONDS")
|
||||
feeding: bool | None = Field(
|
||||
description="status_code is one of FEEDING_STATUS_CODES; null when no status_code is reported"
|
||||
)
|
||||
state: State
|
||||
issues: list[Issue]
|
||||
avg_power_w: float | None = Field(description="Mean AC power over the comparison window")
|
||||
@@ -90,18 +97,26 @@ class Health(BaseModel):
|
||||
)
|
||||
|
||||
|
||||
class EnergyToday(BaseModel):
|
||||
wh: int | None
|
||||
estimated: bool = Field(description="Integrated from AC power, not the inverter's own counter")
|
||||
|
||||
|
||||
class InverterStatus(BaseModel):
|
||||
inverter: Inverter
|
||||
health: Health
|
||||
energy_today: EnergyToday
|
||||
latest: dict[str, Any] | None
|
||||
|
||||
|
||||
class Totals(BaseModel):
|
||||
ac_power_w: int
|
||||
daily_energy_wh: int
|
||||
total_energy_wh: int
|
||||
daily_energy_wh: int | None
|
||||
daily_energy_estimated: bool
|
||||
total_energy_wh: int | None = Field(description="Null until the inverters report a lifetime counter")
|
||||
inverter_count: int
|
||||
online_count: int
|
||||
feeding_count: int
|
||||
problem_count: int
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user