Original Xiaomi Aqara Smart Wireless Switch (Aqara Button) [Beta]

I have modified the DTH from a4refillpad to make a DTH that is compatible with the Aqara buttons.

This DTH is available at

This DTH only.supports the button push function, the button held function is not supported by this device.


The button supported by this DTH looks like the following:
Button

Version History:

  • Ver 1.0 - 7-19-2017
    *Converted to support button presses with the square chassis “Xiaomi Zigbee Aqara Button Aq2” WXKG11LM
  • Ver 1.1 - 7-19-2017
    *Changed the Fingerprint for the “Xiaomi Zigbee Button Aq2” so it will be detected and get this DTH during pairing
    *Added button and app press logging
  • Ver 1.2 - 7-28-2017
    *Removed the Holdable Button attribute and configuration settings until I have time to find a way to make the Aqara button holdable
    *Removed the configuration tile
    *Removed the battery tile, and Battery attribute and set the battery to report 100% since the Aqara button didn’t appear to report battery level
  • Ver 1.3 - 9-8-2017
    *Thanks to ozjames of the ST community the battery functions seem to be working
16 Likes

How do we use this DH? The only thing that happens for me is that it updates each time I press the button. And adds a checking in the history tab.

Do you have the button pictured? If so once you have the DTH in your IDE you pair the button and when you press the button you should see a log that says the button was pushed. At that point you just use whichever smartapp you want to assign the button press an action.

Pictured? I’ve added it with catchall.


Byt i only get as the picture when clicking on it

Try removing the button then go into pairing mode and hold the small pairing switch on the button for 5 seconds, the light will flash multiple times then wait a minute for it to show up as a new device and make sure it comes in as “Xiaomi Zigbee Button AQ2” if it comes in as “Thing” then it isn’t the square bodied Aqara button in the picture above.

It’s not that one. It’s the newer one with two buttons

Does this DTH report battery, and if so, is it accurate? I know most modified Xiaomi DTH have problems with the Aqara battery readings and manually set them to 100. Accurate battery reporting is only thing holding be back from purchasing some.

No battery reporting has been disabled in this DTH because that device doesn’t expose the battery level, not many ST compatible remotes do for some reason.

Sorry each device has a unique DTH and this one only supports the single button square remote switch not the wall switches. This is the only Xiaomi product I have at the moment so I haven’t looked at any of the other DTHs

Hi Terk,

I have tried a few things to get the battery information for my Aqara buttion.
At least, my Aqara button is showing 90% battery now, but can’t prove if it’s correct information. :slight_smile:

Anyway, this is what I have done…

  1. Uncomment below…

    valueTile("battery", "device.battery", decoration: "flat", inactiveLabel: false, width: 2, height: 2) {
		state "battery", label:'${currentValue}% battery', unit:""
	}

  1. Use cluster.data.get(6) instead of cluster.data.last().

	switch(cluster.clusterId) {
		case 0x0000:
		resultMap = getBatteryResult(cluster.data.get(6))
		break

Hope this can help.

@ozjames I created a test DTH with these changes and tried it on three remotes I purchased a few months ago, two show 100% and one shows 3%, With the original settings I saw this kind of discrepancy also but they never changed. I’ll leave them with this setting, if I see them change I’ll update you and the DTH (giving you credit). Thanks.

The button that was showing 3% sometimes switches back and forth between 3% and 100% so this doesn’t appear to work for the battery level.

@Terk Just sent message to you. Please refer to the code in the message.

That code didn’t survive the message system well however after cleaning up the single and double quotes I got the code installed and I’m testing now, I’m not sure yet what is different from when I tested previously but so far it is looking much more promising. I’ll monitor and report back, thanks.

Thanks @Terk you just saved me from madness :smiley:

I finally have the my Xiaomi buttons working

Sorry for the really noob question, but this appears to only have one physical button…is it possible to assign different actions to a long hold vs short press, double press, etc…and if so, would that require a dedicated smartapp to do so?

No, the original button sent an On when pressed and off when let go or maybe the other way around so in the DTH for that they where able to test how long it was held and give you a press and hold function. This Aqara button only sends on when pressed but doesn’t send anything when released so there is no way to tell how long it is held so only press is supported.

1 Like

Thanks for clarifying. Is the original still available do you know? (I’ll be searching right after this)

What use cases do ppl have here for a button like this aqara then?

The original is still available I think, check gearbest.com. I use the Aqara buttons for a light toggle and one to turn on an outlet that controls my curtains which is set to automatically turn off again after 10 seconds which resets the curtain controller to go the other way when it is turned back on.

1 Like