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

You are the first person to report receiving one of the new revisions of the WXKG11LM button, so I haven’t yet seen any information that would help me to change the device handler to work with it.

However, you can manually change the device driver assigned to your WXKG11LM button to see if it works without any changes. In the same page of the IDE where you took that screenshot, click the “Edit” button, and then change the Type: from “Thing” to “Xiaomi Aqara Button”, and click update.

After that, you should view your WXKG11LM button in the SmartThings “Classic” mobile app, open the settings, make sure both “info log” and “debug log” messages are set to be displayed, and then his “Save.” With those turned on, if any of the button’s functions aren’t working with the device handler, the log output in the Live Logging window of the IDE should help me to know what modifications to make to the device handler for this new revision of the Aqara button.

1 Like

Cheers Keith, still getting used to how everything works so didn’t know you could do that.

I can get a single click and a double click in the live logging but that’s about it, that said I don’t know if this particular button (the WXKG11LM) supports anything else, I ordered the WXKG12LM as that one does.

In the classic app it also shows the single and double click and then goes back to released, also shows last event and battery status which leads me to think that it does work correctly and that’s all this model does.

I just realized that a Hubitat user also reported receiving one of the new revision WXKG11LM buttons, and based on this information I should be able to update the SmartThings Aqara Button device handler to work with it.

The hardware supported functions of the new revision WXKG11LM button are: press, double-click, hold, and release. So you should in theory see messages for all of those in the Live Logging output.

It may take me a few days to come up with a beta of an updated device handler, but I will post back here with a link to that as soon as I do.

2 Likes

I’m following your instructions but struggling to get my vibration sensor (DJT11LM) to appear in the app. I see the multiple flashes indicating pairing is successful, I then short press the reset button, but the sensor never appears in the app, even after 5 mins. Any suggestions? TIA

PS I also have the new 11LM button and can confirm I can see single, double and held states

Edit:
Got it working eventually after re-reading your instructions. Didn’t realise I had to keep short pressing until it appears in the app. Thanks for your hard work!

1 Like

Hi,

I added a couple of Aqara temp sensors and a leak sensor.
Paired and working well with smartthings classic app.

However when using the new Smartthings app, these sensors are inaccessible. It just says Can’t connect to device. Check device and try again.

Other devices work well in the new Smartthings app. Hue lighting system and Logitech Harmony.
I don’t know if it’s relevant or not, but another thing I noticed was initially the Add Manually option allowed many different device types to be added in the new App. However now that I had added my stuff using the classic app, I can only add some simple devices like TV, AV, Washer etc. No hubs, sensor or other components All gone.

Any idea?

Thanks

[BETA] Xiaomi Aqara Button SmartThings DTH v1.3b

I have updated the Aqara Button device handler to add support for the new revision of model WXKG11LM. While working on it, I also realized that I could add support for the hold and double-click functions of the Single-Button Aqara Wireless Smart Light Switch (model WXKG03LM).

The new beta DTH code can be copied directly from here.
NOTE: This DTH needs testing before it can be considered a full release.

Here are some handy charts that show how different types of button actions are passed on as SmartThings events to be used by SmartApps for automations:

Aqara Button - Model WXKG11LM (original revision)

Action Event Button #
Single-click pushed 1

Note: Although the hardware also supports double-, triple-, and quadruple- click messages, SmartThings only sees single-clicks.

Aqara Button - Model WXKG11LM (new revision)

Action Event Button #
Single-click pushed 1
Hold held 1
Double-click doubleTapped 1
Release lastReleasedCoRE n/a (see note below)

Notes: A release message is sent when the button is released after being held, which results in a lastReleasedCoRE event, which can be used by WebCoRE users (SmartThings doesn’t support a “released” event in its button capability implementation). I don’t own this model, but I assume the hardware button held message is sent after 400ms like with Model WXKG12LM.

Aqara Button - Model WXKG12LM

Action Event Button #
Single-click pushed 1
Hold held 1
Double-click doubleTapped 1
Release lastReleasedCoRE n/a (see note below)
Shake pushed 2

Notes: A release message is sent when the button is released after being held, which results in a lastReleasedCoRE event, which can be used by WebCoRE users (SmartThings doesn’t support a “released” event in its button capability implementation). The hardware button held message is sent after the button has been held for 400ms.

Aqara Button - Model WXKG03LM (original revision)

Action Event Button #
Single-click pushed 1

1-button Aqara Wireless Smart Light Switch - Model WXKG03LM (new revision)

Action Event Button #
Single-click pushed 1
Hold held 1
Double-click pushed 2

