Skip to content

Instantly share code, notes, and snippets.

@FloppyGit
Last active January 22, 2025 08:30
Show Gist options
  • Save FloppyGit/b2f5eb6737d40a36aeac512eed1e4caa to your computer and use it in GitHub Desktop.
Save FloppyGit/b2f5eb6737d40a36aeac512eed1e4caa to your computer and use it in GitHub Desktop.
Aqara Opple 6 Button Remote 3 bands (WXCJKG13LM) via Zigbee2MQTT [Z2M]
blueprint:
name: Aqara Opple switch 3 bands via zigbee2mqtt
description: "Control anything you want with Aqara Opple switch 3 bands (6 buttons) (WXCJKG13LM)\n
\ Each band button has single, double, triple, hold & release.\n
\ Updated to breaking changes with Z2M v2. You have to reselect your device.\n Credits:\n
\ - @bouyssic created with 4-Button https://community.home-assistant.io/t/z2m-aqara-opple-4-boutons-blueprint-wxcjkg12lm/279950\n
\ - @shaxs adapted to 6-Button https://github.com/shaxs/-Z2M-Aqara-Opple-6-button-blueprint-WXCJKG12LM-for-HA/blob/56cb6afa3e631fc6d8a36aa3c871e63b544bbc39/opple6button.yaml\n
\ - @iynaix bugfix mode https://github.com/shaxs/-Z2M-Aqara-Opple-6-button-blueprint-WXCJKG12LM-for-HA/pull/1
\ \n - @calcubot5000 cleanup https://community.home-assistant.io/t/zigbee2mqtt-z2m-aqara-opple-6-button-remote-3-bands-wxcjkg13lm/391475/7\n\n
\ Switch Button Layout (little dot lower left). Switch could be rotated like
you want:\n .---.---.---.\n | 2 | 4 | 6 |\n | | | |\n
\ |.1 | 3 | 5 |\n '*--'---'---'\n "
domain: automation
input:
aqara_switch:
name: Aqara switch
description: Aqara switch to use
selector:
device:
entity:
integration: mqtt
filter:
manufacturer: Aqara
multiple: false
button_1_single:
name: Button 1 - Single Click
description: Action to run after single click of button 1
default: []
selector:
action: {}
button_1_double:
name: Button 1 - Double click
description: Action to run after double click of button 1
default: []
selector:
action: {}
button_1_triple:
name: Button 1 - Triple Click
description: Action to run after triple click of button 1
default: []
selector:
action: {}
button_1_hold:
name: Button 1 - Hold Down
description: Action to run on holding down button 1
default: []
selector:
action: {}
button_1_release:
name: Button 1 - Release after Hold
description: Action to run after releasing button 1
default: []
selector:
action: {}
button_2_single:
name: Button 2 - Single Click
description: Action to run after single click of button 2
default: []
selector:
action: {}
button_2_double:
name: Button 2 - Double click
description: Action to run after double click of button 2
default: []
selector:
action: {}
button_2_triple:
name: Button 2 - Triple Click
description: Action to run after triple click of button 2
default: []
selector:
action: {}
button_2_hold:
name: Button 2 - Hold Down
description: Action to run on holding down button 2
default: []
selector:
action: {}
button_2_release:
name: Button 2 - Release after Hold
description: Action to run after releasing button 2
default: []
selector:
action: {}
button_3_single:
name: Button 3 - Single Click
description: Action to run after single click of button 3
default: []
selector:
action: {}
button_3_double:
name: Button 3 - Double click
description: Action to run after double click of button 3
default: []
selector:
action: {}
button_3_triple:
name: Button 3 - Triple Click
description: Action to run after triple click of button 3
default: []
selector:
action: {}
button_3_hold:
name: Button 3 - Hold Down
description: Action to run on holding down button 3
default: []
selector:
action: {}
button_3_release:
name: Button 3 - Release after Hold
description: Action to run after releasing button 3
default: []
selector:
action: {}
button_4_single:
name: Button 4 - Single Click
description: Action to run after single click of button 4
default: []
selector:
action: {}
button_4_double:
name: Button 4 - Double click
description: Action to run after double click of button 4
default: []
selector:
action: {}
button_4_triple:
name: Button 4 - Triple Click
description: Action to run after triple click of button 4
default: []
selector:
action: {}
button_4_hold:
name: Button 4 - Hold Down
description: Action to run on holding down button 4
default: []
selector:
action: {}
button_4_release:
name: Button 4 - Release after Hold
description: Action to run after releasing button 4
default: []
selector:
action: {}
button_5_single:
name: Button 5 - Single Click
description: Action to run after single click of button 5
default: []
selector:
action: {}
button_5_double:
name: Button 5 - Double click
description: Action to run after double click of button 5
default: []
selector:
action: {}
button_5_triple:
name: Button 5 - Triple Click
description: Action to run after triple click of button 5
default: []
selector:
action: {}
button_5_hold:
name: Button 5 - Hold Down
description: Action to run on holding down button 5
default: []
selector:
action: {}
button_5_release:
name: Button 5 - Release after Hold
description: Action to run after releasing button 5
default: []
selector:
action: {}
button_6_single:
name: Button 6 - Single Click
description: Action to run after single click of button 6
default: []
selector:
action: {}
button_6_double:
name: Button 6 - Double click
description: Action to run after double click of button 6
default: []
selector:
action: {}
button_6_triple:
name: Button 6 - Triple Click
description: Action to run after triple click of button 6
default: []
selector:
action: {}
button_6_hold:
name: Button 6 - Hold Down
description: Action to run on holding down button 6
default: []
selector:
action: {}
button_6_release:
name: Button 6 - Release after Hold
description: Action to run after releasing button 6
default: []
selector:
action: {}
source_url: https://gist.github.com/FloppyGit/b2f5eb6737d40a36aeac512eed1e4caa
mode: parallel
max_exceeded: silent
trigger:
- domain: mqtt
trigger: device
device_id: !input aqara_switch
type: action
subtype: button_1_single
id: button_1_single
- domain: mqtt
trigger: device
device_id: !input aqara_switch
type: action
subtype: button_1_double
id: button_1_double
- domain: mqtt
trigger: device
device_id: !input aqara_switch
type: action
subtype: button_1_triple
id: button_1_triple
- domain: mqtt
trigger: device
device_id: !input aqara_switch
type: action
subtype: button_1_hold
id: button_1_hold
- domain: mqtt
trigger: device
device_id: !input aqara_switch
type: action
subtype: button_1_release
id: button_1_release
- domain: mqtt
trigger: device
device_id: !input aqara_switch
type: action
subtype: button_2_single
id: button_2_single
- domain: mqtt
trigger: device
device_id: !input aqara_switch
type: action
subtype: button_2_double
id: button_2_double
- domain: mqtt
trigger: device
device_id: !input aqara_switch
type: action
subtype: button_2_triple
id: button_2_triple
- domain: mqtt
trigger: device
device_id: !input aqara_switch
type: action
subtype: button_2_hold
id: button_2_hold
- domain: mqtt
trigger: device
device_id: !input aqara_switch
type: action
subtype: button_2_release
id: button_2_release
- domain: mqtt
trigger: device
device_id: !input aqara_switch
type: action
subtype: button_3_single
id: button_3_single
- domain: mqtt
trigger: device
device_id: !input aqara_switch
type: action
subtype: button_3_double
id: button_3_double
- domain: mqtt
trigger: device
device_id: !input aqara_switch
type: action
subtype: button_3_triple
id: button_3_triple
- domain: mqtt
trigger: device
device_id: !input aqara_switch
type: action
subtype: button_3_hold
id: button_3_hold
- domain: mqtt
trigger: device
device_id: !input aqara_switch
type: action
subtype: button_3_release
id: button_3_release
- domain: mqtt
trigger: device
device_id: !input aqara_switch
type: action
subtype: button_4_single
id: button_4_single
- domain: mqtt
trigger: device
device_id: !input aqara_switch
type: action
subtype: button_4_double
id: button_4_double
- domain: mqtt
trigger: device
device_id: !input aqara_switch
type: action
subtype: button_4_triple
id: button_4_triple
- domain: mqtt
trigger: device
device_id: !input aqara_switch
type: action
subtype: button_4_hold
id: button_4_hold
- domain: mqtt
trigger: device
device_id: !input aqara_switch
type: action
subtype: button_4_release
id: button_4_release
- domain: mqtt
trigger: device
device_id: !input aqara_switch
type: action
subtype: button_5_single
id: button_5_single
- domain: mqtt
trigger: device
device_id: !input aqara_switch
type: action
subtype: button_5_double
id: button_5_double
- domain: mqtt
trigger: device
device_id: !input aqara_switch
type: action
subtype: button_5_triple
id: button_5_triple
- domain: mqtt
trigger: device
device_id: !input aqara_switch
type: action
subtype: button_5_hold
id: button_5_hold
- domain: mqtt
trigger: device
device_id: !input aqara_switch
type: action
subtype: button_5_release
id: button_5_release
- domain: mqtt
trigger: device
device_id: !input aqara_switch
type: action
subtype: button_6_single
id: button_6_single
- domain: mqtt
trigger: device
device_id: !input aqara_switch
type: action
subtype: button_6_double
id: button_6_double
- domain: mqtt
trigger: device
device_id: !input aqara_switch
type: action
subtype: button_6_triple
id: button_6_triple
- domain: mqtt
trigger: device
device_id: !input aqara_switch
type: action
subtype: button_6_hold
id: button_6_hold
- domain: mqtt
trigger: device
device_id: !input aqara_switch
type: action
subtype: button_6_release
id: button_6_release
condition:
condition: template
value_template: '{{ trigger.id in ( ''button_1_single'', ''button_1_double'',
''button_1_triple'', ''button_1_hold'', ''button_1_release'', ''button_2_single'',
''button_2_double'', ''button_2_triple'', ''button_2_hold'', ''button_2_release'',
''button_3_single'', ''button_3_double'', ''button_3_triple'', ''button_3_hold'',
''button_3_release'', ''button_4_single'', ''button_4_double'', ''button_4_triple'',
''button_4_hold'', ''button_4_release'', ''button_5_single'', ''button_5_double'',
''button_5_triple'', ''button_5_hold'', ''button_5_release'', ''button_6_single'',
''button_6_double'', ''button_6_triple'', ''button_6_hold'', ''button_6_release''
) }}'
action:
- variables:
command: '{{ trigger.id }}'
- 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
@svenove
Copy link

svenove commented May 11, 2024

What entity should I select? All I have is “battery” and “power outage count”… or do I need to change operation mode from “event” to “command”?

@dirstel
Copy link

dirstel commented Dec 3, 2024

For me it's the same: nothing to select - maybe this is related to ha-legacy attributes in Zigbee2MQTT? When building my own automation (without blueprint) I'm able to select a corresponding trigger:

domain: mqtt
device_id: 54754fdd2b0d4fa1570dca9dbdbc0306
type: action
subtype: button_1_single
trigger: device

@FloppyGit
Copy link
Author

Updated because zigbee2mqtt has release some breaking changes with there version 2.0.
After updating you have to reselect your device (= your 3 band switch). The Selector-Filter is now wider, so you should have your device listed.

@dirstel
Copy link

dirstel commented Jan 7, 2025

@FloppyGit: updated and everything works fine. thanks a lot.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment