ZHA - Aqara Wireless Mini Switch (aq2) with all possible button presses

Tags: #<Tag:0x00007fc41fae38b0> #<Tag:0x00007fc41fae37e8> #<Tag:0x00007fc41fae3680>

Understandably somewhat redundant as the multiple button presses can be set as individual automation triggers, but I like to have a single automation control all options of the button, so for others that share the same OCD, here a simple blueprint for the Aqara (aq2) mini switch.

blueprint:
  name: ZHA - Aqara Wireless Mini Switch (aq2)
  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.sensor_switch.aq2
    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_triple_press:
      name: Triple Press
      description: Action to run when button is triple pressed
      default: []
      selector:
        action: {}
    button_quadruple_press:
      name: Quadruple
      description: Action to run when button is quadruple pressed
      default: []
      selector:
        action: {}
mode: restart
max_exceeded: silent
trigger:
  - platform: event
    event_type: zha_event
    event_data:
      device_id: !input "aqara_mini_switch"
action:
  - choose:
      - conditions:
          - "{{ trigger.event.data.args.value == 1 }}"
        sequence: !input "button_single_press"
      - conditions:
          - "{{ trigger.event.data.args.value == 2 }}"
        sequence: !input "button_double_press"
      - conditions:
          - "{{ trigger.event.data.args.value == 3 }}"
        sequence: !input "button_triple_press"
      - conditions:
          - "{{ trigger.event.data.args.value == 4 }}"
        sequence: !input "button_quadruple_press"
1 Like

There’s a similar one, that’s probably duplicate ZHA - Xiaomi Aqara Wireless Mini Switch (WXKG11LM) - lumi.sensor_switch.aq2.

Didn’t exist yet when I published this one :wink:
But sure is a better presentation than mine…

Would good etiquette be for me to delete this post?

Hello!
Actually you are right, you posted your BP first! At the time I didn’t notice, probably because I was building mine for a few days.
Mine also includes the multiple press action, that’s another difference :slight_smile:

No worries, my recommendation would be for your BP any day!

1 Like

:wave: yeah, it’s hard to track all those variations! Bottom line is that we all benefit from these, so thanks both for your work :rocket:

Note that updating to 2021.4.5 seems to break this blueprint. The lingo on the support forums go somewhat above my head, but I gather that this is part of a larger problem and appears to being addressed. For now, downgrading to 2021.4.4 fixes the problem.