[Deprecated] Xiaomi / Aqara ZigBee device drivers (possibly may no longer be maintained)

This is freaking awesome. Thanks @veeceeoh and to @guyeeba.
Xiaomi needs to put you guys on the payroll or at least get you some free chinese food

Ha ha ha, free Chinese food. Love that idea.

Not a good idea ight now :sweat_smile:

1 Like

Oh yeah, good point. Definitely avoid the bat soup. It's a sad and quite scary situation right now :cry: Hope the authorities can get it under control soon.

[UPDATE] v1.0.1 of Xiaomi/Aqara Temperature Humidity Sensor device driver for Hubitat

User @pat.molloy noticed that pressure events were not being posted correctly, and after checking into it, I discovered that my change to the driver to use the attribute pressureMeasurement based on the Hub version 1.1.0 changes for developers announcement was in error.

Based on Hubitat's Driver Capability List - Hubitat Documentation the correct attribute to use is just pressure, as it was in the driver previously.

So I have changed it back, and everything is working as it should.

The updated driver code can be grabbed from here, or if you are currently using v0.9 or v1.0 of the driver, you are welcome to take advantage of Hubitat's semi-automated Import Code from Website feature to skip the manual copy and paste procedure.

changelist

  • Fixed issue with pressure measurement events not working correctly by reverting back to attribute pressure
5 Likes

Is there anyone who has an Aqara Smart Wireless Curtain Motor model ZNCLDJ12LM (the one with battery) who could help me test the driver I'm writing? I'd like to finish it up and clean up the code, but without testing on that model as well, I can't be sure things work as expected. If you do have one and want to test, there's information in my thread about what needs to be tested for now. There will be follow-up testing needed as well since I don't have this particular model and it doesn't accept the same commands as the one I have.

Hi,
Motion sensor seems to be working great, however it does not show (at all) in the zigbee routing table at http://192.168.1.x/hub/zigbee/getChildAndRouteInfo all the other devices are there except of this motion sensor... any reason for this?

I'm just posting this for information.
I have a Mi Home hub and I have an Aqara light switch in a cupboard with a door contact sensor.
Both are connected directly to the Mi Home hub and using the automation that are native to this hub.
Usually the light comes on as soon as the contact sensor changes to open.
Very occasionally it can take over a second.
I believe this is because the sensor has to wake up. Not sure though.
The reason for posting this information is we usually blame our zigbee network when this happens. I believe this is not always the case.

Does your MI Home Hub connect to HE directly? Are you using Mi Home App to connect devices to Mi Home Hub? please elaborate it..

In this case these 2 devices are paired to the MI Home hub and this is what is controlling turning the lights on and off. (Using automations in the Mi Home app).

As an aside, I have connected the Mi Home hub to HE using an RPi.
So all my Xiaomi/Aqara devices are paired to the Mi Home hub, which are then ported through to my HE hub via an RPi. I then control/use the Xiaomi/Aqara devices through rules on my HE hub. Works very well with no drop offs of the devices. I used to get them falling off occasionally when paired directly to HE.

The 2 devices mentioned above are NOT ported through to HE and are working exclusively on the Mi Home hub. I just thought I would mention that the contact sensor does go to sleep sometimes and it is not always a flakey zigbee network that is causing issues with these devices.

Hi, out of curiosity, you running HomeBridge on RPi?

No. This is how I'm doing it.
Does work well.
Courtesy of @Royski

2 Likes

The getChildAndRouteInfo feature does not always show all devices connected to the hub's ZigBee mesh network. This has been mentioned elsewhere in the forums (here, here, and here, for example).

The best way to view all devices and the routing of the ZigBee mesh network is with an XBee device.

4 Likes

@veeceeoh
Hi Keith,
So I have 5 Xiaomi Temp/Humidity sensors and I have never really used them for automation just reference. However, I started to utilize their temp, and humidity in a custom application to control my aprilaire humidifier.

I have noticed for a long time that my furnace humidity is way different from my smart sensor humidities (Xiaomi and Zooz 4in1). But I always thought my furnace was wrong because the other sensors were all "close" to each other.

As you can see the sensors are all close but far away from the furnace.

I have had some issues with some moisture on my windows so I thought again the furnace was wrong.

So as I started to use the average of my smart sensors to control my humidity, I am noticing that the humidity is way to low now and my guitars are starting to get buzzy bridges.

So I did some more research and started to wonder if the smart sensors are not reporting Relative Humidity and instead Specific Humidity. Even though all documentation says Relative Humidity.

I found some formulas that convert from Specific Humidity to Relative humidity using Temp, Pressure, and Specific Humidity, the result is something remarkably close to my furnace...

From My Log:

app:8832020-02-10 08:31:01.151 pm debugAverage Outdoor Humidity: 79

app:8832020-02-10 08:31:01.133 pm debugAverage Outdoor Temp: 23

app:8832020-02-10 08:31:01.126 pm debugAverage Indoor Pressure: 29.03

app:8832020-02-10 08:31:01.104 pm debugAverage Indoor Humidity: 39.7777777778

app:8832020-02-10 08:31:01.062 pm debugAverage Indoor Temp: 68.1433333333

Using the above data and putting it into the formula I found I get a Relative Humidity of 21.55. My Furnace reports 21.

So I am not sure what to make of this but it all seems very interesting...

2 Likes

This might be the case. I do notice in the Aqara Home app that the sensors will show offline when they have not been triggered for a while. Once they are triggered, they show online again (if I also unblock the hub internet access too :stuck_out_tongue_winking_eye:). However, I have not noticed a delayed response with the Aqara hub. Maybe this is a Mijia hub thing? :man_shrugging:

Good observation though. I will keep a closer eye on my sensors and their reaction time. From what I have seen and experienced in HomeKit though, they are near instant, regardless of the sensor brand (Aqara or Mijia) or how long they have been "sleeping".

Just as a data point, here is what my thermostat says both on the display and in Hubitat. It is a Honeywell Prestige IAQ, so pretty top of the line. relativeHumidity : 50

My Aqara says humidity : 49.5 Most of the other sensors in the house read in the low 50s on the same floor as the thermostat.

21% humidity would be absurdly low, I don't know how you would get there unless you have massive air leaks in your house or something.

Also took a look at immune. I have an ecobee where the humidity Sensor is on the main floor (top reading).

The xiaomi sensors are scattered through the house mainly upstairs and in the basement.

They are all close. I use them in automations for my bathroom fans.

Tempted...

https://www.amazon.com/Boveda-One-Step-Hygrometer-Calibration-Kit/dp/B000A3UBLA/ref=lp_13825071_1_8?s=lawn-garden&ie=UTF8&qid=1581399630&sr=1-8&th=1

2 Likes

That is tempting...

Throw the sensors in and adjust.

What if the bag is not calibrated correctly and there is an 'R' in the month?
:smile::joy::thinking::wink:

2 Likes