Publish realtime analog values with three decimals, not one #12

Merged
nexus merged 1 commit from fix/realtime-analog-precision into main 2026-07-31 11:49:38 +02:00
Owner

Realtime pH/redox looked frozen in Home Assistant

Calibration.Apply rounded the calibrated analog value to one decimal (copied from the vendor apps display rounding). For pH that is too coarse — a real value drifting through 7.25–7.29 all rounds to 7.3`. Since realtime publishing is change-driven, the rounded value never changes, nothing is published, and the HA entity looks frozen for minutes while the app shows it moving.

Round to three decimals (full sensor precision) instead: pH raw 413 → 7.17, redox raw 580 → 543.968. getStats values are unaffected (already calibrated, never go through Apply).

Tests, docs and the calibration examples updated. go build, go test ./..., golangci-lint v2.12.2 all clean.

## Realtime pH/redox looked frozen in Home Assistant `Calibration.Apply` rounded the calibrated analog value to **one** decimal (copied from the vendor app`s display rounding). For pH that is too coarse — a real value drifting through 7.25–7.29 all rounds to `7.3`. Since realtime publishing is **change-driven**, the rounded value never changes, nothing is published, and the HA entity looks frozen for minutes while the app shows it moving. Round to **three** decimals (full sensor precision) instead: pH raw 413 → `7.17`, redox raw 580 → `543.968`. `getStats` values are unaffected (already calibrated, never go through `Apply`). Tests, docs and the calibration examples updated. `go build`, `go test ./...`, `golangci-lint v2.12.2` all clean.
Publish realtime analog values with two decimals, not one
All checks were successful
CI / test (pull_request) Successful in 2m13s
CI / test (push) Successful in 2m45s
CI / image (pull_request) Successful in 1m1s
CI / image (push) Successful in 53s
CI / publish-commit-tag (pull_request) Has been skipped
CI / publish-version-tag (pull_request) Has been skipped
CI / publish-commit-tag (push) Has been skipped
CI / publish-version-tag (push) Has been skipped
b3a6d7f389
Calibration.Apply rounded the calibrated value to one decimal, copied from
the vendor app's display rounding. For pH that is too coarse: a real value
drifting through 7.25–7.29 all rounds to 7.3. Because realtime publishing is
change-driven, the rounded value never changes, so nothing is published and
the Home Assistant entity looks frozen for minutes while the app shows the
value moving.

Round to two decimals instead (pH raw 413 → 7.17, redox raw 580 → 543.97).
getStats values are unaffected — they arrive already calibrated and never go
through Apply.
nexus force-pushed fix/realtime-analog-precision from b3a6d7f389
All checks were successful
CI / test (pull_request) Successful in 2m13s
CI / test (push) Successful in 2m45s
CI / image (pull_request) Successful in 1m1s
CI / image (push) Successful in 53s
CI / publish-commit-tag (pull_request) Has been skipped
CI / publish-version-tag (pull_request) Has been skipped
CI / publish-commit-tag (push) Has been skipped
CI / publish-version-tag (push) Has been skipped
to c8de2b6885
All checks were successful
CI / test (push) Successful in 2m33s
CI / test (pull_request) Successful in 3m4s
CI / image (push) Successful in 1m5s
CI / image (pull_request) Successful in 57s
CI / publish-commit-tag (push) Has been skipped
CI / publish-commit-tag (pull_request) Has been skipped
CI / publish-version-tag (push) Has been skipped
CI / publish-version-tag (pull_request) Has been skipped
2026-07-31 11:40:08 +02:00
Compare
nexus changed title from Publish realtime analog values with two decimals, not one to Publish realtime analog values with three decimals, not one 2026-07-31 11:40:20 +02:00
nexus merged commit 6c32d3c596 into main 2026-07-31 11:49:38 +02:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
nexus/WifiPoolToMQTT!12
No description provided.