Repository navigation
make the temperature column optional, and stop showing 0 °C for a sensor that does not exist - #14
Merged
Merged
Conversation
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.
…ture # Conflicts: # docs/configuration.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
SolarGehannWR1(SB 2500) has no temperature sensor: it answersspot.inverter_temperaturewith "LRI not available". The day view showed
0,00 °Cfor every five-minuterow and for "Letzte Temperatur" anyway.
The reading was invented
The backend is right: no sensor means
NAN_S32, which becomesNone, a NULLcolumn and
"temperature": nullin the payload. The dashboard then did:Number(null)is0, and0is finite — so a value the inverter never sentwas rendered as a measurement. The same helper existed twice, in
DayHistoryTablesandDayHistorySummary; it now lives once inlib/history.ts, treatsnull,undefinedand blank as absent, and keeps agenuine
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(defaulttrue) drops the series from the payloadentirely for anyone who never wants it:
Off means the
temperaturekey, 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) andcargo clippy --workspace --all-targets --locked -- -D warningsare clean; thedashboard type-checks, builds, and its tests pass (20).
New tests cover the payload with the option on and off, and the value reader:
nullandundefinedabsent,0kept, unparseable and blank absent.