[Deprecated] Xiaomi / Aqara / Opple Drivers with Presence!

Hi @markus

It seems on the hourly checkin event, xiaomi devices actually report temperature/humidity (and pressure if it is aqara) in addition to battery. Is it possible to send those events
(in many rooms, the temperature barely changes so it seems it never have a temperature event, but with this change, it can get at least 1 event per hour)



2020-08-10 03:49:07.491 pm [info]KNOWN event (Xiaomi/Aqara specific data structure with battery data - 42 - hourly checkin) - description:read attr - raw: 59F80100005201FF42250121770B0421A81305211000062401000300006429CB0B6521C612662B358701000A210000, dni: 59F8, endpoint: 01, cluster: 0000, size: 52, attrId: FF01, encoding: 42, command: 0A, value: 250121770B0421A81305211000062401000300006429CB0B6521C612662B358701000A210000 | parseMap:[raw:59F80100005201FF42250121770B0421A81305211000062401000300006429CB0B6521C612662B358701000A210000, dni:59F8, endpoint:01, cluster:0000, size:52, attrId:FF01, encoding:41, command:0A, value:[raw:[battery:0B77, unknown1:13A8, RSSI_dB:0010, LQI:0000030001, temperature:0BCB, humidity:12C6, pressure:00018735, routerid:0000], battery:2935, unknown1:5032, RSSI_dB:16, LQI:196609, temperature:3019, humidity:4806, pressure:100149, routerid:0], clusterInt:0, attrInt:65281]`

Just poked my head back in to the thread to thank you again for the steady updates and the solid drivers, I've no idea how you find the time to maintain these and be so active and helpful on the forums.

After checking my logs it seems I switched to your drivers in May, all of my devices are currently at 100% uptime - no drop off or instability at all. The only issue was user error when configuring the lux sensor Very, very impressive. Thank you!


Yes, sure, but if there was no change then why would you need extra events? If there is a change it will be reported. Just want to understand the use-case here, it would not be hard to add as an optional, but every optional is another Preference for the user to understand.

Always happy to hear from users of my drivers :slight_smile: Mostly I have the time since most things have been automated in my build-process and effective time-management would be the other main reason. Besides that I probably just spend WAY more time than is healthy in front of the computer doing work anyway, so doing these things are like mini-breaks :slight_smile:

You must also have a good mesh then :slight_smile: My drivers can't magically make the devices stable all on their own, unfortunately...


xiaomi devices only send event when temperature changes by 0.5C and humidity by 5%.
for rooms that the temperature does not change much, while humidity changes slowly, it will take forever to trigger the automation. for example, if I set a trigger at 60% humidity,
but the last reading is 59.5%, the next event will be 64.5%, that means, I could have waited 3 hours for the humidity to reach 64.5% to trigger the event. but in reality, in the hourly checkin, it could have reported 60% much sooner.
agree that we don't need to report any event below the change threshold (1%), but if it is more than the threshold, it would be better to have it (not going to flood the hub, since it happens hourly).

1 Like

I will implement this and not let it be optional, there's already a threshold check so that is fine. The user-scenario makes sense :slight_smile:

@Chen555 The Beta driver has been updated with the suggested change, the code is untested, but should work... Please try it and report back.

@markus thanks so much for the quick response.

everything look perfect so far, except this one, (unit is wrong by 100)
2020-08-11 10:03:50.159 am [info]Sending pressure event (Pressure: 10020.60, old pressure: 100.10, change: 9920.50)

1 Like

Exactly which model is it that you are using?

this is from aqara model, that has the pressure sensor. original xiaomi does not have it.

Ok, there is also the Keen sensor that has it. That is why I asked. The code has been updated to compensate for this.

Wow, i was away for a few months, i see Markus has taken over the world!!
Nice work @markus!

Glad to see the decimals option made it, i modified the driver to only show 1 decimal.

Done updating all the drivers.
Have a big list of "markusl" drivers now...


The Beta drivers have been updated so that they disable the Recovery feature when on platform version 2.2.3. The Release version will have that update in a few more minutes. There's 18 drivers affected.

First reported here:

EDIT: All drivers have been updated in both Beta and Release

1 Like

What does this mean going forward? No notification when these items drop off the mesh? Or is this a temporary workaround until it can be re-coded?

You will get notifications that they drop, the driver just won't be doing as much to try to bring them back.

For now I don't know how hard that limit is that they have imposed, to do what is needed a message need to go out with a rather high frequency, if they have blocked that and won't fix it in the platform I'm not sure functionality can be restored. So far I've just woken up about 1 hour ago, seen this and made an emergency patch of the 18 affected drivers. I will try to talk with Hubitat about this later when I have time, I've also seen it affect other drivers already, so I'm sure we'll know more in a few days.


I think I will hold on upgrading my Hubitat platform... hopefully, this can be resolved soon! I will keep an eye on the number of reconnections per devices... this automatic reconnection is an awesome feature, and I really hope it can be enabled again!

Hey @markus, today I've received my HE and I am trying to add my devices to it. I started with the ones that are not currently paired with any hub and I've successfully added my sonoff sensors. After that I've started with the xiaomi stuff and everything was going great, until I hit an issue with the vibration sensor and the xiaomi button I have. They get to the stage in which the HE finds them, but they stay in the initializing phase: https://i.imgur.com/TcApMB0.png

Do you have any idea what might be causing the issue? I'm using the latest HE drivers. Here are the logs from the hub: https://i.imgur.com/SHVhdRl.png.

Edit: I've successfully added an aqara motion sensor and xiaomi luminance sensor.

Some xiaomi devices need to be woke up while pairing to complete correctly as it goes to sleep to fast. Try resetting the device and while pairing press the reset button ONCE every few seconds until the pairing completes.

When the pairing is completed you will see 3 blue flashes after you press the reset button 1 time. If you only see 1 blue flash after you press the reset button that means its not paired yet.

1 Like

I thought I would post my RM for Xiaomi presence checking. It checks every 30 minutes and if presence is not present it alerts me.


I use the notifications app for my tasmota lights but same use case.
I went with this as it is easier to set up and add the restriction I need.


Adding to what @Evilborg already mentions regarding the pairing would be to pair it closer to the hub to, mostly, rule out mesh issue. If that works, you can then wait for your mesh to settle (you mention you got your HE today). If you power it down for 30 minutes that should speed up the process, but it can take 24-48 hours before a new mesh settles on routes. How many repeaters and of what kind do you have in your mesh?