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
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)
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:
-
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
-
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!