[Release] Xiaomi / Aqara device drivers

community_driver

#423

I fixed the Aqara temp/humidity sensor driver for 2.0.5 if anyone is interested. It is 99.5% @veeceeoh code, and 0.5% code I acquired from elsewhere ( :smile: ). So it isn't anything magical that I did - simply borrowed from everyone else (as usual).

I tested it against the Aqara (aka the "new") temp/humidity sensors. I don't have any of the "original" Xiaomi ones, so can't promise it works on those (but it definitely should).

EDIT: Oh, and DO NOT use this driver in 2.0.4 or earlier, as I didn't put any smarts in it to look at the hub version and do it the old way if on a version <2.0.5.

I don't have any of the other Xiaomi devices, so I don't have any plans on updating/trying to fix those drivers - so don't ask :wink: . I'm sure @veeceeoh will release official versions of his drivers as soon as he can get to it.


#424

@JasonJoel
I just updated the driver of my ONLY Xiaomi Temp device, which is one of the original circular units and it is once again reporting correct temps and humidity. It did take approx. 10 minutes for the correct temps to be reported as can be seen in the logs.

Thanks heaps.


#425

For some unknown reason, went away for the weekend, Oh and I have not updated to the latest version, my single button Xiaomi wireless switches now only show the button as held, not pushed or double tapped.


#426

Are you saying you don't know why you went away for the weekend???? :wink:
Your getting like me!!!! :smile:


#427

It was a great weekend though! That's why I am a bit confused, the brain cells are feeling a bit tired :slight_smile: at first when the switches weren't working I thought they had all dropped off but then found they were only registering 'held' rather than pushed, they do his for pushed, double tapped and would you believe it held. God knows what's happened, I will look a bit deeper tomorrow when the alcohol has worn off :slight_smile:


#428

So it looks like the value has changed for some reason, the logs show, from top, pushed then double tapped and then held with values of 0100, 0200 and 0000 so this then is seen as any type of press as 'Held'

2019-02-11 04:29:58.821 pm debugXiaomi Aqara Wireless Smart Light Switch: Creating event [name:held, value:1, isStateChange:true, descriptionText:Button was held]

dev:8182019-02-11 04:29:58.805 pm debugXiaomi Aqara Wireless Smart Light Switch: Setting buttonHeldEpoch and buttonHeldTime to current date/time

dev:8182019-02-11 04:29:58.803 pm infoXiaomi Aqara Wireless Smart Light Switch: Button was held

dev:8182019-02-11 04:29:58.801 pm debugXiaomi Aqara Wireless Smart Light Switch: Parsing message: read attr - raw: D7B50100120A5500210100, dni: D7B5, endpoint: 01, cluster: 0012, size: 0A, attrId: 0055, encoding: 21, command: 0A, value: 0100

dev:8182019-02-11 04:29:57.402 pm debugXiaomi Aqara Wireless Smart Light Switch: Creating event [name:held, value:1, isStateChange:true, descriptionText:Button was held]

dev:8182019-02-11 04:29:57.394 pm debugXiaomi Aqara Wireless Smart Light Switch: Setting buttonHeldEpoch and buttonHeldTime to current date/time

dev:8182019-02-11 04:29:57.392 pm infoXiaomi Aqara Wireless Smart Light Switch: Button was held

dev:8182019-02-11 04:29:57.389 pm debugXiaomi Aqara Wireless Smart Light Switch: Parsing message: read attr - raw: D7B50100120A5500210200, dni: D7B5, endpoint: 01, cluster: 0012, size: 0A, attrId: 0055, encoding: 21, command: 0A, value: 0200

dev:8182019-02-11 04:29:54.982 pm debugXiaomi Aqara Wireless Smart Light Switch: Creating event [name:held, value:1, isStateChange:true, descriptionText:Button was held]

dev:8182019-02-11 04:29:54.978 pm debugXiaomi Aqara Wireless Smart Light Switch: Setting buttonHeldEpoch and buttonHeldTime to current date/time

dev:8182019-02-11 04:29:54.970 pm infoXiaomi Aqara Wireless Smart Light Switch: Button was held

dev:8182019-02-11 04:29:54.967 pm debugXiaomi Aqara Wireless Smart Light Switch: Parsing message: read attr - raw: D7B50100120A5500210000, dni: D7B5, endpoint: 01, cluster: 0012, size: 0A, attrId: 0055, encoding: 21, command: 0A, value: 0000


#429

Sorry must have upgraded to 2.05 and forgotten, possibly loking forward to the weekend a bit too much, so deffinately broken on 2.05 if you revert back to 2.04 all works again and the logs show as below.

(So reverted back to 2.04.117 so it looks like it got broke in 2.04.118 and now get the correct values.. Again from top to bottom, push, double tap and held.)

2019-02-11 05:29:26.037 pm debugXiaomi Aqara Wireless Smart Light Switch: Creating event [name:pushed, value:1, isStateChange:true, descriptionText:Button was pressed]

dev:8182019-02-11 05:29:26.019 pm debugXiaomi Aqara Wireless Smart Light Switch: Setting buttonPressed & buttonPressedTime to current date/time for webCoRE/dashboard use

dev:8182019-02-11 05:29:26.000 pm infoXiaomi Aqara Wireless Smart Light Switch: Button was pressed

dev:8182019-02-11 05:29:25.996 pm debugXiaomi Aqara Wireless Smart Light Switch: Parsing message: read attr - raw: D7B50100120A5500210100, dni: D7B5, endpoint: 01, cluster: 0012, size: 0A, attrId: 0055, encoding: 21, value: 0001

dev:8182019-02-11 05:29:24.122 pm debugXiaomi Aqara Wireless Smart Light Switch: Creating event [name:doubleTapped, value:1, isStateChange:true, descriptionText:Button was double-tapped]

dev:8182019-02-11 05:29:24.090 pm debugXiaomi Aqara Wireless Smart Light Switch: Setting buttonDoubleTapped & buttonDoubleTappedTime to current date/time for webCoRE/dashboard use

dev:8182019-02-11 05:29:24.086 pm infoXiaomi Aqara Wireless Smart Light Switch: Button was double-tapped

dev:8182019-02-11 05:29:24.082 pm debugXiaomi Aqara Wireless Smart Light Switch: Parsing message: read attr - raw: D7B50100120A5500210200, dni: D7B5, endpoint: 01, cluster: 0012, size: 0A, attrId: 0055, encoding: 21, value: 0002

dev:8182019-02-11 05:29:21.652 pm debugXiaomi Aqara Wireless Smart Light Switch: Creating event [name:held, value:1, isStateChange:true, descriptionText:Button was held]

dev:8182019-02-11 05:29:21.588 pm debugXiaomi Aqara Wireless Smart Light Switch: Setting buttonHeld & buttonHeldTime to current date/time for webCoRE/dashboard use

dev:8182019-02-11 05:29:21.560 pm infoXiaomi Aqara Wireless Smart Light Switch: Button was held

dev:8182019-02-11 05:29:21.555 pm debugXiaomi Aqara Wireless Smart Light Switch: Parsing message: read attr - raw: D7B50100120A5500210000, dni: D7B5, endpoint: 01, cluster: 0012, size: 0A, attrId: 0055, encoding: 21, value: 0000

So it looks like there is an extra in the report of Command:0A


#430

Hi all - I just wanted to give a quick update:

I am back from my trip and have been working on updates to all of the Xiaomi / Aqara device drivers that I maintain.

It is proving to be more difficult than anticipated. As of now, I've employed a "quick and simple" fix that works for everything except battery voltage reports.

I am in contact with Hubitat to confirm the behavior I'm seeing, which if true just means the drivers need to handle battery voltage reports differently.

I hope to be able to announce the updates with links to the new device driver code in the next couple of days.

Thanks again for your patience.



Yes, what you're seeing is the effect of the change in 2.0.5 on my device drivers that use non-standard methods to deal with the often non-standard Zigbee messages sent by Xiaomi / Aqara devices.

Trust me, I'm working on it, as mentioned above.


#431

Keith, my Aqara drivers are mostly based on your DTHs, and I managed to get them working with full functionality, even though in some cases I don't like the solutions I had to use.

They're available here, check them out, maybe you'll find something useful...

And for anyone who has issues: feel free to use my drivers as long as @veeceeoh provides a full solution (I don't recommend using my drivers in the long term, as I can't promise they'll be as well-maintained as @veeceeoh's stuff are)


#432

Thank you for all of your time and hard work that you have put in to maintain these drivers.


#433

I just wanted to thank @veeceeoh as well for the time and effort. I gave my wife a pink Mi Cube for her area and it skyrocketed my WAF. She shows everyone. It's always the little things. Couldn't have done it without your work and of course @bspranger. Thanks fellas.


#434

Is there some sort of trick with these that I'm missing? I installed the driver and then paired two Aqara motion sensors. I had no problem pairing them, but they only show batteryLastReplaced in the status section, and aren't detecting motion. I repaired the zigbee on one, and it connected right away, but still looks the same on the device page.


