Skip to content

Instantly share code, notes, and snippets.

@Raphael909
Last active December 29, 2020 20:34
Show Gist options
  • Save Raphael909/357a907a0ce8577203c17d9a3b08bab6 to your computer and use it in GitHub Desktop.
Save Raphael909/357a907a0ce8577203c17d9a3b08bab6 to your computer and use it in GitHub Desktop.
Blueprint Aqara wireless switch
blueprint:
name: ZHA - Aqara Wireless Remote Switch
description: Automate your Xiaomi Aqara Wireless Remote Switch using ZHA events.
domain: automation
input:
aqara_mini_switch:
name: Aqara Wireless Switch
description: Aqara Wireless Switch to use
selector:
device:
integration: zha
manufacturer: LUMI
model: lumi.sensor_switch.aq2
remote_button_short_press:
name: Single Press
description: Action to run on single press
default: []
selector:
action:
remote_button_double_press:
name: Double Press
description: Action to run on double press
default: []
selector:
action:
remote_button_triple_press:
name: Triple Press
description: Action to run on triple press
default: []
selector:
action:
remote_button_quadruple_press:
name: Quadruple Press
description: Action to run on quadruple press
default: []
selector:
action:
remote_button_multiple_press:
name: Multiple Press
description: Action to run on multiple press
default: []
selector:
action:
mode: single
max_exceeded: silent
trigger:
- platform: event
event_type: zha_event
event_data:
device_id: !input aqara_mini_switch
action:
- variables:
command: "{{ trigger.event.data.command }}"
click_count: "{{ trigger.event.data.args.value }}"
- choose:
- conditions:
- "{{ command == 'attribute_updated' }}"
- "{{ click_count == 2 }}"
sequence: !input remote_button_double_press
- conditions:
- "{{ command == 'attribute_updated' }}"
- "{{ click_count == 3 }}"
sequence: !input remote_button_triple_press
- conditions:
- "{{ command == 'attribute_updated' }}"
- "{{ click_count == 4 }}"
sequence: !input remote_button_quadruple_press
- conditions:
- "{{ command == 'attribute_updated' }}"
sequence: !input remote_button_short_press
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment