Aqara Wireless Switch (Zigbee2MQTT) - single, double and hold action

I had the same problem, modified the blueprint and it seems to work now: Aqara Wireless Switch (single, double, hold, release) · GitHub.
^ It’s a new version that uses trigger.to_state.state if available (in addition to trigger.to_state.attributes.action).

Thanks, but I just imported the blueprint again, but the automation still won’t trigger. Oh well the Aqara Buttons All-In-One [Zigbee2MQTT] blueprint is working for me.

Did you import from my link above? It’s a modified version.

No I didn’t realise yours was a modified version, I imported the original. Will try again when I get home tonight and report back - thanks!

thank you, your version works! Much appreciated. I had a look at your github revisions, there is quite a lot of change there, good work.

1 Like

The blueprint has been updated with the modifications done by @JetSerge.

This has suddenly stopped working for me. all my button automations have stopped triggering any actions

any info?

Does it says to you the same parsing error?

Getting the same. Did you manage to resolve this?

I no longer use Zigbee2MQTT in favor of ZHA, so I can’t perform tests with an updated version.

If you want to fix the deprecated integration, please ping me, @radinsky @rufio

If not, this blueprint must be considered deprecated, unfortunately.

Unfortunately I have created my own automation instead of using blueprint…
However, there’s a way to fix described here: Is there a deprecation on entity domain for selectors? - #2 by Sir_Goodenough

1 Like

Yes, just add filter: key and space it out like the docs suggest for the current format. Don’t have to test anything.
This is the same as all entity and device selectors now all blueprints.

Fixed locally and tested, indeed the only change is filter:
image

I use this Aquara button (WXKG11LM) with Zigbee2MQTT, and I created an automation who is triggered by the single action of this device, but seems the single action state is to short for fire the automation. So I’am not able to use this button. Have someone have this kind of problem?

I think this blueprint is broken because ot the latest z2m update. Certain action are replaced by eventf if I understood it right.

See also other topics with remotes where the authors are making adjustments to their blueprint.

1 Like

Indeed, needs updating. Enable legacy actions as a workaround.

Based on work done here I’ve tweaked the blueprint as follows.

blueprint:
  name: Aqara Buttons All-In-One [Zigbee2MQTT]
  description: 'All-In-One package for Aqara Switches.'
  domain: automation
  input:
    mode:
      name: Automation Modes
      description: https://www.home-assistant.io/docs/automation/modes/
      default: parallel
      selector:
        select:
          mode: dropdown
          options:
            - single
            - restart
            - queued
            - parallel
          multiple: false
          custom_value: false
          sort: false
    zigbee_device:
      name: Zigbee Device (Aqara Switch)
      description: Select the correct Zigbee device to use.
      selector:
        device:
          integration: mqtt
          multiple: false
    single_action:
      name: Single Click
      description: Single click for devices with one button
      default: []
      selector:
        action: {}
    double_action:
      name: Double Click
      description: Double click for devices with one button
      default: []
      selector:
        action: {}
    triple_action:
      name: triple Click
      description: triple click for devices with one button
      default: []
      selector:
        action: {}
    quadruple_action:
      name: Quadruple Click
      description: triple click for devices with one button
      default: []
      selector:
        action: {}
    hold_action:
      name: Hold Action
      description: Hold action for devices with one button
      default: []
      selector:
        action: {}
    release_action:
      name: Release Action
      description: Release action for devices with one button
      default: []
      selector:
        action: {}
    shake_action:
      name: Shake Action
      description: Shake action for devices with one button
      default: []
      selector:
        action: {}
    single_left_action:
      name: Single Left Click
      description: Left click for devices with multiple buttons
      default: []
      selector:
        action: {}
    double_left_action:
      name: Double Left Click
      description: Double left click for devices with multiple buttons
      default: []
      selector:
        action: {}
    triple_left_action:
      name: triple Left Click
      description: triple left click for devices with multiple buttons
      default: []
      selector:
        action: {}
    hold_left_action:
      name: Hold Left Action
      description: Hold left action for devices with multiple buttons
      default: []
      selector:
        action: {}
    release_left_action:
      name: Release Left Action
      description: Release left action for devices with multiple buttons
      default: []
      selector:
        action: {}
    single_center_action:
      name: Single Center Click
      description: Center click for devices with three buttons
      default: []
      selector:
        action: {}
    double_center_action:
      name: Double Center Click
      description: Double center click for devices with three buttons
      default: []
      selector:
        action: {}
    triple_center_action:
      name: triple Center Click
      description: triple center click for devices with three buttons
      default: []
      selector:
        action: {}
    hold_center_action:
      name: Hold Center Action
      description: Hold center action for devices with three buttons
      default: []
      selector:
        action: {}
    release_center_action:
      name: Release Center Action
      description: Release center action for devices with three buttons
      default: []
      selector:
        action: {}
    single_right_action:
      name: Single Right Click
      description: Right click for devices with multiple buttons
      default: []
      selector:
        action: {}
    double_right_action:
      name: Double Right Click
      description: Double right click for devices with multiple buttons
      default: []
      selector:
        action: {}
    triple_right_action:
      name: triple Right Click
      description: triple right click for devices with multiple buttons
      default: []
      selector:
        action: {}
    hold_right_action:
      name: Hold Right Action
      description: Hold right action for devices with multiple buttons
      default: []
      selector:
        action: {}
    release_right_action:
      name: Release Right Action
      description: Release right action for devices with multiple buttons
      default: []
      selector:
        action: {}
    single_both_action:
      name: Single Both Click
      description: Both click for devices with multiple buttons
      default: []
      selector:
        action: {}
    double_both_action:
      name: Double Both Click
      description: Double both click for devices with multiple buttons
      default: []
      selector:
        action: {}
    triple_both_action:
      name: triple Both Click
      description: triple both click for devices with multiple buttons
      default: []
      selector:
        action: {}
    hold_both_action:
      name: Hold Both Action
      description: Hold both action for devices with multiple buttons
      default: []
      selector:
        action: {}
    release_both_action:
      name: Release Both Action
      description: Release both action for devices with multiple buttons
      default: []
      selector:
        action: {}
  source_url: https://community.home-assistant.io/t/aqara-buttons-all-in-one-zigbee2mqtt/268717
