Last active
March 20, 2024 11:46
-
-
Save rhl2401/871cdc129c2d61f894407bef4b44f07d to your computer and use it in GitHub Desktop.
Aqara Wireless Switch (single, double, hold)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
blueprint: | |
name: Aqara Wireless Switch (single, double, hold, release) | |
description: 'Control anything using Aqara Wireless Switch. | |
Customizable actions for each press. | |
This version of the blueprint is for buttons supporting single, double, hold and | |
release actions. ' | |
domain: automation | |
input: | |
action_sensor: | |
name: Action Sensor | |
description: Zigbee2mqtt action sensor | |
selector: | |
entity: | |
integration: mqtt | |
domain: sensor | |
multiple: false | |
press_single: | |
name: Single button press | |
description: Action to run on single button press | |
default: [] | |
selector: | |
action: {} | |
press_double: | |
name: Double button press | |
description: Action to run on double button press | |
default: [] | |
selector: | |
action: {} | |
press_hold: | |
name: Button hold | |
description: Action to run on hold | |
default: [] | |
selector: | |
action: {} | |
press_release: | |
name: Button release | |
description: Action to run on release | |
default: [] | |
selector: | |
action: {} | |
mode: restart | |
max_exceeded: silent | |
trigger: | |
platform: state | |
entity_id: !input action_sensor | |
condition: | |
- condition: template | |
value_template: '{{ (trigger.to_state.attributes.action if trigger.to_state.state == "" | |
else trigger.to_state.state) in ("single","double","hold","release") | |
}}' | |
action: | |
- variables: | |
command: '{{ trigger.to_state.attributes.action if trigger.to_state.state == "" | |
else trigger.to_state.state }}' | |
- choose: | |
- conditions: | |
- '{{ command == ''single'' }}' | |
sequence: !input press_single | |
- conditions: | |
- '{{ command == ''double'' }}' | |
sequence: !input press_double | |
- conditions: | |
- '{{ command == ''hold'' }}' | |
sequence: !input press_hold | |
- conditions: | |
- '{{ command == ''release'' }}' | |
sequence: !input press_release |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I made some changes in Z2M and now your blueprint does not work for me anymore. I had actually an older version of your blueprint, Instead of input: action_sensor: I think my copy used a switch as input. Anyway, this current version here does not "see" my WXKG11LM
I click "create automation" next to your blueprint and it cannot find any matching entity. If I type my friendly name of my WXKG11LM I am only presented with these entities:
Any idea what the problem could be? The changes I made to Z2M were to turn off all legacy options I could find. For mqtt as well as for HA and the WXKG11LM has it legacy option turned off: