Temp/Hum Sensor Calibration

Have many users found the need to calibrate the sensors on their HestiaPi? There’s an old saying that if you have one thermometer you know the temperature but if you have two you have two you have confusion. Just based on the overall feel of the house and based on my other temperature sensors the HestiaPi seems to be reading about 5 degrees F higher than it should. The humidity looks to be reading about 10% low as well.

Do most users calibrate? If so, what’s the most efficient way to do so? A Rule, JS transformation, configuration setting on the library that interfaces with the device, something else?

1 Like

We have seen that the sensor was reading 2.7 degrees F (1.5 degrees C) due to CPU heat affecting the readings. Your readings are a bit higher but is possible. Make sure the sensor is placed inside its compartment with the shiny rectangular component facing outwards and not blocked by the plastic of the case.
I haven’t heard of other users suggesting some specific calibration method although I believe there should be a non-linear function to link actual temp with reading.

I put it in the little chamber but didn’t pay close attention to the orientation. I’ll take the case off and check that when I get home today.

Question, should the unit be powered off when taking the case/screen off or is it safe to remove and restore the screen with the RPi powered on? I would guess it needs to be powered off but if I don’t have to I can save that time.

For my purposes, in the range of temperatures I experience in the house (60 to 80), linear is probable good enough. I don’t care if it’s super exact. As long as it’s within about 3 degrees F and 5% humidity it’s fine (I think that’s within the range of accuracy on that sensor). But my wife just freaked out that I had the thermostat set to 70 degrees F which is way warmer than we normally keep the house during the winter. But the rest of the thermometers in the house are showing that the house is keeping roughly the same temps the old thermostat kept it when set to 65 degrees F. The little digital thermostat I have next to the HestiaPi is also showing the room to be at 65 degrees F.

Thanks for the tip though. Sadly, I never would have thought to check that. That’s why we have both software people and hardware people. :wink:

You can check its orientation from outside. Use a toothpick or something to move the tiny purple board if it’s hidden. Here are both sides:
Top view is the one to be facing outwards.

Yes for 2 reasons. 1. This LCD type (non HDMI but GPIO based) is not plug and play. The handshake is initiated during boot only. Connecting it or reconnecting it after boot will simply appear white. 2. Reconnecting it may cause a power surge on the PSU that may drop voltage and while recovering the Pi may reboot or freeze.

Then edit this file

bme280C.py in the same directory for the Celsius people.
At the last lines (line 167) the F file has already some math conversion from C as the BME sensor script returns temp in C. You can edit that and call the .sh file to test.

1 Like

I did have the sensor in backwards. I’ve flipped it around and we’ll see how closely it matches my other thermometers. The fact that it was backwards definitely explains the discrepancies. Thanks again!

Edit: Now that’s it’s been a few hours flipped the right way the temp is within 1-2 degrees F and 1% humidity compared to my other sensor which is inches from the HrstiaPi. So I think all is well.

1 Like

I’m afraid I am having a similar issue. My HestiaPi is reading approx 4-5 degrees F higher than other instrumentation I own. I can also feel that it’s not as warm as it’s reporting…

I have made sure the sensor is pointed the correct direction as instructed above, but it was not backwards to begin with.

I found bme280F.py and I found the section for temperature refinement but am at a loss as to how to adjust it without simply guessing which values to tweak…

Can anyone point me in the correct direction? I’m not quite understanding the formula.

If you simply want to shift the readings down by 4-5 degrees, simply modify near the bottom of the bme280F.py file the line:
print "Temperature : ", int((temperature*1.8)+32), "F"
to (changed 32 to 28 for a -4 adjustment):
print "Temperature : ", int((temperature*1.8)+28), "F"
For more complicated adjustment (but still not perfect) you could test first the fluctuation in different room temperatures and then apply the different adjustment per range, like between 60 and 70F reduce by 5. Between 71 and 80F reduce by 4 and so on. This should be applied to variable temperature before it gets printed from the above line (and then parsed by getBMEtemp.sh).

Note, after you edit bme280F.py you will need to copy bme280F.py to bme280.py as that is the script that actually get’s called by OH. Or you can toggle to TempUnit to C and then back to F which will do the copy for you.

But you should also make a copy of your changed files in case you run a manual update via the UI as they will get overwritten.

Ah… I see… I was looking on the wrong place… I was looking at the refine temperature code… My brain locked when I saw all of the binary shifts.

So the adjustment I need to make is right as it posts the final value.

Thank you.

And to Rich for the tip that bme280.py is the only one that’s called by OH.

I should mention that editing the python script isn’t the only place this can be applied. There are all sorts of places along the path where the adjustment can be made.

  • in the Python script that queries the hardware
  • in the Exec Thing configuration as a transformation
  • on the Item using the transform Profile (not supported in 2.4)
  • on the Item using the offset Profile (only works on Number Items and the Exec binding can only use String Items)
  • in a Rule (somewhat painful to do because of the long load times)

For example, if you change the Thing to

Thing exec:command:gettemp "Exec temp" [ command="/home/pi/scripts/getBMEtemp.sh", interval=10, timeout=5 transform="JS:(adjusttemp.js)" ]

And put the following into /etc/openhab2/transform/adjusttemp.js.

(function(i) {
  return i - 4;

I’m not sure what the best approach is. I kind of dislike the way the C/F stuff works right now and am brain storming some ideas to make it work better/avoid duplicate code.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.