-
Notifications
You must be signed in to change notification settings - Fork 0
/
tuya_4_gang_remote.yaml
176 lines (174 loc) · 4.75 KB
/
tuya_4_gang_remote.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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
blueprint:
name: ZHA - Tuya Portable Remote
description: 'Control anything with a Tuya Portable Remote.
You can set functions for a single press, double press and long press of each of the four buttons. This allows you to assign,
e.g., a scene or anything else.'
domain: automation
input:
remote:
name: Remote
description: Tuya Portable Remote to use
selector:
device:
filter:
- model: TS0041
- model: TS0042
- model: TS0043
- model: TS0044
integration: zha
multiple: true
single_press_1:
name: Single press button 1
description: Action to run on single press of button 1
default: []
selector:
action: {}
double_press_1:
name: Double press button 1
description: Action to run on double press of button 1
default: []
selector:
action: {}
long_press_1:
name: Long press button 1
description: Action to run on long press of button 1
default: []
selector:
action: {}
single_press_2:
name: Single press button 2
description: Action to run on single press of button 2
default: []
selector:
action: {}
double_press_2:
name: Double press button 2
description: Action to run on double press of button 2
default: []
selector:
action: {}
long_press_2:
name: Long press button 2
description: Action to run on long press of button 2
default: []
selector:
action: {}
single_press_3:
name: Single press button 3
description: Action to run on single press of button 3
default: []
selector:
action: {}
double_press_3:
name: Double press button 3
description: Action to run on double press of button 3
default: []
selector:
action: {}
long_press_3:
name: Long press button 3
description: Action to run on long press of button 3
default: []
selector:
action: {}
single_press_4:
name: Single press button 4
description: Action to run on single press of button 4
default: []
selector:
action: {}
double_press_4:
name: Double press button 4
description: Action to run on double press of button 4
default: []
selector:
action: {}
long_press_4:
name: Long press button 4
description: Action to run on long press of button 4
default: []
selector:
action: {}
source_url: https://gist.github.com/akloeckner/6d0fd98dd59e250b2a9f29b4801eb960
mode: restart
max_exceeded: silent
trigger:
- platform: event
event_type: zha_event
event_data:
cluster_id: 6
condition:
- "{{ trigger.event.data.device_id in remote }}"
variables:
remote: !input 'remote'
endpoint_id: '{{ trigger.event.data.endpoint_id }}'
command: '{{ trigger.event.data.command }}'
short_press: >
{{
command == 'remote_button_short_press' or
command == 'press_type' and trigger.event.data.params.press_type == 0
}}
double_press: >
{{
command == 'remote_button_double_press' or
command == 'press_type' and trigger.event.data.params.press_type == 1
}}
long_press: >
{{
command == 'remote_button_long_press' or
command == 'press_type' and trigger.event.data.params.press_type == 2
}}
action:
- choose:
- conditions:
- '{{ endpoint_id == 1 }}'
sequence:
- choose:
- conditions:
- '{{ short_press }}'
sequence: !input 'single_press_1'
- conditions:
- '{{ double_press }}'
sequence: !input 'double_press_1'
- conditions:
- '{{ long_press }}'
sequence: !input 'long_press_1'
- conditions:
- '{{ endpoint_id == 2 }}'
sequence:
- choose:
- conditions:
- '{{ short_press }}'
sequence: !input 'single_press_2'
- conditions:
- '{{ double_press }}'
sequence: !input 'double_press_2'
- conditions:
- '{{ long_press }}'
sequence: !input 'long_press_2'
- conditions:
- '{{ endpoint_id == 3 }}'
sequence:
- choose:
- conditions:
- '{{ short_press }}'
sequence: !input 'single_press_3'
- conditions:
- '{{ double_press }}'
sequence: !input 'double_press_3'
- conditions:
- '{{ long_press }}'
sequence: !input 'long_press_3'
- conditions:
- '{{ endpoint_id == 4 }}'
sequence:
- choose:
- conditions:
- '{{ short_press }}'
sequence: !input 'single_press_4'
- conditions:
- '{{ double_press }}'
sequence: !input 'double_press_4'
- conditions:
- '{{ long_press }}'
sequence: !input 'long_press_4'