ZHA - Xiaomi Aqara Wireless Mini Switch (WXKG11LM) - lumi.sensor_switch.aq2

Introduction:

This Blueprint allows you to configure an Xiaomi Aqara Wireless Mini Switch (WXKG11LM) paired to the ZHA integration. The Zigbee ID for this button is “lumi.sensor_switch.aq2”.

It supports five commands - single press, double press, triple press, quadruple press and “multiple” press, which is basically anything higher than 5 presses.

Note: I think that the >5 presses action was not intended to be used like this, but it just works! When you press the button 5 or more times, you’ll even see the blue “pairing light” blink, and the button sends his identification", but i have been using it for automations and so, and since it works, you can also use it! If you don’t feel like it, leave the multiple presses blank :slight_smile:

This blueprint is based on ZHA - Aqara Wireless Mini Switch from @SeanM!

As @SeanM mentions on his blueprint:

Also, an additional tip: if you select the “Choose” action type, you can increase the amount of actions each button is capable of executing. For example you can make “double press” activate a scene by default, but make it skip tracks if Spotify is playing, and make it fast forward if you’re watching a movie.

Other Recommended Xiaomi ZHA Blueprints:

Here are some Blueprints I am using for Xiaomi devices using ZHA, which are working great.

ZHA - Xiaomi Mijia Round Wireless Switch (WXKG01LM) - lumi.sensor_switch - by me, @carlosmesquita
ZHA - Aqara Wireless Remote Switch (Double Rocker) - by @NachtaktiverHalbaffe

Requirements

Blueprint

Click the badge to import this Blueprint: (needs Home Assistant Core 2021.3 or higher)

Open your Home Assistant instance and show the blueprint import dialog with a specific blueprint pre-filled.

Or import this Blueprint by using the forum topic URL:

blueprint:
  name: ZHA - Xiaomi Aqara Wireless Mini Switch (WXKG11LM)
  description: Automate your Xiaomi Aqara Wireless Mini Remote Switch using ZHA events.
  domain: automation
  input:
    mijia_square_switch:
      name: Aqara Wireless Square Switch
      description: Aqara Wireless Square Switch to use
      selector:
        device:
          integration: zha
          manufacturer: LUMI
          model: lumi.sensor_switch.aq2
    remote_button_short_press:
      name: Single Press
      description: Action to run on single press
      default: []
      selector:
        action: {}
    remote_button_double_press:
      name: Double Press
      description: Action to run on double press
      default: []
      selector:
        action: {}
    remote_button_triple_press:
      name: Triple Press
      description: Action to run on triple press
      default: []
      selector:
        action: {}
    remote_button_quadruple_press:
      name: Quadruple Press
      description: Action to run on quadruple press
      default: []
      selector:
        action: {}
    remote_button_multiple_press:
      name: Multiple Press
      description: Action to run on multiple press
      default: []
      selector:
        action: {}
mode: parallel
max_exceeded: silent
trigger:
- platform: event
  event_type: zha_event
  event_data:
    device_id: !input 'mijia_square_switch'
action:
- variables:
    args_val: '{{ trigger.event.data.args.value }}'
- choose:
  - conditions:
    - "{{ trigger.event.data.args.value == 0 }}"
    sequence: !input 'remote_button_short_press'
  - conditions:
    - '{{ args_val == 2 }}'
    sequence: !input 'remote_button_double_press'
  - conditions:
    - '{{ args_val == 3 }}'
    sequence: !input 'remote_button_triple_press'
  - conditions:
    - '{{ args_val == 4 }}'
    sequence: !input 'remote_button_quadruple_press'
  - conditions:
    - '{{ args_val == ''lumi.sensor_switch.aq2'' }}'
    sequence: !input 'remote_button_multiple_press'

Notes:

  1. The condition for the single press are different from the other actions, because i had some issues while using the variable. You can check this out here: Blueprint | Issues with boolean variables handling

  2. The conditions for the multiple press is also different, and even more weird, because as i mention above, I think this event was not intended to be used as a “multiple press action”.

Below you can check the Automation creation screen from this blueprint:

Changelog

  • 2021-02-20: Changed Automation Mode from restart to parallel, to fix multiple actions per event not working properly.
  • 2020-12-20: Initial version.

Enjoy! :sunglasses:

5 Likes

Hi and thank you for sharing this.

I have the next version of this Aqara button (WXKG12LM) which is basically the same button but with and added “shake” feature. In HA it is registered as lumi.sensor_switch.aq3 (instead of lumi.sensor_switch.aq.2) and I was able to import it in your blueprint by changing the last digit.

However and as far as I know, these buttons support single, double and long press. In the UI these are the options you are getting:

And in the zha_event listener this are the values I am receiving:

"command": "single"
"command": "double"
"command": "hold"
"command": "release"

Are you sure that your button has the functionality you describe? I am pretty sure that the triple and quadruple clicks are supported in the 1st version of these Xiaomi buttons (WXKG01LM)

Hello @HawkMan!
Regarding the round buttons (WXKG01LM), i also made a Blueprint for that here, and in fact it supports triple/quad/multiple presses.

I have those buttons, and the WXKG11LM version of the square, which does not have a gyro, but does in fact support triple & quad presses, but also support multiple presses, which i explain in the first post (check the Notes section.

You can check in this site, by @blakadder, both buttons:

WXKG11LM
WXKG12LM

And you can see they are different, the version with gyro only supports single/double, hold/release & shake, and the version i own, doesn’t support hold/release, neither shake, but support different “multiple” presses. I have tested this BP with my buttons and it works fine :wink:

Wow, I didn’t know that the previous version (WXKG11LM) had all this button press functionality.

I remember that when researching for it, most of the time I was reading for the single, double and long press abilities and I thought that getting the WXKG12LM was a better deal (with the added shake function).

Seems I was wrong and someone in this post from the HA community was indeed reporting the single, double, triple and quadruple functions (although via zigbee2mqqt but I don’t think that matters). Others of course reported the other functions (single, double and long)

So from what it seems the WXKG11LM button is like a jackpot?

The shake function on the WXKG12LM is nice, but i like my WXKG11LM hehe

But the remotes i like the most are:

  1. The rounded ones (WXKG01LM), which support single/double/triple/quad/multiple/hold;
  2. The WXKG07LM and similar (there are versions with different number of buttons), which support single/double/hold on each button, and even combined (single press on both buttons, double, and hold on both), and they look great, feel great and have great pricing hehe

Hi Carlos,

From what it seems the 1st version of the Xiaomi buttons (WXKG01LM) are the best in terms of functionality. I could try and get the WXKG11LM but it seems that finding the ones that support the triple and quadruple presses is a bit hard.

The Aqara D1 (WXKG07LM) buttons indeed look great, I couldn’t resist and ordered a couple from AliExpress (as cheap as 12 Euros each!) to test them.

Thanks for sharing.

Hello!

Yes, the ones i like the most are the WXKG01LM… i just ordered two more recently :smiley:

Yes, they are crazy cheap for the product! Hope you like them :slight_smile:

Np!

I had to take out model as mine was named differance

my selector

      selector:
        device:
          integration: zha
          manufacturer: LUMI

Is it working? The Blueprint?
Because the way the events are sent might be different!

If it’s working, can you share your model? I can try to change the BP to include both models!

Thanks!

lumi.remote.b1acn01

@myle, there is actually a Blueprint specific to that model, check it out: ZHA - Aqara Wireless Mini Switch

Might be worth pointing out that the model number printed on the switch is identical, even though the internal identification code is different (I have the b1acn01 version, and it’s still labelled as a WXKG11LM on the device)

Yes, correct.
You can check this kind of stuff here: Aqara Wireless Mini Switch WXKG11LM Zigbee compatibility info
Props to @blakadder

Can this work with Matter? Thanks.

Hello All,

I am super new here. I am also super frustrated just trying to get this aqara mini switch to work. I am using the BETA Matter add-on and now a Zigbee dongle, so I am curious if that is why this method isn’t working.

See image:

I also tried to add an event automation, but for some reason, I do not see an event log what I try to listen to events on zha_event. Again, maybe this is just because I am using Matter. I see Dennis also asked the question, but just looking for some help. I’m a total newb, so I’m sure it is something I am just not understanding correctly, or doing correctly. Thanks! :slight_smile:

Hello @square and @bkhalterman,
The device might work with Matter, but this blueprint will only work for the ZHA integration, directly with Zigbee.

Beat regards

1 Like