[OBSOLETE] Original & Aqara Xiaomi Zigbee Sensors (contact, temp, motion, button, outlet, leak, etc)

I’m sorry to say that both battery-powered wall surface-mounted Aqara Wireless Smart Switch models (1-button model WXKG03LM and 2-button model WXKG02LM) do not support the hold function in hardware. They only send one message when a button is pressed.

I have no experience with the in-wall mains-powered versions of the Aqara Wireless Smart Switches (models QBKG11LM & QBKG12LM) because they require 250V and I am in the US, but according to this website they also only support single (toggle) button press with no hold function.

The only Xiaomi buttons that support a button hold function are the round “original” Xiaomi Button (model WXKG01LM) and the new version of the square-shaped Xiaomi Aqara Button (model WXKG12LM).

I have ordered a couple of the new Aqara Button model WXKG12LM and will adapt the new round Xiaomi Button DTH I’ve been working on to work with it. The Aqara WXKG12LM hardware sends messages for press, release, hold, double-click, and also SHAKE!


Not quite sure what happend but one of the 4 open-close sensors was in unknown state. Tried to pair it again but now it seems to be “unknows” in devicelist. I had additional new sensor and tried to pair it and it does same thing. I have two things in my devicelist and both of them are “unknown”. Three open/close sensors are working normally. Any ideas. Pairing worked just like it is supposed to work. Blue light flashes three times and sensor is found but it’s unknown.

Ok now it they both works. Problem was that I had to change device type manually. For some reason they were Samsung 2015 TV’s… changed them to Xiaomi Awara and that helped. Weird thing.

Thank you for at clear answer @veeceeoh though it’s bad news… :disappointed_relieved:

Just to try and learn a bit - still new to ST:

  1. So the “Xaiomi button was released” message i see in the Activity feed is generated from the DH?
  2. And the delay between pushed and released messages is controlled by the “Minimum time in seconds for a press to clear” setting in the DH?
  3. And if i understand it correctly, that a hold, a double or triple click is normally generated by the button/the device itself?

Is there ANY way of getting a second control option out of this button?
Maybe a smartapp that would pick up on a double click (button pushed twice within a certain time)?
I can see that if i set the “Minimum time in seconds for a press to clear” setting to 5 seconds and press the button twice within 2 seconds, the Activity feed shows two pressed and only one released…?


Yes and yes. That’s right. The DH for the Aqara button model WXKG11LM provides an emulated momentary press.

When you press the button, the DH starts a countdown timer based on the “Minimum time in seconds for a press to clear” setting, and then automatically sends the button “released” event. Again, the button hardware does not support any button “held” function.

I’m not sure I understand your question. But if you’re asking about button devices in general, then yes, normally the button device needs to provide unique messages for single click, double-click, etc, or hold in order for the DH to send the correct events for the SmartThings hub to use.

However, in the case of the round “original” Xiaomi Button, it sends different messages for press and release, so in theory the DH can calculate the difference in time between the press and the release messages to decide if the button was clicked or held.

I say “in theory” because in reality this doesn’t work 100% reliably and accurately because the DH code is executed in “the cloud”, and there are small delays in code execution that can result in the release message being processed before the press message, which is in reverse order!!

Is there ANY way of getting a second control option out of this button?

Yes - Use another home automation solution besides SmartThings. The truth is that the Aqara Button model WXKG11LM hardware supports multi-clicks up to 4, but the SmartThings Zigbee API ignores those messages. So if you double-click Aqara button, the DH receives no message, and nothing happens. The button hardware is sending a unique message for double-click, but the SmartThings hub basically ignores it.

Of course if you use the button with the Xiaomi hub, all of the functions are available, but there’s no way to get a Xioami hub to communicate to a SmartThings hub. There are other home automation solutions that people have gotten to work with Xiaomi devices, and with those, you could use the multi-click function of the Aqara button. Personally, I have recently bought a Hubitat hub, and put together DHs based on the bspranger/Xiaomi GitHub repository, and that has gained access to all the functions of Xiaomi devices that the SmartThings Zigbee API ignores. I don’t have any Aqara buttons, but @ArstenA does, and he made a Hubitat DH so he can now use multi-clicks with it.

This would be a really bad idea, especially considering that SmartThings ignores the Aqara Button hardware’s multi-click messages. As I mentioned above, if you double-click the button, no message is received by the DH, and nothing happens. Adding some kind of emulated double-click function would result in all kinds of missed clicks and confusion.

This is because every time you press the button, it resets the countdown timer. The point of the emulated momentary press is to wait until the release message is sent before you press the button again. And what are you using the button for that you would like to press it that often?

1 Like

Hi everyone - I just noticed that user @fison67 has shared a Smart App + Device Handler solution to add virtual Xiaomi devices to SmartThings called Mi Connector.

