How can you calibrate a sensor like this? (screenshot)

Not super important to me but just curious if there is a way.

I am comparing the temperature readings of a Tado radiator thermostat to a Xiaomi Aqara weather sensor (I just balanced the Xiaomi on top of the thermostat).
Tado in orange and Xiaomi in blue here:
image

What kind of filters/math could one use to calibrate the Xiaomi sensor to match the Tado sensor more closely?
The max difference gets to about 0.6 degrees celsius.

0.6 degrees, but not higher/lower, seems up to 0.6 degrees over the max/min. So it sounds like you’d need to find the % inaccuracy first?
Then a template sensor should do the trick, unless you can add a formula to the xiaomi sensor definition?

0.6° is 3/10 of FA as they say.
And ‘correcting’ or ‘normalising’ (not calibrating) one sensor to read more like another is possible.
You need to plot the correlation between one value and the other and derive an offset over the whole of your observable range.
If you plot the offset with respect to the sensor you have highest confidence in then you can get excel to give you a polynomial for this offset.
It could just be add 0.6 or it could be x * 1.0003 + 0.4 = y
a polynomial would be (say) 1.002 * x^3 + 0.988 * x^2 - 0.000002 * x + 0.2 = y
Then you apply that formula in a template sensor - displaying the result of that instead of the original sensor

2 Likes

Excellent. I think I’ll try this. Not too sure how to though. Yet.

Because the Xiaomi is both under and over the Tado temperature, a simple correction will not work. Additionally, it seems that the temperatures cross paths at different points. So, while the two thermometers are likely making different readings in the same temperature, there’s also an issue where they are not actually in the same air temperature. Probably the Tado thermometer is enclosed more, and, therefore, reacts more slowly to temperature change.

Even if you could determine a formula to represent this, most likely, you are seeking to have the tado actually act on this new, calibrated temperature. And, unless the Tado device allows you to specify a calibration to it directly, you won’t be able to get it to act like you want it to.

What I’ve done for these situations is to turn my Tado-like device into a switch. This requires a bunch of automation code that basically says “when I want the Tado to be ‘ON’, set the set point to 2 degrees higher than the temperature it thinks it is. when I want it to be ‘OFF’, set the set point to 2 degrees lower than it thinks it is.” Then I use a generic_thermostat with my Xiaomi-like device as the sensor and put my real set point in that generic_thermostat.

If you decide to go this route, you’ll also need automations that watch the current temperature as reported by the Tado device, so that you can continue moving the Tado setpoint up and down in reference to the detected temperature.

On the other hand, if the Tado device does accept a temperature calibration, you could set up a single automation that adjusts the calibration point every time either of the temperature sensors change. My Tado-like device accepts such calibrations, however, I found this resulted in a lot more device changes than the other solution I presented.

As swiftly states there does seem to be both a sampling frequency and temporal difference in the sensors, on top of the discrepancy.
I’m not worried about the sometimes negative, sometimes positive aspect a simple mx +c can deal with that, but to collect your data you might want to ensure they are in the same conditions.
Presumably you can move both devices AND they are battery powered.
Put them both in a Box and put them in the fridge (sturdy (ish) and air tight (no gusts/breezes))
Then take the box out (after say 3 hours) record both temps.
Put them in another box with a chill pack and record temps every 15 mins
when they reach ambient take out the chill pack and move the inner box close (1m) to a constantly on heat source (knob turned right up that’s been on a while to establish a reasonably steady heat gradient) get an ambient + 2 (ish) degree reading
Wait for stabilised (rushing just invalidates the data)
Move box closer (rinse and repeat)
When you have high enough readings let box cool
Is the offset still the same at the ambient?
Plot graphs get polynomial
I’ll post sample code for new sensor.

sensor:
  - platform: template
    sensors:
      normalised_temp:
        friendly_name: Sensor X corrected to Match Sensor Y
        value_template: "{{ (states('sensor.mysensor_x') | float * 1.003 - 0.05) | round(1) }}"

The above is just an mx+c calc but you can adjust it as required
If you need a full polynomial we would probably be better off with a multi-line template so come back and we’ll have a go.
Positioning of the above, is dependant upon your config. DON’T repeat any headers you already have unless you run packages

Which makes sense as the Xiaomi sensor only updates at 0,5 change in temperature.

1 Like

Yep, pretty much as I said, 3 tenths of FA
But the principle is sound for ‘other’ uses :smiley:

But don’t you mean that the sensor has a 0.5° resolution ???

No, that is not what I mean :wink:

So the sensor, will read (say) 18.3 and will wait until a 0.5 degree rise/fall ?
So will then show (again say) 18.8 ???
That’s crazy :crazy_face: , it just depends at which temperature you put the batteries in what reading you get !

That is not how it works. The sensor sends an update on a minimum change of 0.5 degrees or 6% in humidity. So it might also update on 0.1 degrees if the humidity changed >6% Or update 0.7 degrees etc.

1 Like

Thankyou for the detailed/consise response.
I don’t have one of these so the old adage about ‘assume’ ring true
Also the benefits of RTFM
Thanks again :+1:

Sand,
Given @sjee 's insights I think this may me be a pointless excercise.
But at least you’ll know how to handle sensor templates … :rofl:

1 Like

It appears that the Tado signal is more attenuated than the Xiaomi. This creates a situation where the Xiaomi signal always leads the Tado resulting in hysteresis. This is likely due to the Xiaomi sensor being more exposed to the local temperature. You might try gradually adding thin insulation to the Xiaomi. Even a sandwich bag will have a significant effect by reducing the flow of air to the Xiaomi.