Skip to content

make the temperature column optional, and stop showing 0 °C for a sensor that does not exist - #14

Merged
teian merged 2 commits into
mainfrom
feat/optional-temperature
Aug 20, 2026
Merged

teian merged 2 commits into
mainfrom
feat/optional-temperature

Conversation

@teian

@teian teian commented Aug 20, 2026

Copy link
Copy Markdown
Owner

SolarGehannWR1 (SB 2500) has no temperature sensor: it answers spot.inverter_temperature
with "LRI not available". The day view showed 0,00 °C for every five-minute
row and for "Letzte Temperatur" anyway.

The reading was invented

The backend is right: no sensor means NAN_S32, which becomes None, a NULL
column and "temperature": null in the payload. The dashboard then did:

const numeric = Number(value);
return value === undefined || !Number.isFinite(numeric) ? null : numeric;

Number(null) is 0, and 0 is finite — so a value the inverter never sent
was rendered as a measurement. The same helper existed twice, in
DayHistoryTables and DayHistorySummary; it now lives once in
lib/history.ts, treats null, undefined and blank as absent, and keeps a
genuine 0 (a string really can produce nothing).

The column is optional

With the null fixed the column would show dashes, which says no more than the
zeros did. So it appears only where a reading exists, and
service.show_temperature (default true) drops the series from the payload
entirely for anyone who never wants it:

[service]
show_temperature = false

Off means the temperature key, its series and its row field are absent —
not null — so the dashboard has nothing to draw and no dashes to draw it with.
The aggregate view never carried a temperature series and still does not:
averaging sensors across inverters would invent a reading of a different kind.

Testing

cargo test --workspace --locked (292 passed) and
cargo clippy --workspace --all-targets --locked -- -D warnings are clean; the
dashboard type-checks, builds, and its tests pass (20).

New tests cover the payload with the option on and off, and the value reader:
null and undefined absent, 0 kept, unparseable and blank absent.

teian added 2 commits August 20, 2026 13:04
Two problems behind one symptom. A missing temperature arrived as JSON
null, and `Number(null)` is 0, so every five-minute row and the day summary
showed 0.00 °C for an inverter that has no sensor at all — a reading it
never sent. The helper doing that was duplicated in two components; it now
lives in lib/history.ts, treats null, undefined and blank as absent, and
keeps a genuine zero.

With that fixed the column would show dashes instead, which says no more
than the zeros did, so it appears only where a reading exists — and the new
service.show_temperature (default true) drops the series from the payload
altogether for operators who never want it. The aggregate view never had a
temperature series: averaging sensors across inverters would invent a
reading.
@teian
teian merged commit 459ba67 into main Aug 20, 2026
12 checks passed
@teian
teian deleted the feat/optional-temperature branch August 20, 2026 11:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant