I’m experimenting with temperature sensors and have two data points that seems to be conflicted:
A DS18B20 sensor on a D1 Mini showing 81.3 F
Sonoff Zigbee temperature sensor showing 70 F
Both the sensors are next to each other, the thermostat is set to 72 F and my office desk is little away from main vent so little colder than rest of the house.
Why is DS18B20 showing so much deviation from the actual temperature? Is there a way to correct the reading?
First obtain a decent thermometer to calibrate both your sensors (that is work out the real reading vs reported). Do this for various temperatures from the lowest to the highest expected readings and record the values.
Your data may look like this - these are Celsius degrees - sorry:
Using the difference between the actual and reported reading, apply a template to your sensor readings.
sensor:
- platform: template
sensors:
real_bedroom_temp:
value_template: >
{% set rt = states('sensor.bedroom_temperature')|float %}
{% if rt >= 10 and rt <15 %} {% set rt = rt - 2 %}
{% elif rt >= 15 and rt < 20 %} {% set rt = rt - 2 %}
{% elif rt >= 20 and rt < 25 %} {% set rt = rt - 3 %}
{% elif rt >= 25 and rt < 30 %} {% set rt = rt - 5 %}
{% elif rt >= 30 %} {% set rt = rt - 4 %}
{% endif %}
{{ rt }}
A further note - some integrations (MQTT sensor for instance) allow you to apply the template directly when you read the sensor - rather than to the value of an existing sensor.
Once should be fine - but given the large difference between the two sensors one of them could be faulty.
I haven’t used a DS18B20 but I understand they are finicky to configure and code so possibly the issue is there as well, although if you are using ESPhome it looks fairly simple once you determine the address.