This solution also allows adding Xiaomi Zigbee sensors, etc. that are connected directly to a Xiaomi Gateway hub.

Please note that it requires a Docker-based API sever running on Raspbery Pi or Synology NAS.

1 Like

Sweet. Will give it a go when I get back and let you know.


Oh man…! You are truly - and i mean this in the most positive way - BADASS at this @veeceeoh
Thank you for taking your time to explain these thing in a good way, even for the noobs to understand… :+1::wink:

Just to be clear, i have the WXKG03LM buttons, but assume that it is the same game, regarding functionality…?

The idea was, that the last wall switch (button) i encounter on my way to bed, could be used to both control the lights in the hallway (single push), AND run the Good Night routine (hold or double push)… :slight_smile:

Oh sorry, I was trying to explain how the Aqara button DTH was set up to work with the WXKG11LM square button.

Again, as I said before, the WXKG03LM & WXKG02LM wall surface-mounted Aqara Wireless Smart Switch models only send one kind of message when a button is pressed. And for the WXKG02LM model, SmartThings filters out the different messages for left, right, and both buttons pressed, so for any of those the DTH only see one type of button press message and there’s no way at all to know if it was left, right, or both pressed.

Also. something new: I am working on an update to the Aqara button DTH so it can also work with the new version of the Aqara square button, model WXKG12LM. I have learned from the SmartThings Developer Documentation that button “released” events are no longer supported, so that will probably be removed from the DTH, since Smart Apps won’t recognize a “released” event. This also means the Toggle mode will be removed, but this is not a big issue because Smart Apps like SmartThings Smart Lights App can provide a on/off toggle function.

You should consider getting a different button, because that just isn’t possible with the WXKG03LM or WXKG02LM models. I’m really sorry.

1 Like

I’ve looked at that update to the DTH and it wouldn’t fix the issue you’re experiencing.

I’m working on a new version of the Aqara motion sensor DTH to make sure it doesn’t disrupt people’s automations if the sensor is put into hardware test mode.

Anyone have trouble seeing these devices on the new SmartThing app? They all show up in the original version (classic) but not on the newer app.

The custom DTH’s don’t show up in the new app yet, that’s a future promise :wink:


Is the version you working on, is that the Version 1.2? Just updated the device handler to that version and will give that a go.

Yes, that’s right. The GitHub comments thread on the link I gave has all my notes about the changes I made.

Great work guys!

The only thing I dont like is that the color on the temperature tiles are inconsistent from all the other devices I use. (Fibaro, Aeon multisensor, Netatmo etc)

Here is an example of the code used for other devices:

			[value: 31, color: "#153591"],
			[value: 44, color: "#1e9cbb"],
			[value: 59, color: "#90d2a7"],
			[value: 74, color: "#44b621"],
			[value: 84, color: "#f1d801"],
			[value: 95, color: "#d04e00"],
			[value: 96, color: "#bc2323"]

For me this seems to be the standard on all the official smartthings DTH, and the color will stay the same even if you switch between F and C

The color set to represent temperature display in the two Xioami Temp/Humidity sensor device handlers was derived directly from the SmartThing’s Developer Documentation’s Color Standards.

In that section of the documentation they link to an example Device Handler which accommodates both Celsius and Fahrenheit values:

The link is to the Ecobee Thermostat device handler code, and you’ll see the set of values is nearly the same - I think the Celsius values section of the color mapping for the Xiaomi DTHs were lowered a bit.

I have not seen this behavior, but certainly I can try the Fahrenheit-centric color set you quoted (same as on the ST Dev Docs) again and report my findings with screenshots back here.

I am getting duplicate notifications for each open and clsoe of one of these contact sensors. Anyone else see this behavior or know how to stop it ?

I am thinking of buying the square button (WXKG03LM) as this looks rather nice. Does this work with any of the DH’s? See that its mentioned the other type only (WXKG11LM)…

Another question is also whether it works dimming lights with this switch? E.g. by holding button for dimming?

1 Like

I’ve only seen it happen now and then. No idea how to change it, because as far as I have seen, it’s based on messages sent directly by the hardware.

WXKG03LM <— This one, right?

The wall surface-mounted Aqara Smart Light Switch model WXKG03LM can be used with the Aqara Button DH.

Sadly, the hardware only supports sending a button pressed message. There’s no multi-click or hold support.

Beware: The two-button Aqara Smart Light Switch model WXKG02LM does NOT work as two buttons with SmartThings. The technical reason for this is that the SmartThings ZigBee attribute report message parser strips out what is known as the endpoint number value. The two-button WXKG02LM model uses a different endpoint number for the left button press, right button press, and both-button press. The DH only receives all of those messages as coming from one button. Until SmartThings changes the way it handles ZigBee attribute reports with different endpoint numbers, the two button functionality of the WXKG02LM model will never work.

1 Like

what is the CATCHALL method ?