|
alias: smart_buttons |
|
description: >- |
|
Smart button eVatmaster Consulting ZG-101ZL / ZG-101ZE with Zigbee3 usage |
|
example. |
|
|
|
variables: |
|
# provide your buttons IDs here - you can catch their |
|
# events using "Events" part of developer tools. |
|
# Visit https://my.home-assistant.io/redirect/server_controls/ and then |
|
# subscribe to `zha_event` events and press buttons while they are connected to your Zigbee network |
|
button1: 934801333379f905e6a9ddcef85ddfbd |
|
button2: b225f5bb722ec6f7918ca08e9e9f428f |
|
|
|
mode: single |
|
|
|
triggers: |
|
- trigger: event |
|
event_type: zha_event |
|
id: zha_button |
|
conditions: |
|
- alias: Check device ID |
|
condition: or |
|
conditions: |
|
- condition: template |
|
value_template: "{{ trigger.event.data.device_id == button1 }}" |
|
alias: Device ID belongs to button1 |
|
- condition: template |
|
value_template: "{{ trigger.event.data.device_id == button2 }}" |
|
alias: Device ID belongs to button2 |
|
- condition: or |
|
alias: Check event command |
|
conditions: |
|
- condition: template |
|
value_template: "{{ trigger.event.data.command == 'off' }}" |
|
alias: Command is long press - off |
|
- condition: template |
|
value_template: "{{ trigger.event.data.command == 'on' }}" |
|
alias: Command is double press - on |
|
- condition: template |
|
value_template: "{{ trigger.event.data.command == 'toggle' }}" |
|
alias: Command is short press - toggle |
|
- condition: template |
|
value_template: "{{ trigger.event.data.command == 'step' }}" |
|
alias: Command is long press in different mode - step |
|
|
|
actions: |
|
|
|
# handle button 1 |
|
- choose: |
|
- conditions: |
|
- condition: template |
|
value_template: >- |
|
{{ trigger.event.data.device_id == button1 and |
|
trigger.event.data.command == 'toggle' }} |
|
sequence: |
|
- action: notify.persistent_notification |
|
metadata: {} |
|
data: |
|
message: Button 1 is pressed 1 time - toggled! |
|
alias: Button 1 is pressed 1 time - toggled! |
|
- conditions: |
|
- condition: template |
|
value_template: >- |
|
{{ trigger.event.data.device_id == button1 and |
|
trigger.event.data.command == 'on' }} |
|
sequence: |
|
- action: notify.persistent_notification |
|
metadata: {} |
|
data: |
|
message: Button 1 is pressed 2 times - turning on! |
|
alias: Button 1 is pressed 2 times - turning on! |
|
- conditions: |
|
- condition: template |
|
value_template: >- |
|
{{ trigger.event.data.device_id == button1 and |
|
trigger.event.data.command == 'off' }} |
|
sequence: |
|
- action: notify.persistent_notification |
|
metadata: {} |
|
data: |
|
message: Button 1 is pressed for 3 seconds - turning off! |
|
alias: Button 1 is pressed for 3 seconds - turning off! |
|
|
|
# handle button 2 |
|
- conditions: |
|
- condition: template |
|
value_template: >- |
|
{{ trigger.event.data.device_id == button2 and |
|
trigger.event.data.command == 'toggle' }} |
|
sequence: |
|
- action: notify.persistent_notification |
|
metadata: {} |
|
data: |
|
message: Button 2 is pressed 1 time - toggled! |
|
alias: Button 2 is pressed 1 time - toggled! |
|
- conditions: |
|
- condition: template |
|
value_template: >- |
|
{{ trigger.event.data.device_id == button2 and |
|
trigger.event.data.command == 'on' }} |
|
sequence: |
|
- action: notify.persistent_notification |
|
metadata: {} |
|
data: |
|
message: Button 2 is pressed 2 times - turning on! |
|
alias: Button 2 is pressed 2 times - turning on! |
|
- conditions: |
|
- condition: template |
|
value_template: >- |
|
{{ trigger.event.data.device_id == button2 and |
|
trigger.event.data.command == 'off' }} |
|
sequence: |
|
- action: notify.persistent_notification |
|
metadata: {} |
|
data: |
|
message: Button 3 is pressed for 3 seconds - turning off! |
|
alias: Button 3 is pressed for 3 seconds - turning off! |
|
default: |
|
- action: persistent_notification.create |
|
metadata: {} |
|
data: |
|
message: >- |
|
Device {{ trigger.event.data.device_id }} sends command {{ trigger.event.data.command }}. |