-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathSonoff_Button_Blueprint.yaml
82 lines (77 loc) · 2.53 KB
/
Sonoff_Button_Blueprint.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
blueprint:
name: Multi-Sonoff Button Multi-State Actions (Up to 3 Buttons)
description: "This Blueprint allows to easily program the different click options for the Sonoff button SNZB-01P\n\n
\n\n
Usage:\n
- Up to three different buttons can be added, and they all perform the same action for the different clicks\n
- You can define the actions for a single clicke, double click and long hold action.\n"
domain: automation
input:
button_1_device:
name: Button 1 Device
description: The first Sonoff button to monitor (required).
selector:
device:
button_2_device:
name: Button 2 Device
description: The second Sonoff button to monitor (optional).
selector:
device:
default: ""
button_3_device:
name: Button 3 Device
description: The third Sonoff button to monitor (optional).
selector:
device:
default: ""
single_click_action:
name: Single Click Action
description: Action to perform on single press.
selector:
action: {}
default: []
double_click_action:
name: Double Click Action
description: Action to perform on double press.
selector:
action: {}
default: []
long_hold_action:
name: Long Hold Action
description: Action to perform on long hold.
selector:
action: {}
default: []
trigger:
- platform: event
event_type: zha_event
event_data:
device_id: !input button_1_device
- platform: event
event_type: zha_event
event_data:
device_id: !input button_2_device
enabled: "{{ button_2_device != '' }}"
- platform: event
event_type: zha_event
event_data:
device_id: !input button_3_device
enabled: "{{ button_3_device != '' }}"
action:
#- service: notify.persistent_notification
# data:
# message: >
# Automation triggered by device: {{ trigger.event.data['device_id'] | default('Unknown Device ID') }}.
# Command: {{ trigger.event.data['command'] | default('Unknown Command') }}.
# Args: {{ trigger.event.data['args'] | default('No Args') }}.
# title: "Sonoff Button Debug"
- choose:
- conditions:
- "{{ trigger.event.data['command'] == 'toggle' }}"
sequence: !input single_click_action
- conditions:
- "{{ trigger.event.data['command'] == 'on' }}"
sequence: !input double_click_action
- conditions:
- "{{ trigger.event.data['command'] == 'off' }}"
sequence: !input long_hold_action