ZHA - Aqara Wireless Mini Switch

This Blueprint will let you configure an Xiaomi Aqara Wireless Mini Switch paired to the ZHA integration. It supports four commands - single press, double press, long press, and release.

Note: Apparently the manufacturer made 3 different revisions of this device over the years, each with slightly different capabilities. This Blueprint requires the lumi.remote.b1acn01 model (which I purchased at the Amazon link below).

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.

Requirements:

Blueprint:
Blueprint, which you can import by using this forum topic URL:

blueprint:
  name: ZHA - Aqara Wireless Mini Switch
  description: Automate your Xiaomi Aqara Wireless Mini Switch using ZHA events.
  domain: automation
  input:
    aqara_mini_switch:
      name: Aqara Wireless Mini Switch
      description: Aqara Wireless Mini Switch to use
      selector:
        device:
          integration: zha
          manufacturer: LUMI
          model: lumi.remote.b1acn01
    button_single_press:
      name: Single Press
      description: Action to run on single press
      default: []
      selector:
        action:
    button_double_press:
      name: Double Press
      description: Action to run on double press
      default: []
      selector:
        action:
    button_long_press:
      name: Long Press
      description: Action to run when button is long pressed (held down)
      default: []
      selector:
        action:
    button_released:
      name: Released
      description: Action to run when button is released after a long press
      default: []
      selector:
        action:

mode: restart
max_exceeded: silent

trigger:
  - platform: event
    event_type: zha_event
    event_data:
      device_id: !input aqara_mini_switch

action:
  - variables:
      command: "{{ trigger.event.data.command }}"

  - choose:
      - conditions:
          - "{{ command == 'single' }}"
        sequence: !input button_single_press
      - conditions:
          - "{{ command == 'double' }}"
        sequence: !input button_double_press
      - conditions:
          - "{{ command == 'hold' }}"
        sequence: !input button_long_press
      - conditions:
          - "{{ command == 'release' }}"
        sequence: !input button_released

12 Likes

Hey! Thanks for this! There’s also a shake action, would you mind adding that as well?

Hmm, I re-read what you wrote and that bleuprint is for the lumi.remote.b1acn01 model. I see mine is different, as it’s registered as lumi.sensor_swit.

I created another one ZHA - Aqara Wireless Mini Switch (model lumi.sensor_swit).

1 Like

Thanks so much for this. I’ve been building single automation’s for ages for single press, double press etc. This has saved me so much time and has streamlined my number of automation’s!

Thanks for this. I just changed over from zigbee2mqtt on cc2350 to ZHA on Sonoff zbbridge using tasmota and could not figure out how to access the click features. This did it all for me.

Looking great! And it seems to fit with my need and version of switches. One question though: If I´m right, a few other switch versions had also triple press-functionality. Is it possible to add it to this blueprint also, or is that switch uncapable to handle that function?

I have the same question, since this blueprint appears to be for the same switch, but uses a different model number and has triple- and greater presses.

Hello there!
Actually, there are 2 different switches, that look the same from the outside, check here.

So, depending on your switch model, you will have different capabilities.

Cheers.

Hi!
Thanks for the response. I am just now learning about both blueprints and zigbee, so these are both new. The information about the models seems conflicting. The other BP starts with the sentence

This Blueprint allows you to configure an Xiaomi Aqara Wireless Mini Switch (WXKG11LM) paired to the ZHA integration.

which is supposedly the model that I have (according to the label on the box). Yet, that BP doesn’t recognize it, and this one does. The zigbee dongle, however, says it is model lumi.remote.b1acn01, which is consistent with this BP, and not the other one which uses lumi.sensor_switch.aq2.

Hello!

Actually, Xiaomi sells the two different models as being the same one: WXKG11LM, but they have different Zigbee ID’s.
In my blueprints’ title, you can see i actually specify the Zigbee ID for that Blueprint, lumi.sensor_switch.aq2.

