-
Notifications
You must be signed in to change notification settings - Fork 6
/
inovelli_led_zwavejs.yaml
478 lines (452 loc) · 15.2 KB
/
inovelli_led_zwavejs.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
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
alias: Inovelli Dimmer and Switch LEDs ZwaveJS
description: 'Handles setting the LED colors and notifications on Inovelli "Red" model switches and dimmers through the Zwave JS integration with zwavejs2mqtt 2.4.0 using webhooks.'
############
# Caculations: https://docs.google.com/spreadsheets/d/14wTP4OL4hkDK3Et5kYL4fyxPIK_R9JR3cgFxSa6dhyw/edit?usp=sharing
# Note that the on/off switch has 1 fewer effect, which makes its math slightly different than the dimmers or other devices with a full LED bar.
#
# Required parameters
# entity: (string) The entity ID from "Developer Tools" -> "States". The device to be modified (e.g. light.office_lights_level)
# Can also be a comma separated list, if all entities are the same model. For example, "light.office, light.family_room"
# model: (string) One of: dimmer, switch, combo_light, combo_fan
#
# Required for setting the LED indicator
# LEDcolor: (int or string) Sets color of LED status and must be one of: Off, Red, Orange, Yellow, Green, Cyan, Teal, Blue, Purple, Light Pink, Pink, White
# LEDbrightness: (whole integer 1 – 10) Sets the brightness of the LED status when on.
# LEDbrightness_off: (whole integer 1 – 10) Sets the brightness of the LED status when off.
#
# Required for setting LED effects
# duration: (string or whole integer of seconds) Either "Off", an integer of seconds, or a whole integer followed by "Second", "Seconds", "Minute", or "Minutes", "Hour", "Hours", "Indefinitely", or "Forever".
# effect: (string) One of: "Off", "Solid", "Chase" (not available on switches), "Fast Blink", "Slow Blink", "Blink", or "Pulse".
# brightness: (integer 1 – 10) Sets the brightness of the LED's effect
# color: (string) Sets color of LED effect and must be one of: Off, Red, Orange, Yellow, Green, Cyan, Teal, Blue, Purple, Light Pink, Pink, White
############
mode: parallel
max: 100 # Default max is 10, which might be an issue if you have a lot of switches
fields:
entity:
name: Entity
description: The light.* entity for the LED we're setting. Can be a comma separated list.
required: yes
example: light.office, light.guest_room
selector:
entity:
integration: zwave_js
# domain: light, fan #LZW36 fan / light combos are excluded if we set this to light.
model:
name: Model
description: What type of device is this?
required: yes
example: Dimmer
selector:
select:
options:
- Dimmer
- Switch
- Combo_Light
- Combo_Fan
LEDcolor:
name: LED Color (non-effect)
description: Sets the color of the LED indicating brightness levels
required: no
example: Blue
selector:
select:
options:
- "Off"
- Red
- Orange
- Yellow
- Green
- Cyan
- Teal
- Blue
- Purple
- Light Pink
- Pink
- Hot Pink
- White
LEDbrightness:
name: LED Brightness On (non-effect)
description: Sets the brightness of the LED status when on. 0 means off
required: no
example: 6
selector:
number:
min: 0
max: 10
step: 1
mode: slider
LEDbrightness_off:
name: LED Brightness Off (non-effect)
description: Sets the brightness of the LED status when off. 0 means off
required: no
example: 2
selector:
number:
min: 0
max: 10
step: 1
mode: slider
duration:
name: Duration of Effect
description: How long the effect will last.
required: no
example: Off
selector:
select:
options:
- "Off"
- Forever
- 1 Second
- 2 Seconds
- 3 Seconds
- 4 Seconds
- 5 Seconds
- 6 Seconds
- 7 Seconds
- 8 Seconds
- 9 Seconds
- 10 Seconds
- 15 Seconds
- 20 Seconds
- 25 Seconds
- 30 Seconds
- 35 Seconds
- 40 Seconds
- 45 Seconds
- 50 Seconds
- 55 Seconds
- 60 Seconds
- 2 Minutes
- 3 Minutes
- 4 Minutes
- 5 Minutes
- 6 Minutes
- 7 Minutes
- 8 Minutes
- 9 Minutes
- 10 Minutes
- 15 Minutes
- 30 Minutes
- 45 Minutes
- 1 Hour
- 2 Hours
effect:
name: Effect
description: Type of effect. NOTE – Chase is not available on devices of type switch.
required: no
example: Pulse
selector:
select:
options:
- "Off"
- Solid
- Chase
- Fast Blink
- Slow Blink
- Blink
- Pulse
brightness:
name: Effect Brightness Sets the brightness of the LED's effect. 0 means off
description: How bright the LED effect will be
required: no
example: 8
selector:
number:
min: 0
max: 10
step: 1
mode: slider
color:
name: Effect Color
description: Color of LED effect
required: no
example: Red
selector:
select:
options:
- "Off"
- Red
- Orange
- Yellow
- Green
- Cyan
- Teal
- Blue
- Purple
- Light Pink
- Pink
- Hot Pink
- White
variables:
##################
# Look-up tables for easy reference and future maintenance.
##################
color_set:
"off": 0
"red": 0
"orange": 8
"yellow": 42
"green": 85
"cyan": 127
"teal": 145
"blue": 170
"purple": 195
"light pink": 220
"pink": 234
"hot pink": 234
"white": 255
duration_values:
"off": 0
"1 second": 1
"1 seconds": 1
"2 seconds": 2
"3 seconds": 3
"4 seconds": 4
"5 seconds": 5
"6 seconds": 6
"7 seconds": 7
"8 seconds": 8
"9 seconds": 9
"10 seconds": 10
"15 seconds": 15
"20 seconds": 20
"25 seconds": 25
"30 seconds": 30
"35 seconds": 35
"40 seconds": 40
"45 seconds": 45
"50 seconds": 50
"55 seconds": 55
"60 seconds": 60
"1 minute": 60
"1 minutes": 60
"2 minutes": 62
"3 minutes": 63
"4 minutes": 64
"10 minutes": 70
"15 minutes": 75
"30 minutes": 90
"45 minutes": 105
"60 minutes": 120
"1 hour": 120
"2 hours": 122
"forever": 255
"indefinitely": 255
switch_effects:
"off": 0
"solid": 1
"fast blink": 2
"chase": 2
"slow blink": 3
"blink": 3
"pulse": 4
strip_effects:
"off": 0
"solid": 1
"chase": 2
"fast blink": 3
"slow blink": 4
"blink": 4
"pulse": 5
##################
# There's a lot of redundancy here, but it should be easy to update if parameter names change for one model and not another
##################
parameters:
"dimmer_effect_bulk": 16
"dimmer_effect_color": "LED Effect Color"
"dimmer_effect_brightness": "LED Effect Brightness"
"dimmer_effect_duration": "LED Effect Duration"
"dimmer_effect_effect": "LED Effect Type"
"dimmer_ledcolor": "LED Indicator Color"
"dimmer_ledbrightness": "LED Indicator Brightness"
"dimmer_ledbrightness_off": "LED Indicator Brightness When Off"
"switch_effect_bulk": 8
"switch_effect_color": "LED Effect Color"
"switch_effect_brightness": "LED Effect Brightness"
"switch_effect_duration": "LED Effect Duration"
"switch_effect_effect": "LED Effect Type"
"switch_ledcolor": "LED Indicator Color"
"switch_ledbrightness": "LED Indicator Brightness"
"switch_ledbrightness_off": "LED Indicator Brightness When Off"
"combo_light_effect_bulk": 24
"combo_light_effect_color": "Light LED Effect Color"
"combo_light_effect_brightness": "Light LED Effect Brightness"
"combo_light_effect_duration": "Light LED Effect Duration"
"combo_light_effect_effect": "Light LED Effect Type"
"combo_light_ledcolor": "Light LED Indicator Color"
"combo_light_ledbrightness": "Light LED Strip Brightness"
"combo_light_ledbrightness_off": "Light LED Strip Brightness When Off"
"combo_fan_effect_bulk": 25
"combo_fan_effect_color": "Fan LED Effect Color"
"combo_fan_effect_brightness": "Fan LED Effect Brightness"
"combo_fan_effect_duration": "Fan LED Effect Duration"
"combo_fan_effect_effect": "Fan LED Effect Type"
"combo_fan_ledcolor": "Fan LED Indicator Color"
"combo_fan_ledbrightness": "Fan LED Strip Brightness"
"combo_fan_ledbrightness_off": "Fan LED Strip Brightness When Off"
sequence:
##################
# Cleaning up inputs; using lower case since it's able to handle capitol letters in the middle of mistyped and camelcase words like "LightPink".
# Brightness variables are set to 0 so they're skipped in the logic. To turn the LED off, use "Off".
##################
- variables:
entity: '{{ entity|lower }}'
model: '{{ model|lower }}'
color: '{{ color|default("No Change")|lower }}'
duration: '{{ duration|default("invalid")|lower }}'
brightness: '{{ brightness|default("11")|int }}'
effect: '{{ effect|default("off")|lower }}'
LEDcolor: '{{ LEDcolor|default("No Change")|lower }}'
LEDbrightness: '{{ LEDbrightness|default("11")|int }}'
LEDbrightness_off: '{{ LEDbrightness_off|default("11")|int }}'
##################
# Do not continue if we don't have at least entity and model
# Entity and model will be used as a default action to clear "forever" effects.
##################
- condition: template
value_template: '{{ entity is defined and model is defined }}'
##################
# If LED indicator parameters have been passed, we'll set those before setting the effect.
# Once the effect clears or the switch is used, the indicater will then display the new settings.
# This also allows a user to pass just a color or brightness change (perhaps at night).
##################
##################
# LED strip color
##################
- choose:
- conditions: >
{{ LEDcolor != "no change" }}
sequence:
- service: zwave_js.set_config_parameter
data:
entity_id: '{{ entity }}'
parameter: |
{% set effect_param = model + '_ledcolor' %}
{{ parameters[effect_param] }}
value: |
{{ color_set[LEDcolor] }}
##################
# LED strip brightness
##################
- choose:
- conditions: >
{{ LEDbrightness is defined and LEDbrightness != 11 }}
sequence:
- service: zwave_js.set_config_parameter
data:
entity_id: '{{ entity }}'
parameter: |
{% set effect_param = model + '_ledbrightness' %}
{{ "off" if parameters[effect_param] == 0 else parameters[effect_param] }}
value: |
{{ LEDbrightness }}
##################
# LED strip brightness when off
##################
- choose:
- conditions: >
{{ LEDbrightness_off is defined and LEDbrightness_off != 11 }}
sequence:
- service: zwave_js.set_config_parameter
data:
entity_id: '{{ entity }}'
parameter: |
{% set effect_param = model + '_ledbrightness_off' %}
{{ "off" if parameters[effect_param] == 0 else parameters[effect_param] }}
value: |
{{ LEDbrightness_off }}
##################
# Effects (need to be fully defined)
##################
- choose:
- conditions: >
{{ effect != "off" and
color != "off" }}
sequence:
- service: zwave_js.bulk_set_partial_config_parameters
data:
entity_id: '{{ entity }}'
parameter: |
{% set bulk_param = model + '_effect_bulk' %}
{{ parameters[bulk_param] }}
value: |
{% if model == "switch" %}
{{ color_set[color] + (brightness * 256) + (duration_values[duration] * 65536) + (switch_effects[effect] * 16777216) }}
{% else %}
{{ color_set[color] + (brightness * 256) + (duration_values[duration] * 65536) + (strip_effects[effect] * 16777216) }}
{% endif %}
# Changing to a bulk set of parameters to reduce Z-Wave traffic and writes to the switch's NVRAM.
# - service: zwave_js.set_config_parameter
# data:
# entity_id: '{{ entity }}'
# parameter: |
# {% set effect_param = model + '_effect_color' %}
# {{ parameters[effect_param] }}
# value: |
# {{ color_set[color] }}
# - service: zwave_js.set_config_parameter
# data:
# entity_id: '{{ entity }}'
# parameter: |
# {% set effect_param = model + '_effect_brightness' %}
# {{ "off" if parameters[effect_param] == 0 else parameters[effect_param] }}
# value: |
# {{ brightness }}
# - service: zwave_js.set_config_parameter
# data:
# entity_id: '{{ entity }}'
# parameter: |
# {% set effect_param = model + '_effect_duration' %}
# {{ parameters[effect_param] }}
# value: |
# {{ duration_values[duration] }}
# - service: zwave_js.set_config_parameter
# data:
# entity_id: '{{ entity }}'
# parameter: |
# {% set effect_param = model + '_effect_effect' %}
# {{ parameters[effect_param] }}
# value: |
# {% if model == "switch" %}
# {{ switch_effects[effect] }}
# {% else %}
# {{ strip_effects[effect] }}
# {% endif %}
##################
# Default will be to clear the effect and set the duration to 1sec.
# Setting only the effect to "off" turned the LED off on LZW36 fan / light combos for the duration (which could be "forever").
# This way it turns off for 1 sec before it returns to its default state, but until the min value for effect changes to 0 in the DB, that's the best I can do.
# This way, "forever" effects can be set, then easily cleared.
# It's also a safer way to fail since the worst case scenario is that an effect is cleared.
##################
default:
- service: zwave_js.set_config_parameter
data:
entity_id: '{{ entity }}'
parameter: |
{% set effect_param = model + '_effect_effect' %}
{{ parameters[effect_param] }}
value: 0
- service: zwave_js.set_config_parameter
data:
entity_id: '{{ entity }}'
parameter: |
{% set effect_param = model + '_effect_duration' %}
{{ parameters[effect_param] }}
value: 1
# Setting the duration to 0 was generating errors for some devices, and this generated unnecessary service calls anyhow
# - service: zwave_js.set_config_parameter
# data:
# entity_id: '{{ entity }}'
# parameter: |
# {% set effect_param = model + '_effect_color' %}
# {{ parameters[effect_param] }}
# value: 0
# - service: zwave_js.set_config_parameter
# data:
# entity_id: '{{ entity }}'
# parameter: |
# {% set effect_param = model + '_effect_brightness' %}
# {{ parameters[effect_param] }}
# value: 0