#435

Not sure what firmware you are on, but if you've updated to the latest firmware in the last week, there is an issue with Xiaomi sensors. Just read up a few posts. It should be rectified in the coming days. Or you could downgrade to an older firmware.


#436

[UPDATE] All Xiaomi & Aqara Hubitat Device Drivers

Compatibility fix for Hubitat Hub firmware 2.0.5 or newer

Only two changes have been made to the below linked drivers:

  • All functionality is restored when the driver is used with Hubitat firmware 2.0.5 or newer
  • For users with a hub running firmware 2.0.4 or earlier, a preference setting has been added, allowing the user to disable the compatibility fix (see screenshot below)

Links to my updated Xiaomi & Aqara Device Drivers:

  • Aqara Button (WXKG11LM / WXKG12LM) v0.6.5
  • Aqara Leak Sensor (SJCGQ11LM) v0.8
  • Aqara Motion Sensor (RTCGQ11LM) v0.7.2
  • Aqara Vibration Sensor (DJT11LM) v0.7.3b
  • Aqara Wireless Smart Light Switch - 1 button (WXKG03LM) / 2 button (WXKG02LM) v0.7.5b
  • Xiaomi/Aqara Door-Window Sensor (MCCGQ01LM / MCCGQ11LM) v0.7.2
  • Xiaomi/Aqara Temperature Humidity Sensor (RTCGQ01LM / WSDCGQ11LM) v0.8.1
  • Xiaomi Button (WXKG01LM) v0.8.5
  • Xiaomi Mi Cube Controller (MFKZQ01LM) v0.2.1b
  • Xiaomi MiJia Honeywell Smoke Detector (JTYJ-GD-01LM/BW) v0.5.1
  • Xiaomi Motion Sensor (RTCGQ01LM) v0.7.1

Links to updated Xiaomi & Aqara Device Drivers by @guyeeba:

  • Aqara Wired Wall Switch (no neutral) - 1 button (QBKG04LM) / 2 button (QBKG03LM) driver
  • Aqara Wired Wall Switch (with neutral) - 1 button (QBKG11LM) / 2 button (QBKG12LM) driver
  • Aqara Wireless Smart Light Switch - 1 button (WXKG03LM) / 2 button (WXKG02LM) driver
  • Xiaomi/Aqara Door-Window Sensor (MCCGQ01LM / MCCGQ11LM) driver

Many thanks to @mike.maxwell for the suggested code to make the drivers compatible.

At this point, I plan to return to updating and improving each of the drivers on an individual basis (which is a lot more sane given my limited time resources!)

Detailed Notes

  • All this update does is accommodate a change in the way certain kinds of "raw" ZigBee message data is passed on to device handlers. Specifically, the order of bytes of payload data with little-endian data types is reversed, to avoid issues with variable length payload data.
    Most ZigBee device drivers aren't affected because they make use of "helpers" that parse the data and "un-reverse" the byte order of payload data where needed. But many Xiaomi / Aqara devices send messages with data in a non-standard format, so use of the "helpers" doesn't make much sense or simply isn't possible.
    The fix in my updated drivers un-reverses the byte order of payload data where needed, and otherwise all other aspects of the code remains unchanged. I plan to look at switching to the use of helper methods where applicable, on a case by case basis.

  • If debug message logging is enabled, a log message is displayed whenever it has been determined that the byte order of payload data needs to be "un-reversed".

  • IMPORTANT: If you are using any firmware version prior to 2.0.5 with these updated device drivers, then make sure to turn on the preference setting to DISABLE the 2.0.5 firmware compatibility fix for every Xiaomi / Aqara device:


#437

Thanks for all that you do for us with xiaomi.

Silly question, updating drivers in HE, is it as simple as pasting the new code over the old code and saving?


#438

Yes, or copy the link, go to the driver, click import, paste the link, import, save. It's default is for 2.0.5, so I did this first then updated the hub from 2.0.4 to 2.0.5.


#439

Thanks, the import feature is nice.


#440

The import works, just make sure when importing the link goes to the raw code, the links in this thread are all directly to the raw code so no problems, but just saying in case you try with other community's drivers.


#441

Thank you; very nice touch adding the compatibility select switch to allow use with 2.04 f/w. I always prefer changing just one thing at a time.


#442

[UPDATE] v0.7b of Aqara Wireless Smart Light Switch Device Driver

The new beta device driver code can be grabbed from here.

EDIT: Some errors were discovered, and I have re-released the updated driver. Please see this post for details.