Best regards.

1 Like

Got it—thanks!

No problem! If you need some help regarding ZHA and Blueprints let me know.

Those are a bit tricky to follow! Fortunately I had round Mijia-versions and they had more functions so I just used them and saved these for another purpose:)

Yes, I also have a few of those, and they are just great. Love the form factor and the price / functionality ratio.

I cannot turn off a single entity without a device_id?
Got some sonoff switches, but i can’t access them?

Thanks

@SeanM I don’t use Automation in HA but use NodeRED instead but I do keep some things in YAML. If I move pretty much all of this to my config.yml file where I keep other input_booleans and switches and selects that should do the trick correct?

I have put an Event node listening for zha_event and I do see the payload matches what you are selecting for so I know that part is correct . However, I am unsure about the rest and adding it as entity or entities to HA that Node Red can read in.

I have the Aqara Wireless Mini Switch (WXKG11LM / lumi.remote.b1acn01), in fact when I clicked your amazon link in the OP, my webpage says last purchased in April 2021, so I have the same thing. When I join it to my HA I ONLY see the Power entity. Isn’t there supposed to be an entity for the button? This is the first button I have tested so I am not familiar. Is there a trick to adding this? The other Aqara LUMI devices I have are working fine, but this one seemingly is not.

Any help is appreciated.

UPDATE: So using the Blueprint provided the Device is found and I can set actions for single, double, long press, and release of long press. Thats great. Is there no event or entity etc. available to developer mode? Is there access to Node-Red to be Abe to trigger flows/sequences? This is where I really want to utilize the button.

Could somebody explain to me the difference between long press and release after long press?

I can’t seem to figure the difference out, as the long press always triggers and then the long press release follows if configured :thinking:

Thank you!

Thank you so much for this. I’m a novice HA user and I’ve struggled for days to work out how to use the Aqara mini switches. This worked a treat.

Hi, I updated the code to reflect the multi press (5 times it seems) for the switch.


blueprint:
  name: ZHA - Aqara Wireless Mini Switch
  description: Automate your Xiaomi Aqara Wireless Mini Switch using ZHA events.
  domain: automation
  input:
    aqara_mini_switch:
      name: Aqara Wireless Mini Switch
      description: Aqara Wireless Mini Switch to use
      selector:
        device:
          integration: zha
          manufacturer: LUMI
          model: lumi.remote.b1acn01
    button_single_press:
      name: Single Press
      description: Action to run on single press
      default: []
      selector:
        action: {}
    button_double_press:
      name: Double Press
      description: Action to run on double press
      default: []
      selector:
        action: {}
    button_long_press:
      name: Long Press
      description: Action to run when button is long pressed (held down)
      default: []
      selector:
        action: {}
    button_released:
      name: Released
      description: Action to run when button is released after a long press
      default: []
      selector:
        action: {}
    button_multi:
      name: Multi
      description: Action to run when button is pressed repeatedly
      default: []
      selector:
        action: {}    
  source_url: https://community.home-assistant.io/t/zha-aqara-wireless-mini-switch/255540
mode: restart
max_exceeded: silent
trigger:
- platform: event
  event_type: zha_event
  event_data:
    device_id: !input 'aqara_mini_switch'
action:
- variables:
    command: '{{ trigger.event.data.command }}'
    args_val: '{{ trigger.event.data.args.value }}'
- choose:
  - conditions:
    - '{{ command == ''single'' }}'
    sequence: !input 'button_single_press'
  - conditions:
    - '{{ command == ''double'' }}'
    sequence: !input 'button_double_press'
  - conditions:
    - '{{ command == ''hold'' }}'
    sequence: !input 'button_long_press'
  - conditions:
    - '{{ command == ''release'' }}'
    sequence: !input 'button_released'
  - conditions:
    - '{{ args_val == ''lumi.remote.b1acn01'' }}'
    sequence: !input 'button_multi'

2 Likes