-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPTM_215Z_ZE_v2.yaml
255 lines (253 loc) · 9.06 KB
/
PTM_215Z_ZE_v2.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
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
blueprint:
homeassistant:
min_version: 2024.10.0
name: EnOcean PTM 215Z/ZE (MQTT trigger) (v2)
description: |
Controller automation for executing **press/hold/release** after hold actions triggered by EnOcean PTM 215Z/ZE switch.
**Elapsed** has to be enabled in Zigbee2mqtt (Settings --> Advanced).
ℹ️ Version 2025.02.12
domain: automation
input:
controller:
name: (Required) Controller Name
description: The name of the controller as defined in z2m (e.g. Livingroom Switch)
default: []
base_topic:
name: (Required) Base mqtt topic
description: The base topic as configured in z2m
default: zigbee2mqtt
hold_delay:
name: (Required) Hold delay
description: If the button has been held more than the configured Hold delay, the corresponding held action is triggered.
default: 500
selector:
number:
min: 100.0
max: 1000.0
unit_of_measurement: milliseconds
mode: box
step: 10.0
button_1_pressed:
name: Button 1 Pressed
description: Action to run, when button 1 is pressed.
default: []
selector:
action: {}
button_1_held:
name: Button 1 Held
description: Action to run, when the button 1 is held.
default: []
selector:
action: {}
button_1_released:
name: Button 1 Released
description: Action to run, when the button 1 is released after long press.
default: []
selector:
action: {}
button_2_pressed:
name: Button 2 Pressed
description: Action to run, when the button 2 pressed.
default: []
selector:
action: {}
button_2_held:
name: Button 2 Held
description: Action to run, when the button 2 is held.
default: []
selector:
action: {}
button_2_released:
name: Button 2 Released
description: Action to run, when the button 2 is released after long press.
default: []
selector:
action: {}
button_3_pressed:
name: Button 3 Pressed
description: Action to run, when the button 3 is pressed.
default: []
selector:
action: {}
button_3_held:
name: Button 3 Held
description: Action to run, when the button 3 is held.
default: []
selector:
action: {}
button_3_released:
name: Button 3 Released
description: Action to run, when the button 3 is released after long press.
default: []
selector:
action: {}
button_4_pressed:
name: Button 4 Pressed
description: Action to run, when the button 4 is pressed.
default: []
selector:
action: {}
button_4_held:
name: Button 4 Held
description: Action to run, when the button 4 is held.
default: []
selector:
action: {}
button_4_released:
name: Button 4 Released
description: Action to run, when the button 4 is released after long press.
default: []
selector:
action: {}
button_1_and_3_pressed:
name: Buttons 1 and 3 Pressed
description: Action to run, when buttons 1 and 3 are pressed.
default: []
selector:
action: {}
button_1_and_3_held:
name: Buttons 1 and 3 Held
description: Action to run, when buttons 1 and 3 are held.
default: []
selector:
action: {}
button_1_and_3_released:
name: Buttons 1 and 3 Released
description: Action to run, when buttons 1 and 3 are released after long press.
default: []
selector:
action: {}
button_2_and_4_pressed:
name: Buttons 2 and 4 Pressed
description: Action to run, when buttons 2 and 4 are pressed.
default: []
selector:
action: {}
button_2_and_4_held:
name: Buttons 2 and 4 Held
description: Action to run, when buttons 2 and 4 are held.
default: []
selector:
action: {}
button_2_and_4_released:
name: Buttons 2 and 4 Released
description: Action to run, when buttons 2 and 4 are released after long press.
default: []
selector:
action: {}
#### PTM215ZE only
button_1_and_4_pressed:
name: PTM215ZE ONLY - Buttons 1 and 4 Pressed
description: Action to run, when buttons 1 and 4 are pressed.
default: []
selector:
action: {}
button_1_and_4_held:
name: PTM215ZE ONLY - Buttons 1 and 4 Held
description: Action to run, when buttons 1 and 4 are held.
default: []
selector:
action: {}
button_1_and_4_released:
name: PTM215ZE ONLY - Button 1 and 4 Released
description: Action to run, when buttons 1 and 4 are released after long press.
default: []
selector:
action: {}
button_2_and_3_pressed:
name: PTM215ZE ONLY - Buttons 2 and 3 Pressed
description: Action to run, when buttons 2 and 3 are pressed.
default: []
selector:
action: {}
button_2_and_3_held:
name: PTM215ZE ONLY - Buttons 2 and 3 Held
description: Action to run, when buttons 2 and 3 are held.
default: []
selector:
action: {}
button_2_and_3_released:
name: PTM215ZE ONLY - Buttons 2 and 3 Released
description: Action to run, when buttons 2 and 3 are released after long press.
default: []
selector:
action: {}
source_url: https://github.com/chris-1243/HA---Blueprint/blob/main/PTM_215Z_ZE_v2.yaml
mode: restart
max_exceeded: silent
variables:
hold_delay: !input hold_delay
trigger_variables:
base_topic: !input base_topic
controller: !input controller
triggers:
- trigger: mqtt
topic: '{{ base_topic ~ "/" ~ controller }}'
conditions:
and:
- '{{ trigger.payload_json.action is defined }}'
- '{{ trigger.payload_json.action.split("_", 1)[0] in ("press", "release") }}'
actions:
- variables:
command: '{{ trigger.payload_json.action }}'
- choose:
- conditions: '{{ "press" | string in command }}'
sequence:
- delay:
milliseconds: !input "hold_delay"
- choose:
- conditions: '{{ command == "press_1" }}'
sequence: !input button_1_held
- conditions: '{{ command == "press_2" }}'
sequence: !input button_2_held
- conditions: '{{ command == "press_3" }}'
sequence: !input button_3_held
- conditions: '{{ command == "press_4" }}'
sequence: !input button_4_held
- conditions: '{{ command == "press_1_and_3" }}'
sequence: !input button_1_and_3_held
- conditions: '{{ command == "press_2_and_4" }}'
sequence: !input button_2_and_4_held
- conditions: '{{ command == "press_1_and_4" }}'
sequence: !input button_1_and_4_held
- conditions: '{{ command == "press_2_and_3" }}'
sequence: !input button_2_and_3_held
- conditions: '{{ "release" in command }}'
sequence:
- if: '{{ trigger.payload_json.elapsed | int > hold_delay }}'
then:
- choose:
- conditions: '{{ command == "release_1" }}'
sequence: !input button_1_released
- conditions: '{{ command == "release_2" }}'
sequence: !input button_2_released
- conditions: '{{ command == "release_3" }}'
sequence: !input button_3_released
- conditions: '{{ command == "release_4" }}'
sequence: !input button_4_released
- conditions: '{{ command == "release_1_and_3" }}'
sequence: !input button_1_and_3_released
- conditions: '{{ command == "release_2_and_4" }}'
sequence: !input button_2_and_4_released
- conditions: '{{ command == "release_1_and_4" }}'
sequence: !input button_1_and_4_released
- conditions: '{{ command == "release_2_and_3" }}'
sequence: !input button_2_and_3_released
else:
- choose:
- conditions: '{{ command == "release_1" }}'
sequence: !input button_1_pressed
- conditions: '{{ command == "release_2" }}'
sequence: !input button_2_pressed
- conditions: '{{ command == "release_3" }}'
sequence: !input button_3_pressed
- conditions: '{{ command == "release_4" }}'
sequence: !input button_4_pressed
- conditions: '{{ command == "release_1_and_3" }}'
sequence: !input button_1_and_3_pressed
- conditions: '{{ command == "release_2_and_4" }}'
sequence: !input button_2_and_4_pressed
- conditions: '{{ command == "release_1_and_4" }}'
sequence: !input button_1_and_4_pressed
- conditions: '{{ command == "release_2_and_3" }}'
sequence: !input button_2_and_3_pressed