Xiaomi Aqara Temperature Humidity Sensor
Moderator: leecollings
-
- Posts: 7
- Joined: Friday 15 December 2017 11:51
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2024.7
- Contact:
Xiaomi Aqara Temperature Humidity Sensor
Because "Xiaomi Smart Home Suite" Topic is too big and is not easy to find there answers for questions, I suggest, to make smaller topics for single sensors or for specifics problems.
Here is my question: I've four Aqara temp sensors. All of them shows Battery level 100%. But two of them showed for some time Battery level 84%. Why two of them only and why just for some time? Something wrong in new firmware? What do the sensors show you?
Here is my question: I've four Aqara temp sensors. All of them shows Battery level 100%. But two of them showed for some time Battery level 84%. Why two of them only and why just for some time? Something wrong in new firmware? What do the sensors show you?
-
- Posts: 9
- Joined: Sunday 04 February 2018 13:30
- Target OS: Windows
- Domoticz version:
- Contact:
Re: Xiaomi Aqara Temperature Humidity Sensor
It looks like a deep bug inside Domoticz.
The classic Xiaomi temp/hum sensor reports the following json:
The Aqara temp/hum/pressure sensor reports the following json:
XiaomiGateway.cpp contains the following code:
Note that the battery level may be 255 if it is not set or a value around -10..110
BTW, I don't see a source of the combined Temp/Hum sensor. XiaomiGateway.cpp never called SendTempHumSensor().
All possible 3 sensors (temp, hum and pressure) must have the same battery level.
But temp always has 100%, hum, temp/hum sometimes show the correct level.
I see few bugs:
It looks like BatteryLevel passed to MainWorker::DecodeRXMessage is just lost.
The field RBUF.TEMP.battery_level is declared as BYTE : 4.
I have no idea how -10, 70, 110 or 255 may be correctly converted to 4 bits field.
It looks like this field expexts a value 0..9 which means 10, 20, ..100%.
Then in
So the BatteryLevel is completelly lost at least for temp sensors.
I don't know how to correctly fix this bug. It is too deep and too much devices are affected.
The classic Xiaomi temp/hum sensor reports the following json:
Code: Select all
{"cmd":"read_ack","model":"sensor_ht","sid":"***","short_id":***,"data":"{\"voltage\":2985,\"temperature\":\"2338\",\"humidity\":\"3801\"}"}
Code: Select all
{"cmd":"read_ack","model":"weather.v1","sid":"***","short_id":***,"data":"{\"voltage\":2955,\"temperature\":\"2485\",\"humidity\":\"2896\",\"pressure\":\"100100\"}"}
Code: Select all
std::string voltage = root2["voltage"].asString();
int battery = 255;
if (voltage != "" && voltage != "3600") {
battery = ((atoi(voltage.c_str()) - 2200) / 10);
}
...
if ((name == "Xiaomi Temperature/Humidity") || (name == "Xiaomi Aqara Weather")) {
std::string temperature = root2["temperature"].asString();
std::string humidity = root2["humidity"].asString();
if (temperature != "") {
m_XiaomiGateway->InsertUpdateTemperature(sid.c_str(), "Xiaomi Temperature", temp, battery);
}
if (humidity != "") {
m_XiaomiGateway->InsertUpdateHumidity(sid.c_str(), "Xiaomi Humidity", hum, battery);
}
if (name == "Xiaomi Aqara Weather") {
std::string pressure = root2["pressure"].asString();
m_XiaomiGateway->InsertUpdatePressure(sid.c_str(), "Xiaomi Humidity", pres, battery);
}
}
BTW, I don't see a source of the combined Temp/Hum sensor. XiaomiGateway.cpp never called SendTempHumSensor().
All possible 3 sensors (temp, hum and pressure) must have the same battery level.
But temp always has 100%, hum, temp/hum sometimes show the correct level.
I see few bugs:
Code: Select all
void CDomoticzHardwareBase::SendTempSensor(const int NodeID, const int BatteryLevel, const float temperature, const std::string &defaultname, const int RssiLevel /* =12 */)
{
RBUF tsen;
memset(&tsen, 0, sizeof(RBUF));
tsen.TEMP.packetlength = sizeof(tsen.TEMP) - 1;
tsen.TEMP.packettype = pTypeTEMP;
...
tsen.TEMP.battery_level = BatteryLevel; // !!!
...
sDecodeRXMessage(this, (const unsigned char *)&tsen.TEMP, defaultname.c_str(), BatteryLevel);
}
The field RBUF.TEMP.battery_level is declared as BYTE : 4.
I have no idea how -10, 70, 110 or 255 may be correctly converted to 4 bits field.
It looks like this field expexts a value 0..9 which means 10, 20, ..100%.
Then in
Code: Select all
void MainWorker::decode_Temp(const int HwdID, const _eHardwareTypes HwdType, const tRBUF *pResponse, _tRxMessageProcessingResult & procResult)
{
...
unsigned char BatteryLevel = 0;
if ((pResponse->TEMP.battery_level & 0x0F) == 0)
BatteryLevel = 0;
else
BatteryLevel = 100;
I don't know how to correctly fix this bug. It is too deep and too much devices are affected.
-
- Posts: 9
- Joined: Sunday 04 February 2018 13:30
- Target OS: Windows
- Domoticz version:
- Contact:
Re: Xiaomi Aqara Temperature Humidity Sensor
Can someone of the main developers look at this?
-
- Posts: 9
- Joined: Sunday 04 February 2018 13:30
- Target OS: Windows
- Domoticz version:
- Contact:
Re: Xiaomi Aqara Temperature Humidity Sensor
I see some serious bugs in the base classes of Domoticz.
Who is the right person to contact about it?
Endless discussions among users do not solve anything.
Where are the developers?
I can make minor fixes, but I will not edit the base classes.
Who is the right person to contact about it?
Endless discussions among users do not solve anything.
Where are the developers?
I can make minor fixes, but I will not edit the base classes.
-
- Posts: 67
- Joined: Saturday 17 June 2017 12:30
- Target OS: Raspberry Pi / ODroid
- Domoticz version: beta
- Contact:
Re: Xiaomi Aqara Temperature Humidity Sensor
Hi,
@slydiman did you try to reach out to gizmocuz, he might be able to point you in the right direction.
So if I got I correct the voltage levels for the temp/humid sensor is not propagated through to domoticz? I have voltage devices for all the Xiaomi door sensors but not for the several temp/humid sensors I am using. Would like to have them.
Any advice
@slydiman did you try to reach out to gizmocuz, he might be able to point you in the right direction.
So if I got I correct the voltage levels for the temp/humid sensor is not propagated through to domoticz? I have voltage devices for all the Xiaomi door sensors but not for the several temp/humid sensors I am using. Would like to have them.
Any advice
-
- Posts: 67
- Joined: Saturday 17 June 2017 12:30
- Target OS: Raspberry Pi / ODroid
- Domoticz version: beta
- Contact:
Re: Xiaomi Aqara Temperature Humidity Sensor
Any information / update on this as I don't have any temperature/humid sensor that is reporting a battery level. All other Xiaomi devices do report the battery level.
-
- Posts: 9
- Joined: Sunday 04 February 2018 13:30
- Target OS: Windows
- Domoticz version:
- Contact:
Re: Xiaomi Aqara Temperature Humidity Sensor
I did not contact gizmocuz.
Domoticz is no longer interesting to me, at least for now, while Xiaomi Android app works well enough.
Domoticz is very draft, buggy and unstable. The code is very confusing.
Domoticz cameras do not support RTSP. Cameras do not work (do not refresh) in Domoticz Android app at all.
I have the long list of problems with Xiaomi devices...
But I don't see a reason to post it because I don't see any updates around bugs in the fundamental code.
@snuiter, feel free to contact gizmocuz or anyone who can fix the issue which I described above.
Domoticz is no longer interesting to me, at least for now, while Xiaomi Android app works well enough.
Domoticz is very draft, buggy and unstable. The code is very confusing.
Domoticz cameras do not support RTSP. Cameras do not work (do not refresh) in Domoticz Android app at all.
I have the long list of problems with Xiaomi devices...
But I don't see a reason to post it because I don't see any updates around bugs in the fundamental code.
@snuiter, feel free to contact gizmocuz or anyone who can fix the issue which I described above.
- LouiS22
- Posts: 433
- Joined: Friday 27 February 2015 13:21
- Target OS: Raspberry Pi / ODroid
- Domoticz version: beta
- Location: Budapest, Hungary
- Contact:
Re: Xiaomi Aqara Temperature Humidity Sensor
and that was a very, very rude comment. Why not contribute and solve those problems?slydiman wrote: ↑Saturday 24 March 2018 18:00 I did not contact gizmocuz.
Domoticz is no longer interesting to me, at least for now, while Xiaomi Android app works well enough.
Domoticz is very draft, buggy and unstable. The code is very confusing.
Domoticz cameras do not support RTSP. Cameras do not work (do not refresh) in Domoticz Android app at all.
I have the long list of problems with Xiaomi devices...
But I don't see a reason to post it because I don't see any updates around bugs in the fundamental code.
@snuiter, feel free to contact gizmocuz or anyone who can fix the issue which I described above.
-
- Posts: 9
- Joined: Sunday 04 February 2018 13:30
- Target OS: Windows
- Domoticz version:
- Contact:
Re: Xiaomi Aqara Temperature Humidity Sensor
Note I have dropped my own home automation system SlyControl in 2005 http://slydiman.me/sce/plugins.htm
I have enough expireence developing software for various hardware.
I prefer to have a clean base code. Solve these problems means a lot of workarounds with a buggy core. It is a wrong way.
I have enough expireence developing software for various hardware.
I prefer to have a clean base code. Solve these problems means a lot of workarounds with a buggy core. It is a wrong way.
-
- Posts: 184
- Joined: Wednesday 06 September 2017 9:11
- Target OS: Linux
- Domoticz version:
- Contact:
Re: Xiaomi Aqara Temperature Humidity Sensor
Hi!
I have also the Xiaomi Aqara Temperature Humidity Sensor since a few days. I added this to domoticz. Temp and hum are fine but it also shows the pressure. Strange thing it will be added to the utility tab and not in the weather tab.
The other thing is you cant adjust the sensor. It shows 1003 hpa but at our level its now 1012 hpa. Is there a way to adjust this like the temperature or humidity ?
I have also the Xiaomi Aqara Temperature Humidity Sensor since a few days. I added this to domoticz. Temp and hum are fine but it also shows the pressure. Strange thing it will be added to the utility tab and not in the weather tab.
The other thing is you cant adjust the sensor. It shows 1003 hpa but at our level its now 1012 hpa. Is there a way to adjust this like the temperature or humidity ?
-
- Posts: 16
- Joined: Tuesday 26 January 2016 14:00
- Target OS: Raspberry Pi / ODroid
- Domoticz version: Latest
- Location: Gorinchem - Netherlands
- Contact:
Re: Xiaomi Aqara Temperature Humidity Sensor
Same here, but I'm more confused that it show's 1003 Bar instead of 1003 mBar.
- sincze
- Posts: 1299
- Joined: Monday 02 June 2014 22:46
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2024.4
- Location: Netherlands / Breda Area
- Contact:
Re: Xiaomi Aqara Temperature Humidity Sensor
Anyone that can confirm this is now working correctly on current beta ???
Domoticz 2020.2 (build 12872)
Domoticz 2020.2 (build 12872)
Pass2php
LAN: RFLink, P1, OTGW, MySensors
USB: RFXCom, ZWave, Sonoff 3
MQTT: ZIgbee2MQTT,
ZWAVE: Zwave-JS-UI
WIFI: Mi-light, Tasmota, Xiaomi Shelly
Solar: Omnik, PVOutput
Video: Kodi, Harmony HUB, Chromecast
Sensors: You name it I got 1.
LAN: RFLink, P1, OTGW, MySensors
USB: RFXCom, ZWave, Sonoff 3
MQTT: ZIgbee2MQTT,
ZWAVE: Zwave-JS-UI
WIFI: Mi-light, Tasmota, Xiaomi Shelly
Solar: Omnik, PVOutput
Video: Kodi, Harmony HUB, Chromecast
Sensors: You name it I got 1.
Who is online
Users browsing this forum: No registered users and 0 guests