Xiaomi Mi Smart Home - Wrong Temperature, Humidity and Pressure sensor readings

When I moved houses I also upgraded from openHAB 2 to openHAB 3 and have noticed some funny stuff happening with the Xiaomi Gateway 2 Temperature, Humidity and Pressure sensors (the square shaped ones).

I used to log these values every 20 minutes, however now they get logged every time they change on openHAB 3. I have noticed that when looking at historical values that sometimes I see invalid readings.

For example:

  • Temperature values show as “-100”
  • Temperature values show as “100”
  • Relative humidity values show as “654.36”
  • Pressure values show as “0”.

Looking at the device, it only supports a specific range for reading data, so these values can’t be possible.

In a few cases I’ve noticed that this occurs when the device looses power or connection to the bridge. I am wondering if anyone else has noticed this in their setup as well?

At the moment I have created a MySQL stored procedure that I run manually that removes these invalid values from the persistence data. I will probably look at submitting a fix to ignore readings outside of the valid range.

In my setup, this is happening when the batteries are too low…

Note that OH3 installs rrd4j persistence by default, with its own strategies. You then need to be careful about which service you are looking at.