Skip to content

Instantly share code, notes, and snippets.

@dreadfullyposh
Created February 5, 2021 14:31
Show Gist options
  • Save dreadfullyposh/440870c752ed1e3c1456b9ec43ebfb07 to your computer and use it in GitHub Desktop.
Save dreadfullyposh/440870c752ed1e3c1456b9ec43ebfb07 to your computer and use it in GitHub Desktop.
Home Assistant Single Automation for ZigBee devices that have multiple commands (e.g. buttons that support hold and double click)
alias: Aqara Button Handler
description: ''
trigger:
- platform: event
event_data:
device_ieee: '00:15:8d:00:06:36:dd:c1'
event_type: zha_event
condition: []
action:
- choose:
- conditions:
- condition: template
value_template: '{{ trigger.event.data.command == ''single'' }}'
sequence:
- choose:
- conditions:
- condition: state
entity_id: input_select.office_scene_selector
state: work
sequence:
- service: input_select.select_option
data:
option: none
entity_id: input_select.office_scene_selector
- conditions:
- condition: state
entity_id: input_select.office_scene_selector
state: none
sequence:
- service: input_select.select_option
data:
option: work
entity_id: input_select.office_scene_selector
default: []
- conditions:
- condition: template
value_template: '{{ trigger.event.data.command == ''hold'' }}'
sequence:
- choose:
- conditions:
- condition: state
entity_id: group.office_background_lights
state: 'on'
sequence:
- scene: scene.office_background_off
- conditions:
- condition: state
entity_id: group.office_background_lights
state: 'off'
sequence:
- scene: scene.office_bg_on
default: []
default: []
mode: single
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment