From 79c5d645c2ab885199b5b5b1f498da2056ef2dd8 Mon Sep 17 00:00:00 2001 From: Nuno Godinho Date: Sat, 12 Apr 2025 13:45:07 +0100 Subject: [PATCH] Add suport for hold event in Opple WXCJKG13LM For some reason, the `hold` event is commont to all buttons. This is reported here: https://github.com/Koenkk/zigbee2mqtt/issues/25057 Fortunately, the `hold` event still provides property `button: button_X` which can be used to distinguish which button actually triggered it. This commit implements it. --- Different_switches_zigbee2mqtt.yaml | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/Different_switches_zigbee2mqtt.yaml b/Different_switches_zigbee2mqtt.yaml index b37253b..a273c7e 100644 --- a/Different_switches_zigbee2mqtt.yaml +++ b/Different_switches_zigbee2mqtt.yaml @@ -5,7 +5,7 @@ blueprint: description: >-

🔔 Switches!!

- Version 0.91 Beta | 🔗 Github Link | 💬 Community Topic + Version 0.92 Beta | 🔗 Github Link | 💬 Community Topic

Control any switch you want from different brands and models. Goal is to support as much as possible. @@ -20,6 +20,7 @@ blueprint: 20250221: triple,quadruple,many added for WXKG01LM 20250221: triple,quadruple,many added for WXKG01LM 20250111: Ikea added + 20250412: Added support for WXCJKG13LM to distinguish which button triggers a hold event ***Compatibility list:*** Aqara: Aqara (double) rocker, WXKG07LM, WXKG15LM @@ -747,6 +748,7 @@ condition: action: - variables: command: '{{ trigger.to_state.attributes.event_type }}' + button_attribute: '{{ trigger.to_state.attributes.get("button", "none") }}' - choose: - conditions: - '{{ command == ''on'' }}' @@ -811,9 +813,6 @@ action: - conditions: - '{{ command == ''double'' }}' sequence: !input double - - conditions: - - '{{ command == ''hold'' }}' - sequence: !input hold - conditions: - '{{ command == ''triple'' }}' sequence: !input triple @@ -914,22 +913,25 @@ action: - '{{ command == ''button_6_triple'' }}' sequence: !input button_6_triple - conditions: - - '{{ command == ''button_1_hold'' }}' + - '{{ command == ''hold'' and (button_attribute == ''none'' or not button_attribute.startswith(''button_'')) }}' + sequence: !input hold + - conditions: + - '{{ command == ''hold'' and button_attribute == ''button_1'' }}' sequence: !input button_1_hold - conditions: - - '{{ command == ''button_2_hold'' }}' + - '{{ command == ''hold'' and button_attribute == ''button_2'' }}' sequence: !input button_2_hold - conditions: - - '{{ command == ''button_3_hold'' }}' + - '{{ command == ''hold'' and button_attribute == ''button_3'' }}' sequence: !input button_3_hold - conditions: - - '{{ command == ''button_4_hold'' }}' + - '{{ command == ''hold'' and button_attribute == ''button_4'' }}' sequence: !input button_4_hold - conditions: - - '{{ command == ''button_5_hold'' }}' + - '{{ command == ''hold'' and button_attribute == ''button_5'' }}' sequence: !input button_5_hold - conditions: - - '{{ command == ''button_6_hold'' }}' + - '{{ command == ''hold'' and button_attribute == ''button_6'' }}' sequence: !input button_6_hold - conditions: - '{{ command == ''button_1_release'' }}'