Xiaomi temp sensor - issue with humidity values

Xiaomi, Ikea TRÅDFRI, Philips Hue and more.

Moderator: leecollings

Post Reply
ljoncz
Posts: 4
Joined: Thursday 12 January 2017 10:15
Target OS: NAS (Synology & others)
Domoticz version:
Contact:

Xiaomi temp sensor - issue with humidity values

Post by ljoncz »

Hi,

I have both old Xiaomi temp sensor (round one) and new temp sensor (Aqara - more sqaure one).
Aquara one works flawlessly with Domoticz, but the round one has issues with humidity values.
Below in the post I refer to the round one.

Setup

Domoticz
Version: 3.8967
Build Hash: aa5554e-modified
Compile Date: 2018-02-26 07:46:48
Installed on Synology NAS

Xiaomi Gateway v2
Version code: 173

Domoticz devices names
"Xiaomi Temperature (OLD)"
"Xiaomi Humidity (OLD)"
"Xiaomi COMBO (OLD)" - Temp/Hum device

Issue description
The Humidity sensor has usually value 0 and sometimes it is correct.
The Humidity value for Combo sensor is correct most of the time, but sometimes it is 0
See graphs below:
Xiaomi-page-001 (1).jpg
Xiaomi-page-001 (1).jpg (162.97 KiB) Viewed 1814 times


There are 4 possible cases:
case 1. Humidity sensor correct / Combo sensor correct
case 2. Humidity sensor ZERO / Combo sensor correct
case 3. Humidity sensor ZERO / Combo sensor ZERO
case 4. Humidity sensor correct / Combo sensor ZERO

For debuging purposes I created LUA script that prints a message when any of the three devices is changed.

Looking at the log I found following events types:
Event type #1 - report by the sensor and heartbeat

Code: Select all

2018-03-10 21:47:57.918 {"cmd":"report","model":"sensor_ht","sid":"158d0001c1a1c7","short_id":40892,"data":"{\"temperature\":\"2125\"}"} 
2018-03-10 21:47:57.921 {"cmd":"report","model":"sensor_ht","sid":"158d0001c1a1c7","short_id":40892,"data":"{\"humidity\":\"4561\"}"} 
2018-03-10 21:47:57.933 {"cmd":"heartbeat","model":"sensor_ht","sid":"158d0001c1a1c7","short_id":40892,"data":"{\"voltage\":3005,\"temperature\":\"2125\",\"humidity\":\"4561\"}"} 
2018-03-10 21:47:57.944 (Xiaomi) Temp (Xiaomi COMBO (OLD)) 
2018-03-10 21:47:57.946 LUA: Xiaomi Temperature changed 
2018-03-10 21:47:57.959 LUA: Xiaomi Combo changed 
2018-03-10 21:47:57.971 (Xiaomi) Humidity (Xiaomi Humidity (OLD)) 
2018-03-10 21:47:57.972 LUA: Xiaomi Humidity changed 
2018-03-10 21:47:58.011 LUA: Xiaomi Temperature changed 
2018-03-10 21:47:58.024 (Xiaomi) Temp (Xiaomi COMBO (OLD)) 
2018-03-10 21:47:58.036 LUA: Xiaomi Combo changed 
2018-03-10 21:47:58.049 (Xiaomi) Humidity (Xiaomi Humidity (OLD)) 
2018-03-10 21:47:58.057 LUA: Xiaomi Humidity changed
After this event, the status of the devices is:
Humidity: correct value, Last seen: 21:47:58
Combo: correct value, Last seen: 21:47:58
Everything looks fine (case 1 described above)

Event type #2 - update of Humidity device to 0

Code: Select all

2018-03-10 21:50:08.835 LUA: Xiaomi Humidity changed
After this event, the status of the devices is:
Humidity: 0 (WRONG), Last seen: 21:50:08
Combo: correct value, Last seen: 21:47:58 (NO CHANGE)
(case 2 described above)

In the log, there is only my debug message from lua script.
This happens every 5 minutes and looks like a bug to me.

Event type #3 - report by device (no heartbeat)

Code: Select all

2018-03-10 22:12:04.175 {"cmd":"report","model":"sensor_ht","sid":"158d0001c1a1c7","short_id":40892,"data":"{\"temperature\":\"2094\"}"} 
2018-03-10 22:12:04.201 {"cmd":"report","model":"sensor_ht","sid":"158d0001c1a1c7","short_id":40892,"data":"{\"humidity\":\"4497\"}"} 
2018-03-10 22:12:04.233 LUA: Xiaomi Temperature changed 
2018-03-10 22:12:04.259 (Xiaomi) Temp (Xiaomi COMBO (OLD)) 
2018-03-10 22:12:04.264 LUA: Xiaomi Combo changed 
2018-03-10 22:12:04.302 (Xiaomi) Humidity (Xiaomi Humidity (OLD)) 
2018-03-10 22:12:04.308 LUA: Xiaomi Humidity changed
After this event, the status of the devices is:
Humidity: 0 (WRONG), Last seen: 22:12:04
Combo: 0 (WRONG), Last seen: 22:12:04
(case 3 described above)

Today I wasn't able to reproduce case 4 - correct value for Humidity device and 0 value for Combo device.

Important
In Xiaomi Mi Home app the humidity values are always correct.
The humidity values in json calls seem to be correct.
Temperature value works fine.
Similar Aqara sensor works fine for both temperature and humidity.
No idea why Humidity device (and only this one) is updated every 5 minutes - the "Last seen" date changes.


Any idea how to fix the issue with humidity values?

Thanks
Lech
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest