-
Notifications
You must be signed in to change notification settings - Fork 0
/
PTM_215Z_ZE (mqtt_trigger).yaml
207 lines (206 loc) · 7.18 KB
/
PTM_215Z_ZE (mqtt_trigger).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
blueprint:
homeassistant:
min_version: 2024.10.0
name: Controller - EnOcean PTM 215Z/ZE (MQTT trigger)
description: |
Controller automation for executing **press/hold/release** after hold actions triggered by EnOcean PTM 215Z/ZE switch.
ℹ️ Version 2024.12.15
domain: automation
input:
controller:
name: Controller Name
description: The name of the controller as defined in z2m (e.g. Livingroom Switch)
default: ""
base_topic:
name: Base mqtt topic
description: The base topic as configured in z2m
default: zigbee2mqtt
hold_delay:
name: 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: Button 1 and 3 Pressed
description: Action to run, when buttons 1 and 3 are pressed.
default: []
selector:
action: {}
button_1_and_3_held:
name: Button 1 and 3 Held
description: Action to run, when buttons 1 and 3 are held.
default: []
selector:
action: {}
button_1_and_3_released:
name: Button 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: Button 2 and 4 Pressed
description: Action to run, when buttons 2 and 4 are pressed.
default: []
selector:
action: {}
button_2_and_4_held:
name: Button 2 and 4 Held
description: Action to run, when buttons 2 and 4 are held.
default: []
selector:
action: {}
button_2_and_4_released:
name: Button 2 and 4 released
description: Action to run, when buttons 2 and 4 are released after long press.
default: []
selector:
action: {}
source_url: https://github.com/chris-1243/HA---Blueprint/blob/main/PTM_215Z_ZE%20(mqtt_trigger).yaml
mode: single
max_exceeded: silent
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 not in ("", "unknown", "unavailable", "None") }}'
actions:
- variables:
command: '{{ trigger.payload_json.action }}'
- choose:
- conditions: '{{ "press_" | string in command }}'
sequence:
- wait_for_trigger:
- trigger: mqtt
topic: '{{ base_topic ~ "/" ~ controller }}'
payload: 'release'
value_template: '{{ value_json.action.split("_")[0] }}'
timeout:
milliseconds: !input hold_delay
- if: '{{ wait.trigger != None }}'
then:
- choose:
- conditions: '{{ command == "press_1" }}'
sequence: !input button_1_pressed
- conditions: '{{ command == "press_2" }}'
sequence: !input button_2_pressed
- conditions: '{{ command == "press_3" }}'
sequence: !input button_3_pressed
- conditions: '{{ command == "press_4" }}'
sequence: !input button_4_pressed
- conditions: '{{ command == "press_1_and_3" }}'
sequence: !input button_1_and_3_pressed
- conditions: '{{ command == "press_2_and_4" }}'
sequence: !input button_2_and_4_pressed
else:
- 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: '{{ "release_" | string in command }}'
sequence:
- 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