- Add warm, cool, police color effects to Inovelli LED

This commit is contained in:
nwithan8 2023-08-11 16:57:01 -06:00
parent dbf029e6b0
commit 24ef27919c

View File

@ -98,11 +98,16 @@ fields:
selector:
select:
options:
- "Warm"
- "Cool"
- "Rainbow"
- "Police"
variables:
all_led_mode_value: -1
led_values:
"all": -1
"all": >
{{ all_led_mode_value }}
"led 1": 0
"led 2": 1
"led 3": 2
@ -138,13 +143,23 @@ variables:
"slow siren": 19
"open-close": 6
"small-big": 7
# Only 0-8 can be used to set a single LED
max_single_led_effect: 8
# Only 0-8 + 255 can be used to set a single LED
single_led_compatible_effect_values:
- 0
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 255
effect: '{{ effect|default("solid") }}'
effect_value: >
{% set val = effect_values[effect | lower] | int %}
{% if val > max_single_led_effect %}
{% set val = 1 %}
{% if led_value != all_led_mode_value and val not in single_led_compatible_effect_values %}
{% set val = effect_values["solid"] | int %}
{% endif %}
{{ val }}
@ -154,28 +169,13 @@ variables:
use_special_color_preset: >
{{ special_color_preset != "none" }}
normal_payload: >
{% if led_value == -1 %}
{% set payload_data = {
"led_effect": effect_value,
"led_color": color,
"led_level": level,
"led_duration": duration,
} %}
{% else %}
{% set payload_data = {
"led_number": led_value,
"led_effect": effect_value,
"led_color": color,
"led_level": level,
"led_duration": duration,
} %}
{% endif %}
{{ payload_data }}
# Max 7 colors, starting from the bottom LED
special_colors_orders:
"none": []
"none": [ ]
"warm": [ 45, 38, 31, 23, 17, 10, 0 ]
"cool": [ 56, 73, 98, 119, 151, 175, 187]
"rainbow": [222, 189, 166, 94, 53, 25, 0]
"police": [165, 165, 255, 255, 255, 0, 0]
special_color_order: >
{{ special_colors_orders[special_color_preset | lower] }}
@ -199,7 +199,24 @@ sequence:
command: >
{{ iif(led_value == -1, 1, 3) }}
command_type: server
params: "{{ normal_payload }}"
params: >
{% if led_value == -1 %}
{% set payload_data = {
"led_effect": effect_value,
"led_color": color,
"led_level": level,
"led_duration": duration,
} %}
{% else %}
{% set payload_data = {
"led_number": led_value,
"led_effect": effect_value,
"led_color": color,
"led_level": level,
"led_duration": duration,
} %}
{% endif %}
{{ payload_data }}
manufacturer: 4655
# Special color preset for all LEDs
- conditions: