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'
4 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

I had an existing custom automation but “refactored” to using this blueprint and it works great (with the specific Aqara button). Thanks!

Hello,

There are no devices available when trying to configure your blueprint. My situation is somewhat unique in that all of the devices in HA exist via the Hubitat Integration. I wonder if that might be adversely affecting your blueprint?

I just started with HA last week and I have some Aqara buttons to port over from my Hubitat. This looks like it would be ideal!

-Thanks

This blueprint is for the ZHA integration.

Thank you. After I port all of my automation from Huitat to HA I’ll actually be getting a coordinator! Your blueprint is one more reason to choose ZHA! :slight_smile:

Hi,

i have two type of Aqara mini switch. The two devices are same, only model name is different. lumi.remote.b1acn01 and lumi.remote.b1acn02. I rewrite the yaml file:
selector:
device:
integration: zha
manufacturer: LUMI
model:
- lumi.remote.b1acn01
- lumi.remote.b1acn02
multiple: false
but not working. Can you help me?
Tom

Event names may be different on the different devices. Watch for the events and see what the events are and adjust from there.