Zigbee2MQTT [Z2M] Aqara Opple 6 Button Remote 3 bands (WXCJKG13LM)

I was looking for a blank slate 6 button option for the Aqara Opple 6 button remote. I found @bouyssic 4 button one here and modified it to allow 6 buttons.

Can optionally get the yaml file here https://github.com/shaxs/-Z2M-Aqara-Opple-6-button-blueprint-WXCJKG12LM-for-HA/blob/56cb6afa3e631fc6d8a36aa3c871e63b544bbc39/opple6button.yaml

blueprint:
  name: Z2M - Aqara Opple switch 3 bands
  description:
    "Control anything you want with Aqara Opple switch 3 bands (WXCJKG13LM)

    Inspired by the blueprint of @bouyssic (https://community.home-assistant.io/t/z2m-aqara-opple-4-boutons-blueprint-wxcjkg12lm/279950)

    Each band button has single, double, triple, hold & release"
  domain: automation
  input:
    switch:
      name: Aqara switch
      description: Aqara switch to use
      selector:
        entity:
          domain: sensor
          integration: mqtt
    button_1_single:
      name: Button 1 - simple click
      description: Action to run on triple click of button 1
      default: []
      selector:
        action: null
    button_1_double:
      name: Button 1 - double click
      description: Action to run on triple click of button 1
      default: []
      selector:
        action: null
    button_1_triple:
      name: Button 1 - triple click
      description: Action to run on triple click of button 1
      default: []
      selector:
        action: null
    button_1_hold:
      name: Button 1 - hold click
      description: Action to run on triple click of button 1
      default: []
      selector:
        action: null
    button_1_release:
      name: Button 1 - on release
      description: Action to run after hold then release
      default: []
      selector:
        action: null
    button_2_single:
      name: Button 2 - single click
      description: Action to run on triple click of button 2
      default: []
      selector:
        action: null
    button_2_double:
      name: Button 2 - double click
      description: Action to run on triple click of button 2
      default: []
      selector:
        action: null
    button_2_triple:
      name: Button 2 - triple click
      description: Action to run on triple click of button 2
      default: []
      selector:
        action: null
    button_2_hold:
      name: Button 2 - hold click
      description: Action to run on triple click of button 2
      default: []
      selector:
        action: null
    button_2_release:
      name: Button 2 - on release
      description: Action to run after hold then release
      default: []
      selector:
        action: null
    button_3_single:
      name: Button 3 - simple click
      description: Action to run on triple click of button 3
      default: []
      selector:
        action: null
    button_3_double:
      name: Button 3 - double click
      description: Action to run on triple click of button 3
      default: []
      selector:
        action: null
    button_3_triple:
      name: Button 3 - triple click
      description: Action to run on triple click of button 3
      default: []
      selector:
        action: null
    button_3_hold:
      name: Button 3 - hold click
      description: Action to run on triple click of button 3
      default: []
      selector:
        action: null
    button_3_release:
      name: Button 3 - on release
      description: Action to run after hold then release
      default: []
      selector:
        action: null
    button_4_single:
      name: Button 4 - single click
      description: Action to run on triple click of button 4
      default: []
      selector:
        action: null
    button_4_double:
      name: Button 4 - double click
      description: Action to run on triple click of button 4
      default: []
      selector:
        action: null
    button_4_triple:
      name: Button 4 - triple click
      description: Action to run on triple click of button 4
      default: []
      selector:
        action: null
    button_4_hold:
      name: Button 4 - hold click
      description: Action to run on triple click of button 4
      default: []
      selector:
        action: null
    button_4_release:
      name: Button 4 - on release
      description: Action to run after hold then release
      default: []
      selector:
        action: null
    button_5_single:
      name: Button 5 - single click
      description: Action to run on triple click of button 5
      default: []
      selector:
        action: null
    button_5_double:
      name: Button 5 - double click
      description: Action to run on triple click of button 5
      default: []
      selector:
        action: null
    button_5_triple:
      name: Button 5 - triple click
      description: Action to run on triple click of button 5
      default: []
      selector:
        action: null
    button_5_hold:
      name: Button 5 - hold click
      description: Action to run on triple click of button 5
      default: []
      selector:
        action: null
    button_5_release:
      name: Button 5 - on release
      description: Action to run after hold then release
      default: []
      selector:
        action: null
    button_6_single:
      name: Button 6 - single click
      description: Action to run on triple click of button 6
      default: []
      selector:
        action: null
    button_6_double:
      name: Button 6 - double click
      description: Action to run on triple click of button 6
      default: []
      selector:
        action: null
    button_6_triple:
      name: Button 6 - triple click
      description: Action to run on triple click of button 6
      default: []
      selector:
        action: null
    button_6_hold:
      name: Button 6 - hold click
      description: Action to run on triple click of button 6
      default: []
      selector:
        action: null
    button_6_release:
      name: Button 6 - on release
      description: Action to run after hold then release
      default: []
      selector:
        action: null
# source_url: https://github.com/shaxs/-Z2M-Aqara-Opple-6-button-blueprint-WXCJKG12LM-for-HA/blob/56cb6afa3e631fc6d8a36aa3c871e63b544bbc39/opple6button.yaml
mode: restart
max_exceeded: silent
trigger:
  - platform: state
    entity_id: !input "switch"
    attribute: action
action:
  - variables:
      command: "{{ trigger.to_state.state }}"
  - choose:
      - conditions:
          - "{{ command == 'button_1_single' }}"
        sequence: !input "button_1_single"
      - conditions:
          - "{{ command == 'button_2_single' }}"
        sequence: !input "button_2_single"
      - conditions:
          - "{{ command == 'button_3_single' }}"
        sequence: !input "button_3_single"
      - conditions:
          - "{{ command == 'button_4_single' }}"
        sequence: !input "button_4_single"
      - conditions:
          - "{{ command == 'button_5_single' }}"
        sequence: !input "button_5_single"
      - conditions:
          - "{{ command == 'button_6_single' }}"
        sequence: !input "button_6_single"
      - conditions:
          - "{{ command == 'button_1_double' }}"
        sequence: !input "button_1_double"
      - conditions:
          - "{{ command == 'button_2_double' }}"
        sequence: !input "button_2_double"
      - conditions:
          - "{{ command == 'button_3_double' }}"
        sequence: !input "button_3_double"
      - conditions:
          - "{{ command == 'button_4_double' }}"
        sequence: !input "button_4_double"
      - conditions:
          - "{{ command == 'button_5_double' }}"
        sequence: !input "button_5_double"
      - conditions:
          - "{{ command == 'button_6_double' }}"
        sequence: !input "button_6_double"
      - conditions:
          - "{{ command == 'button_1_triple' }}"
        sequence: !input "button_1_triple"
      - conditions:
          - "{{ command == 'button_2_triple' }}"
        sequence: !input "button_2_triple"
      - conditions:
          - "{{ command == 'button_3_triple' }}"
        sequence: !input "button_3_triple"
      - conditions:
          - "{{ command == 'button_4_triple' }}"
        sequence: !input "button_4_triple"
      - conditions:
          - "{{ command == 'button_5_triple' }}"
        sequence: !input "button_5_triple"
      - conditions:
          - "{{ command == 'button_6_triple' }}"
        sequence: !input "button_6_triple"
      - conditions:
          - "{{ command == 'button_1_hold' }}"
        sequence: !input "button_1_hold"
      - conditions:
          - "{{ command == 'button_2_hold' }}"
        sequence: !input "button_2_hold"
      - conditions:
          - "{{ command == 'button_3_hold' }}"
        sequence: !input "button_3_hold"
      - conditions:
          - "{{ command == 'button_4_hold' }}"
        sequence: !input "button_4_hold"
      - conditions:
          - "{{ command == 'button_5_hold' }}"
        sequence: !input "button_5_hold"
      - conditions:
          - "{{ command == 'button_6_hold' }}"
        sequence: !input "button_6_hold"
      - conditions:
          - "{{ command == 'button_1_release' }}"
        sequence: !input "button_1_release"
      - conditions:
          - "{{ command == 'button_2_release' }}"
        sequence: !input "button_2_release"
      - conditions:
          - "{{ command == 'button_3_release' }}"
        sequence: !input "button_3_release"
      - conditions:
          - "{{ command == 'button_4_release' }}"
        sequence: !input "button_4_release"
      - conditions:
          - "{{ command == 'button_5_release' }}"
        sequence: !input "button_5_release"
      - conditions:
          - "{{ command == 'button_6_release' }}"
        sequence: !input "button_6_release"

4 Likes

Thank you for sharing!

For anyone having problems with this Blueprint not firing, I’ve discovered the problem. The automation has this as a trigger:

trigger:
  - platform: state
    entity_id: !input "switch"
    attribute: action

But (and I’m not sure if this is a change in zigbee2mqtt or HA since this blueprint was written), but the sensor attribute which changes state to mark the MQTT even doesn’t have and attribute called ‘action’; it only has a state. Therefore, the automation is watching a non-existent attribute and never fires.

Removing the attribute: action line makes the automation work.

3 Likes

If you want to stop the null triggers that occur to reset every button action from triggering the blueprint and spamming your log with errors, try this:

When adding more then one action to a button trigger, only the first action will be activated. Not sure if this is because of a (recent) change in HA or Z2M but I guess this is not by design?

yes, same Problem here :frowning:

I believe it’s happening because you’re receiving multiple trigger events, and every event after the first triggers the action to restart. If you change the mode: repeat line to instead be mode: single, that seems to fix it for me.

I took the liberty of fixing this up, including cleaning up some wording so it reads a little better. Here you go:

blueprint:
  name: Z2M - Aqara Opple 6-Button Switch
  description: 'Control anything using the Aqara Opple 6-button switch (WXCJKG13LM)

    Inspired by the blueprint of @bouyssic (https://community.home-assistant.io/t/z2m-aqara-opple-4-boutons-blueprint-wxcjkg12lm/279950)'
  domain: automation
  input:
    switch:
      name: Aqara switch
      description: Aqara switch to use
      selector:
        entity:
          domain: sensor
          integration: mqtt
          multiple: false
    button_1_single:
      name: Top Left Button - Single Click
      description: Action to run after single click of top left button
      default: []
      selector:
        action: {}
    button_1_double:
      name: Top Left Button - Double Click
      description: Action to run after double click of top left button
      default: []
      selector:
        action: {}
    button_1_triple:
      name: Top Left Button - Triple Click
      description: Action to run after triple click of top left button
      default: []
      selector:
        action: {}
    button_1_hold:
      name: Top Left Button - Hold
      description: Action to run after hold of top left button
      default: []
      selector:
        action: {}
    button_1_release:
      name: Top Left Button - Hold & Release
      description: Action to run after hold & release of top left button
      default: []
      selector:
        action: {}
    button_2_single:
      name: Top Right Button - Single Click
      description: Action to run after single click of top right button
      default: []
      selector:
        action: {}
    button_2_double:
      name: Top Right Button - Double Click
      description: Action to run after double click of top right button
      default: []
      selector:
        action: {}
    button_2_triple:
      name: Top Right Button - Triple Click
      description: Action to run after triple click of top right button
      default: []
      selector:
        action: {}
    button_2_hold:
      name: Top Right Button - Hold
      description: Action to run after hold of top right button
      default: []
      selector:
        action: {}
    button_2_release:
      name: Top Right Button - Hold & Release
      description: Action to run after hold & release of top right button
      default: []
      selector:
        action: {}
    button_3_single:
      name: Middle Left Button -  Single Click
      description: Action to run after single click of middle left button
      default: []
      selector:
        action: {}
    button_3_double:
      name: Middle Left Button -  Double Click
      description: Action to run after double click of middle left button
      default: []
      selector:
        action: {}
    button_3_triple:
      name: Middle Left Button -  Triple Click
      description: Action to run after triple click of middle left button
      default: []
      selector:
        action: {}
    button_3_hold:
      name: Middle Left Button -  Hold
      description: Action to run after hold of middle left button
      default: []
      selector:
        action: {}
    button_3_release:
      name: Middle Left Button -  Hold & Release
      description: Action to run after hold & release of middle left button
      default: []
      selector:
        action: {}
    button_4_single:
      name: Middle Right Button - Single Click
      description: Action to run after single click of middle right button
      default: []
      selector:
        action: {}
    button_4_double:
      name: Middle Right Button - Double Click
      description: Action to run after double click of middle right button
      default: []
      selector:
        action: {}
    button_4_triple:
      name: Middle Right Button - Triple Click
      description: Action to run after triple click of middle right button
      default: []
      selector:
        action: {}
    button_4_hold:
      name: Middle Right Button - Hold
      description: Action to run after hold of middle right button
      default: []
      selector:
        action: {}
    button_4_release:
      name: Middle Right Button - Hold & Release
      description: Action to run after hold & release of middle right button
      default: []
      selector:
        action: {}
    button_5_single:
      name: Bottom Left Button - Single Click
      description: Action to run after single click of bottom left button
      default: []
      selector:
        action: {}
    button_5_double:
      name: Bottom Left Button - Double Click
      description: Action to run after double click of bottom left button
      default: []
      selector:
        action: {}
    button_5_triple:
      name: Bottom Left Button - Triple Click
      description: Action to run after triple click of bottom left button
      default: []
      selector:
        action: {}
    button_5_hold:
      name: Bottom Left Button - Hold
      description: Action to run after hold of bottom left button
      default: []
      selector:
        action: {}
    button_5_release:
      name: Bottom Left Button - Hold & Release
      description: Action to run after hold & release of bottom left button
      default: []
      selector:
        action: {}
    button_6_single:
      name: Bottom Right Button - Single Click
      description: Action to run after single click of bottom right button
      default: []
      selector:
        action: {}
    button_6_double:
      name: Bottom Right Button - Double Click
      description: Action to run after double click of bottom right button
      default: []
      selector:
        action: {}
    button_6_triple:
      name: Bottom Right Button - Triple Click
      description: Action to run after triple click of bottom right button
      default: []
      selector:
        action: {}
    button_6_hold:
      name: Bottom Right Button - Hold
      description: Action to run after hold of bottom right button
      default: []
      selector:
        action: {}
    button_6_release:
      name: Bottom Right Button - Hold & Release
      description: Action to run after hold & release of bottom right button
      default: []
      selector:
        action: {}
  source_url: https://community.home-assistant.io/t/zigbee2mqtt-z2m-aqara-opple-6-button-remote-3-bands-wxcjkg13lm/391475
mode: single
max_exceeded: silent
trigger:
- platform: state
  entity_id: !input switch
  attribute: action
action:
- variables:
    command: '{{ trigger.to_state.state }}'
- choose:
  - conditions:
    - '{{ command == ''button_1_single'' }}'
    sequence: !input button_1_single
  - conditions:
    - '{{ command == ''button_2_single'' }}'
    sequence: !input button_2_single
  - conditions:
    - '{{ command == ''button_3_single'' }}'
    sequence: !input button_3_single
  - conditions:
    - '{{ command == ''button_4_single'' }}'
    sequence: !input button_4_single
  - conditions:
    - '{{ command == ''button_5_single'' }}'
    sequence: !input button_5_single
  - conditions:
    - '{{ command == ''button_6_single'' }}'
    sequence: !input button_6_single
  - conditions:
    - '{{ command == ''button_1_double'' }}'
    sequence: !input button_1_double
  - conditions:
    - '{{ command == ''button_2_double'' }}'
    sequence: !input button_2_double
  - conditions:
    - '{{ command == ''button_3_double'' }}'
    sequence: !input button_3_double
  - conditions:
    - '{{ command == ''button_4_double'' }}'
    sequence: !input button_4_double
  - conditions:
    - '{{ command == ''button_5_double'' }}'
    sequence: !input button_5_double
  - conditions:
    - '{{ command == ''button_6_double'' }}'
    sequence: !input button_6_double
  - conditions:
    - '{{ command == ''button_1_triple'' }}'
    sequence: !input button_1_triple
  - conditions:
    - '{{ command == ''button_2_triple'' }}'
    sequence: !input button_2_triple
  - conditions:
    - '{{ command == ''button_3_triple'' }}'
    sequence: !input button_3_triple
  - conditions:
    - '{{ command == ''button_4_triple'' }}'
    sequence: !input button_4_triple
  - conditions:
    - '{{ command == ''button_5_triple'' }}'
    sequence: !input button_5_triple
  - conditions:
    - '{{ command == ''button_6_triple'' }}'
    sequence: !input button_6_triple
  - conditions:
    - '{{ command == ''button_1_hold'' }}'
    sequence: !input button_1_hold
  - conditions:
    - '{{ command == ''button_2_hold'' }}'
    sequence: !input button_2_hold
  - conditions:
    - '{{ command == ''button_3_hold'' }}'
    sequence: !input button_3_hold
  - conditions:
    - '{{ command == ''button_4_hold'' }}'
    sequence: !input button_4_hold
  - conditions:
    - '{{ command == ''button_5_hold'' }}'
    sequence: !input button_5_hold
  - conditions:
    - '{{ command == ''button_6_hold'' }}'
    sequence: !input button_6_hold
  - conditions:
    - '{{ command == ''button_1_release'' }}'
    sequence: !input button_1_release
  - conditions:
    - '{{ command == ''button_2_release'' }}'
    sequence: !input button_2_release
  - conditions:
    - '{{ command == ''button_3_release'' }}'
    sequence: !input button_3_release
  - conditions:
    - '{{ command == ''button_4_release'' }}'
    sequence: !input button_4_release
  - conditions:
    - '{{ command == ''button_5_release'' }}'
    sequence: !input button_5_release
  - conditions:
    - '{{ command == ''button_6_release'' }}'
    sequence: !input button_6_release
2 Likes

Thanks @thecowan ! That solved my problem!

Hi Everyone sorry for no reply to this. I also am sorry this isn’t working for some. I am a complete novice when it comes to HA and while this worked for me, looks like it didn’t for others. Looks like I need to go through and update the first post with the fix.