Skip to content

Add per-sensor calibration offset for 1-wire (DS18B20) sensors - #1024

Open
piciuok wants to merge 2 commits into
heishamon:mainfrom
piciuok:dallas-offset
Open

piciuok wants to merge 2 commits into
heishamon:mainfrom
piciuok:dallas-offset

Conversation

@piciuok

@piciuok piciuok commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

DS18B20 sensors are only accurate to ±0.5 °C, and pipe-mounted sensors add their own error. That makes temperature differences between sensors (e.g. DHW outlet vs. circulation return) unreliable. This PR adds a per-sensor calibration offset in 0.1 °C steps (range −10.0…+10.0).

Changes

  • Web UI: new "Offset (°C)" column in the 1-wire sensor table (number input, step 0.1, saved on change)
  • HTTP: /dallasoffset?<address>=<value>
  • MQTT: set via <base>/1wire/<address>/offset/set (accepts 0.3 and 0,3); state published (retained) on <base>/1wire/<address>/offset
  • /json: new Offset field per sensor
  • The offset is applied to the raw reading before the delta filter, so MQTT, web, JSON and rules (ds18b20#...) all see the corrected value. The 85.00 °C power-on-reset check still uses the raw value.
  • Changing the offset shifts the last known value immediately and republishes it, so there is no wait for the next reading.
  • Offsets are stored in /dallasoffset.json, separate from dallas.json, so a downgrade to older firmware keeps reading the aliases.
  • Removing a sensor also clears its retained offset topic.
  • README section added.

Testing

  • Compiles for ESP8266 and ESP32-S3 with the CI FQBNs.
  • Tested on a large (ESP32-S3) board with 3 DS18B20 sensors:
    • offsets set from the web UI survive a reboot
    • /json returns the Offset field
    • changing an offset (0.2 → 0.5) shifts the reported temperature immediately
    • the log shows 1wire sensor <address> offset set to <value>

Screenshots

1-dallas-offset-column 2-dallas-offset-edit 3-dallas-table-closeup

piciuok and others added 2 commits October 23, 2026 14:35
DS18B20 sensors are only accurate to +/-0.5 C and pipe-mounted sensors add
their own error, which makes temperature differences between sensors
(e.g. DHW outlet vs. circulation return) unreliable. This adds a
calibration offset per sensor, in 0.1 C steps (range -10.0..+10.0).

- web UI: new "Offset" column in the 1-wire sensor table
- HTTP: /dallasoffset?<address>=<value>
- MQTT: set via <base>/1wire/<address>/offset/set, state published
  (retained) on <base>/1wire/<address>/offset
- /json: new "Offset" field per sensor
- the offset is applied to the raw reading before the delta filter, so
  MQTT, web, JSON and rules (ds18b20#...) all see the corrected value;
  the 85.00 C power-on-reset check still uses the raw value
- changing the offset shifts the last known value immediately and
  republishes it, no need to wait for the next reading
- offsets are stored in /dallasoffset.json (separate from dallas.json so
  a downgrade to an older firmware keeps reading the aliases)
- removing a sensor also clears its retained offset topic

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012YRBRe8cXeQBVpjaXByNeG
@IgorYbema IgorYbema added the enhancement New feature or request label Oct 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants