Aqara Wireless Switch WXKG11LM (via Zigbee2MQTT device trigger)

I’ve been using Zigbee2MQTT - Aqara Wireless Switch (single, double, triple, quadruple) for a while now and it’s been good. However, the upcoming Zigbee2MQTT 2.0 release will drop support for the legacy sensors that blueprint uses. Here is a nearly identical blueprint that implements support for the WXKG11LM using device triggers. It will work in the 1.x releases of Zigbee2MQTT too.

Edit: This was reverted in fix(ignore): Add back Home Assistant legacy action sensor by Koenkk · Pull Request #25192 · Koenkk/zigbee2mqtt · GitHub and the sensor entities have been restored. Of course, this blueprint still works, but users upgrading to the 2.0 release when it’s out won’t have any breaking automations to fix up.

As well, it adds support for hold and release actions which are supported on some newer revisions of the button (but can’t be identified from the model number).

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

blueprint:
  name: Aqara Wireless Switch WXKG11LM (via Zigbee2MQTT device trigger)
  description: Control anything using Aqara Wireless Switch
  domain: automation
  input:
    device:
      name: Switch
      description: Aqara Wireless Switch to use
      selector:
        device:
          filter:
          - manufacturer: Aqara
            model: Wireless mini switch (WXKG11LM)
          - manufacturer: Aqara
            model: Wireless mini switch
          - manufacturer: Xiaomi
            model: Mi wireless switch
          multiple: false
    press_single:
      name: Single button press
      description: Action to run on single button press
      default: []
      selector:
        action: {}
    press_double:
      name: Double button press
      description: Action to run on double button press
      default: []
      selector:
        action: {}
    press_triple:
      name: Triple button press
      description: Action to run on triple press
      default: []
      selector:
        action: {}
    press_quadruple:
      name: Quadruple button press
      description: Action to run on quadruple press
      default: []
      selector:
        action: {}
    press_hold:
      name: Hold button press
      description: Action to run on button hold (not supported on all devices)
      default: []
      selector:
        action: {}
    press_release:
      name: Release button
      description: Action to run when button is released (not supported on all devices)
      default: []
      selector:
        action: {}
  source_url: https://community.home-assistant.io/t/aqara-wireless-switch-wxkg11lm-via-zigbee2mqtt-device-trigger/808126
mode: queued
max_exceeded: silent
trigger:
  - platform: device
    domain: mqtt
    device_id: !input device
    type: action
    subtype: single
  - platform: device
    domain: mqtt
    device_id: !input device
    type: action
    subtype: double
  - platform: device
    domain: mqtt
    device_id: !input device
    type: action
    subtype: triple
  - platform: device
    domain: mqtt
    device_id: !input device
    type: action
    subtype: quadruple
  - platform: device
    domain: mqtt
    device_id: !input device
    type: action
    subtype: hold
  - platform: device
    domain: mqtt
    device_id: !input device
    type: action
    subtype: release
action:
  - choose:
      - conditions: "{{ trigger.payload == 'single' }}"
        sequence: !input press_single
      - conditions: "{{ trigger.payload == 'double' }}"
        sequence: !input press_double
      - conditions: "{{ trigger.payload == 'triple' }}"
        sequence: !input press_triple
      - conditions: "{{ trigger.payload == 'quadruple' }}"
        sequence: !input press_quadruple
      - conditions: "{{ trigger.payload == 'hold' }}"
        sequence: !input press_hold
      - conditions: "{{ trigger.payload == 'release' }}"
        sequence: !input press_release
3 Likes

Thanks for this update!

As a heads up, I also have WXKG11LM switches, but for some reason Home Assistant shows their model name as just “Wireless mini switch” instead of “Wireless mini switch (WXKG11LM)”. This caused your blueprint to not detect any eligible devices for the blueprint. I fixed by updating the blueprint to add my variation to the device filter list:

  input:
    device:
      name: Switch
      description: Aqara Wireless Switch to use
      selector:
        device:
          filter:
          - manufacturer: Aqara
            model: Wireless mini switch (WXKG11LM)
          - manufacturer: Aqara
            model: Wireless mini switch
          multiple: false
1 Like

Thanks, that was also the necessary fix for my device, I suggest that the blueprint will be updated to include this entry.

Interesting mine shows up differently! Either way, I’ve updated the blueprint. Thanks!

Not sure why, but the old blueprint seems to fail with 2.0.0.

I will try your version.

It works but I have to press the button twice within a few seconds. I am using the single button press.

Am I missing something?

I found that I also had to press the button twice initially. However, after that first time it seems to be working as expected. A single press works to open a garage door in my case and a double press closes it. I’ve only had it up and running for about 10 minutes so I’m not sure if it will require a double press again like the first time time, but I’ll monitor it.

Hi, thanks for great job!

can you please update the blueprint to support Xiaomi button?
here is what is working for me:

        device:
          filter:
          - manufacturer: Aqara
            model: Wireless mini switch (WXKG11LM)
          - manufacturer: Aqara
            model: Wireless mini switch
          - manufacturer: Xiaomi
            model: Mi wireless switch
          multiple: false
1 Like

I really have to press it twice at least once when I use it.

I deleted the device and added it again. Now this blueprint works properly so I don‘t have to push the button twice.

1 Like

It still fails the first time after a restart of HA.