mode: !input mode
max_exceeded: silent
trigger:
  - platform: mqtt
    topic: zigbee2mqtt/+/action
variables:
  device_name: !input zigbee_device
  expected_topic: zigbee2mqtt/{{ device_attr(device_name, 'name') }}/action
condition:
  - condition: template
    value_template: "{{ trigger.topic == expected_topic }}"
action:
  - variables:
      command: "{{ trigger.payload }}"
  - choose:
    - conditions: '{{ command == ''single'' }}'
      sequence: !input 'single_action'
    - conditions: '{{ command == ''double'' }}'
      sequence: !input 'double_action'
    - conditions: '{{ command == ''triple'' }}'
      sequence: !input 'triple_action'
    - conditions: '{{ command == ''quadruple'' }}'
      sequence: !input 'quadruple_action'
    - conditions: '{{ command == ''hold'' }}'
      sequence: !input 'hold_action'
    - conditions: '{{ command == ''release'' }}'
      sequence: !input 'release_action'
    - conditions: '{{ command == ''shake'' }}'
      sequence: !input 'shake_action'
    - conditions: '{{ command == ''single_left'' }}'
      sequence: !input 'single_left_action'
    - conditions: '{{ command == ''double_left'' }}'
      sequence: !input 'double_left_action'
    - conditions: '{{ command == ''triple_left'' }}'
      sequence: !input 'triple_left_action'
    - conditions: '{{ command == ''hold_left'' }}'
      sequence: !input 'hold_left_action'
    - conditions: '{{ command == ''release_left'' }}'
      sequence: !input 'release_left_action'
    - conditions: '{{ command == ''single_center'' }}'
      sequence: !input 'single_center_action'
    - conditions: '{{ command == ''double_center'' }}'
      sequence: !input 'double_center_action'
    - conditions: '{{ command == ''triple_center'' }}'
      sequence: !input 'triple_center_action'
    - conditions: '{{ command == ''hold_center'' }}'
      sequence: !input 'hold_center_action'
    - conditions: '{{ command == ''release_center'' }}'
      sequence: !input 'release_center_action'
    - conditions: '{{ command == ''single_right'' }}'
      sequence: !input 'single_right_action'
    - conditions: '{{ command == ''double_right'' }}'
      sequence: !input 'double_right_action'
    - conditions: '{{ command == ''triple_right'' }}'
      sequence: !input 'triple_right_action'
    - conditions: '{{ command == ''hold_right'' }}'
      sequence: !input 'hold_right_action'
    - conditions: '{{ command == ''release_right'' }}'
      sequence: !input 'release_right_action'
    - conditions: '{{ command == ''single_both'' }}'
      sequence: !input 'single_both_action'
    - conditions: '{{ command == ''double_both'' }}'
      sequence: !input 'double_both_action'
    - conditions: '{{ command == ''triple_both'' }}'
      sequence: !input 'triple_both_action'
    - conditions: '{{ command == ''hold_both'' }}'
      sequence: !input 'hold_both_action'
    - conditions: '{{ command == ''release_both'' }}'
      sequence: !input 'release_both_action'

Not sure if that helps until an official update come out.

1 Like

Seems good to me:
This should let you directly import @nwootton changes for this Aqara device:
Open your Home Assistant instance and show the blueprint import dialog with a specific blueprint pre-filled.

3 Likes

Works for me!! Thanks

Works, thanks.