Notes: The hardware button held message is sent after the button has been held for 400ms. However, holding the button for more than 15-20 seconds puts the device into pairing mode.

2-button Aqara Wireless Smart Light Switch - Model WXKG02LM (original revision)

Action Event Button #
Press left button pushed 1
Press right button pushed 1
Press both buttons pushed 1

Note: The 2-button Aqara Smart Light Switch model WXKG02LM (original revision) is only recognized as ONE button. This is because the SmartThings API ignores the data that helps distinguish between left, right, or both-button presses.

Change List

  • added support for new revision of the model WXKG11LM Aqara Button, which appears as ZigBee model lumi.remote.b1acn01
  • added support with hold and double-click functionality for 1-button Aqara Wireless Smart Light Switch (model WXKG03LM - new revision), which appears as ZigBee model lumi.remote.b186acn01
  • added new function call to determine model of Aqara button when paired, display it in live logging, and set correct number of buttons for SmartThings SmartApps to make use of
  • minor formatting and comment text revisions
4 Likes

Please try out my new beta release that added compatibility for the new revision of the 11LM Aqara Button.


Custom device handlers, like all of the ones for Xiaomi devices, are not yet officially supported in the new SmartThings Mobile App.

Some users have attempted to add the code needed for making custom device handlers work in the new mobile app, but I have no plans to try to hack together a solution until Samsung/SmartThings has published official developer documentation on this. Sorry for any inconvenience!

The 2 button wall switched from Xiaomi. Is it a technical impossibility for Smartthings to add the coding to allow the button to be scene properly without them redesigning it all. or is it just they haven’t don it?

Does that make sense? As the Xiaomi market is so large to most Smart users now. has anyone thought of trying to start something to get official integration?

Got it, thanks.
I hope they don’t plan on phasing out the classic app then before officially supporting the custom handlers.

The technical explanation of the exact problem going on here is that SmartThings does not recognize messages sent by devices on different endpoints using the same cluster. The ZigBee specification uses clusters as a way to group different types of message data, such as the “on/off” cluster 0x0006, and endpoints are intended as a way to differentiate between different applications or sets of functions assigned to a device. Sometimes device manufacturers use different endpoints assigned to one function of a device, however, which is true for a number of Xiaomi devices.

I’ve been mentioning this issue for a while because it also affects the Xiaomi “original” and Aqara WXKG11LM (original revision) buttons. Used with SmartThings, you’re missing out on hold, double-click, etc. messages that never get sent through:

If you search the ST forums, you will find that SmartThings’ lack of support for ZigBee multiple endpoint messages is a well-known issue, and there is a far-less-than-ideal suggested workaround. From this thread:

This suggested workaround does not work for Xiaomi devices, because they ignore read attribute commands on the on/off cluster. So SmartThings can’t “ask” them what kind of button press just happened.

If you read through the rest of the thread I linked to above, you see that the problem for the SmartThings engineers is that adding in Zigbee multiple endpoint message support would break things for just about everyone. This is because it would add information to the parsed incoming message data that device handlers aren’t expecting.

Honestly I’m not sure if this will ever get addressed, because it’s been a known issue for some years now, which is one of a number of reasons I’ve moved my home automation setup mostly off of the SmartThings platform.

Is the Xiaomi market large to SmartThings? I have no evidence either way.

The bottom line is that Xiaomi’s ZigBee devices do not conform 100% to the ZigBee specification, resulting in them being dropped off of non-Xiaomi gateway hubs’ networks in some circumstances. So I have a lot of difficulty seeing why Samsung/SmartThings would ever consider officially supporting Xiaomi home automation devices.

2 Likes

Thanks for looking in to this…!! :+1:
I have just tested the new DH on a WXKG03LM, but it does not seem to recognize button 2 or held events - i only get “Button 1 was pushed” in live logging… :thinking:

I if go to the buttons settings an enable the “Display debug log messages” i get the following in live logging, when hitting save:

0e4cf061-dffc-4d03-999f-43f9eb9ff913 20.58.27: debug Update detected: DeviceUpdated b28665f0-e242-4662-baf3-94adcf088185

b28665f0-e242-4662-baf3-94adcf088185 20.58.27: error java.lang.NullPointerException: Cannot invoke method startsWith() on null object @line 359 (setNumButtons)

b28665f0-e242-4662-baf3-94adcf088185 20.58.27: info Xiaomi test: Updating preference settings

b28665f0-e242-4662-baf3-94adcf088185 20.58.27: error java.lang.NullPointerException: Cannot invoke method startsWith() on null object @line 359 (setNumButtons)

b28665f0-e242-4662-baf3-94adcf088185 20.58.27: info Xiaomi test: Updating preference settings

Don’t know if you can use this info for debugging?
Let me know if i should send you other info to help out… :slight_smile:

Edit:
Maybe found the error myself - no Zigbee Model ID - could this be the reason, and how do i fix it? (the button works fine as a 1 button device)

Yes, that’s what’s causing the errors you saw, but they are only related to initializing the number of buttons available to SmartThings SmartApps.

The reason why the ZigBee model ID isn’t there is probably because you used the “catchall” method to pair your WXKG03LM Aqara switch. I had the same experience while testing my 2-button WXKG02LM model, and I will need to add code to catch when the ZigBee model ID is blank. For now, those errors aren’t hurting anything, however.

But with the double-click and hold events, since I don’t have the WXKG03LM model, would you mind copying the log output you see when you try those actions with the switch? That would help me to know what’s going wrong, or that perhaps SmartThings just isn’t recognizing the messages for double-click / hold actions.

Also possible - I added those additional functions based on reports from a Hubitat hub user, so that I could update the Hubitat device handler for Aqara buttons. But like with the new revision of the WXKG11LM Aqara Button, there might be new revisions of the Aqara Wireless Smart Wall Switches. So you may just have an old revision which only has a single-click function.

Wouldn’t you know… :astonished:
Just deleted the button from ST, brewed a cup of coffee and prepared myself for a long haul to get it repaired…
It repaired at my second attempt and was assigned the DH automatically…!! First time i have ever paired a WXKG03LM without using the Catchall method… :muscle:

So the live logging show this, both with single press, double press and hold:

373d0d8b-bd1b-4aa4-bb8d-ba842c451b0c 22.26.05: debug Aqara Switch WXKG03LM: Creating event [name:button, value:pushed, data:[buttonNumber:1], descriptionText:Aqara Switch WXKG03LM was pushed, isStateChange:true]

373d0d8b-bd1b-4aa4-bb8d-ba842c451b0c 22.26.05: debug Aqara Switch WXKG03LM: Setting Last Pressed to current date/time

373d0d8b-bd1b-4aa4-bb8d-ba842c451b0c 22.26.05: info Aqara Switch WXKG03LM was pushed (Button 1 pushed)

373d0d8b-bd1b-4aa4-bb8d-ba842c451b0c 22.26.05: debug Aqara Switch WXKG03LM: Setting Last pressed to current date/time

373d0d8b-bd1b-4aa4-bb8d-ba842c451b0c 22.26.05: debug Aqara Switch WXKG03LM: Parsing ‘on/off: 1’

Is this what you asked for?

1 Like

If you see those same set of messages that start with “Parsing ‘on/off: 1’” then that means either there are two revisions of the WXKG03LM or SmartThings isn’t recognizing the double-click and hold messages. But it’s more likely there are two revisions of the WXKG03LM because the Hubitat user who helped me with log messages saw the single/double-click and hold messages sent from cluster 0012, but your log messages show on/off: which is cluster 0006 - totally different.

It would really help if we knew of more owners of the 1-button WXKG03LM Aqara Wall switch to check what log output they see.

A few weeks ago all of a sudden, a bunch of my Xiaomi Aqara devices dropped off the network. I cannot get them to reconnect. Anyone else having this issue. Do I need to remove them from the hub? I would like to avoid that.

I have been having the same issue for the past two weeks or more with some of my xiaomi devices. I can’t get them to stay connected for more than couple hours anymore and nothing changed in my setup so I’m thinking it has to do with the latest hub firmware update st pushed :man_facepalming:

1 Like

Have just added this DTH and changed my button to use it. Pulled this from the log:

14:05:00: info Button 3 was released
14:04:59: info Button 3 was held (Button 1 held)
14:04:55: info Button 3 was double-clicked (Button 2 pushed)
14:04:48: info Button 3 was single-clicked (Button 1 pushed)

I’m about to try a few things in webcore.
Anything in particular you want testing?

How do I use the custom events? I can only see pushed or held in webcore.

I have two of these. Since changing to the new DTH is see this in the events.

2018-11-04 2:59:08.823 PM GMT
moments ago
DEVICE button held Lounge Wireless was held
2018-11-04 2:58:26.405 PM GMT
moments ago
DEVICE button pushed Lounge Wireless was double-clicked
2018-11-04 2:58:19.849 PM GMT
moments ago
DEVICE button pushed Lounge Wireless was single-clicked
2018-11-04 2:58:12.791 PM GMT
moments ago
DEVICE numberOfButtons 3 Lounge Wireless number of buttons is 3

Thanks for that

Thanks for that.

Interesting read. Shame they can’t choose how the data is processed based on a profile of the device.