ZHA Aqara Button (press, double press, hold actions)

This is for programming Aqara’s mini switch. After a quick search I didn’t see an existing blueprint for this button, so I made this one.
https://www.aqara.com/us/wireless_mini_switch.html

Select the button you wish to setup and then select the actions you want performed for each of the 3 button actions. Single press is required, double and hold can optionally be defined.

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

blueprint:
  name: Aqara Zigbee Button
  description: Setup actions for three functions of the Aqara Zigbee button with
    Press, Double Press, and Hold.
  domain: automation
  input:
    button_id:
      name: Button
      description: The button to configure.
      selector:
        device:
          manufacturer: LUMI
          model: lumi.remote.b1acn01
    press_action:
      name: Press Action
      description: Action to perform on Press.
      default: []
      selector:
        action: {}
    double_press_action:
      name: Double Press Action
      description: Action to perform on Double Press.
      default: []
      selector:
        action: {}
    hold_action:
      name: Hold Action
      description: Action to perform on Hold.
      default: []
      selector:
        action: {}
  source_url: https://github.com/apollo1220/blueprints/blob/9154f4940e1e6a4ef7e5fd2b9bd1f477dc001579/aqara_zigbee_button.yaml
variables:
  button_id: !input 'button_id'
  press_action: !input 'press_action'
  double_press_action: !input 'double_press_action'
  hold_action: !input 'hold_action'
trigger:
- platform: event
  event_type: zha_event
  event_data:
    device_id: !input 'button_id'
action:
- choose:
  - conditions:
    - condition: template
      value_template: '{{ trigger.event.data.command == "single" }}'
    sequence: !input 'press_action'
  - conditions:
    - condition: template
      value_template: '{{ trigger.event.data.command == "double" }}'
    sequence: !input 'double_press_action'
  - conditions:
    - condition: template
      value_template: '{{ trigger.event.data.command == "hold" }}'
    sequence: !input 'hold_action'
3 Likes

Hi, installed the blueprint but when trying to configure my buttons using this I cannot find any devices?
Running Zigbee2MQTT.

It’s a ZHA automation.

2 Likes

Thanks. This was useful for me.

Is there a way to add ability for triple tap?

Thank you so much for this. I was struggling to learn conditionals and try it myself but failed every time. This worked flawlessly I’m so thankful you shared this.

1 Like