-
Notifications
You must be signed in to change notification settings - Fork 14
/
buttons.yaml
328 lines (313 loc) · 8.86 KB
/
buttons.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
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
- alias: Zigbee Button Toggler
id: button_toggle_lights
mode: parallel
trigger:
- platform: state
entity_id:
- sensor.workshop_button_action
- sensor.mikes_button_action
- sensor.jims_button_action
- sensor.lindsays_button_action
variables:
continue: >
{{ trigger | default(none) is not none and trigger.to_state is defined and trigger.from_state is defined }}
event: >
{{ trigger.to_state.state | default('') if continue else '' }}
source: >
{{ trigger.entity_id }}
config:
sensor.workshop_button_action:
single:
- light.workshop_desk
double:
- light.workshop_desk
- light.workshop_bench_strip
hold:
- light.workshop_desk
- light.workshop_dome
- switch.floating_double_plug_left
- light.workshop_bench_strip
sensor.mikes_button_action:
single:
- light.mikes_lamp
double:
- light.living_room
hold:
- switch.movie_time
sensor.jims_button_action:
single:
- light.jims_lamp
double:
- light.all_living_room
hold:
- light.all_living_room
sensor.lindsays_button_action:
single:
- light.lindsays_lamp
double:
- light.living_room
hold:
- light.all_living_room
which: >
{%- set item = config.get(source, {}) %}
{{ item.get(event, []) }}
targets: >
{{ which | count > 0 }}
are_on: >
{{ which | select('is_state', 'on') | list | count > 0 }}
condition:
- condition: template
value_template: "{{ continue and targets }}"
action:
- service: homeassistant.turn_o{{ 'ff' if are_on else 'n' }}
target:
entity_id: "{{ which }}"
- alias: Living Room Scene Controller
id: button_living_room_scene_controller
mode: parallel
trigger:
- platform: event
event_type: zwave_js_value_notification
variables:
device: >
{{ trigger.event.data.device_id }}
value: >
{{ trigger.event.data.value }}
label: >
{{ trigger.event.data.label }}
config:
215253fb0f54a57d98bc940fac442073:
# Top Left Button
'Scene 001':
KeyPressed:
service: light.toggle
data:
entity_id: light.downstairs_ambiance
# KeyPressed2x:
# KeyPressed3x:
# KeyPressed4x:
# KeyPressed5x:
# Top Right Button
'Scene 002':
KeyPressed:
service: light.toggle
data:
entity_id: light.living_room_uplight
# KeyPressed2x:
# KeyPressed3x:
# KeyPressed4x:
# KeyPressed5x:
# Bottom Left Button
'Scene 003':
KeyPressed:
service: light.toggle
data:
entity_id: light.dining_room_uplight_1
# KeyPressed2x:
# KeyPressed3x:
# KeyPressed4x:
# KeyPressed5x:
# Bottom Right Button
'Scene 004':
KeyPressed:
service: light.toggle
data:
entity_id: light.dining_room_uplight_2
# KeyPressed2x:
# KeyPressed3x:
# KeyPressed4x:
# KeyPressed5x:
# Top button
'Scene 005':
KeyPressed:
service: light.toggle
data:
entity_id: light.living_room
KeyPressed2x:
service: light.toggle
data:
entity_id: light.all_living_room
# KeyPressed3x:
# KeyPressed4x:
# KeyPressed5x:
f7a1fe2db74bf6a3b652301589f7cebc:
# Top Left Button
'Scene 001':
KeyPressed:
service: light.toggle
data:
entity_id: light.mikes_lamp
# KeyPressed2x:
# KeyPressed3x:
# KeyPressed4x:
# KeyPressed5x:
# Top Right Button
'Scene 002':
KeyPressed:
service: light.toggle
data:
entity_id: light.lindsays_lamp
# KeyPressed2x:
# KeyPressed3x:
# KeyPressed4x:
# KeyPressed5x:
# Bottom Left Button
'Scene 003':
KeyPressed:
service: light.toggle
data:
entity_id: light.jims_lamp
# KeyPressed2x:
# KeyPressed3x:
# KeyPressed4x:
# KeyPressed5x:
# Bottom Right Button
'Scene 004':
KeyPressed:
service: switch.toggle
data:
entity_id: switch.hyperion_usb_capture
KeyPressed2x:
service: switch.toggle
data:
entity_id: switch.hyperion_cinema
KeyPressed3x:
service: switch.toggle
data:
entity_id: switch.hyperion_rainbow_swirl_fast
# KeyPressed4x:
# KeyPressed5x:
# Top button
'Scene 005':
KeyPressed:
service: light.toggle
data:
entity_id: light.living_room
KeyPressed2x:
service: light.toggle
data:
entity_id: light.all_living_room
# KeyPressed3x:
# KeyPressed4x:
# KeyPressed5x:
service: >
{{ config.get(device, {}).get(label, {}).get(value, {}).get('service') }}
data: >
{{ config.get(device, {}).get(label, {}).get(value, {}).get('data') }}
condition:
- condition: template
value_template: "{{ service is not none and data is not none }}"
action:
- service: "{{ service }}"
data: "{{ data }}"
- alias: Living Room Scene Controller LEDs
id: button_living_room_scene_controller_leds
mode: queued
trigger:
- platform: state
entity_id:
- light.mikes_lamp
- light.lindsays_lamp
- light.jims_lamp
- switch.hyperion_usb_capture
- switch.hyperion_cinema
- switch.hyperion_rainbow_swirl_fast
- light.all_living_room
- light.downstairs_ambiance
- light.dining_room_uplight_1
- light.dining_room_uplight_2
- light.living_room_uplight
variables:
values:
'on': 2
'off': 3
'unavailable': 3
'unknown': 3
colors:
white: 0
blue: 1
green: 2
red: 3
config:
light.mikes_lamp:
devices: &controller1 f7a1fe2db74bf6a3b652301589f7cebc
parameter: &top_left 2
light.lindsays_lamp:
devices: *controller1
parameter: &top_right 3
light.jims_lamp:
devices: *controller1
parameter: &bottom_left 4
switch.hyperion_usb_capture:
devices: *controller1
parameter: &bottom_right 5
switch.hyperion_cinema:
devices: *controller1
parameter: *bottom_right
switch.hyperion_rainbow_swirl_fast:
devices: *controller1
parameter: *bottom_right
light.all_living_room:
devices:
- *controller1
- &controller2 215253fb0f54a57d98bc940fac442073
parameter: 1
light.downstairs_ambiance:
devices: *controller2
parameter: *top_left
light.dining_room_uplight_1:
devices: *controller2
parameter: *bottom_left
light.dining_room_uplight_2:
devices: *controller2
parameter: *bottom_right
light.living_room_uplight:
devices: *controller2
parameter: *top_right
value: >
{{ values.get(trigger.to_state.state) }}
state_parameter: >
{{ config.get(trigger.entity_id, {}).get('parameter') }}
devices: >
{% set devices = config.get(trigger.entity_id, {}).get('devices') %}
{{ devices if devices is list else [devices] }}
color_parameter: >
{{ state_parameter + 5 if state_parameter is not none else none }}
state_good: >
{{ trigger.to_state.state in ['on', 'off'] }}
state_bad: >
{{ trigger.to_state.state in ['unavailable', 'unknown'] }}
state_off: >
{{ trigger.to_state.state == 'off' }}
color: >
{% if state_good and state_off %}
{{ colors.get('white') }}
{% elif state_bad %}
{{ colors.get('red') }}
{% else %}
None
{% endif %}
condition:
- condition: template
value_template: "{{ value is not none and state_parameter is not none }}"
action:
- repeat:
for_each: "{{ devices }}"
sequence:
- <<: &target
service: zwave_js.bulk_set_partial_config_parameters
target:
device_id: "{{ repeat.item }}"
data:
parameter: "{{ state_parameter }}"
value: "{{ value }}"
# Only set the color if we are 'off', 'unavailable', or 'unknown'
- condition: template
value_template: "{{ color is not none and (state_bad or state_off) }}"
- repeat:
for_each: "{{ devices }}"
sequence:
- <<: *target
data:
parameter: "{{ color_parameter }}"
value: "{{ color }}"