- Add warm, cool, police color effects to Inovelli LED
This commit is contained in:
		| @ -98,11 +98,16 @@ fields: | |||||||
|     selector: |     selector: | ||||||
|       select: |       select: | ||||||
|         options: |         options: | ||||||
|  |           - "Warm" | ||||||
|  |           - "Cool" | ||||||
|           - "Rainbow" |           - "Rainbow" | ||||||
|  |           - "Police" | ||||||
|  |  | ||||||
| variables: | variables: | ||||||
|  |   all_led_mode_value: -1 | ||||||
|   led_values: |   led_values: | ||||||
|     "all": -1 |     "all": > | ||||||
|  |       {{ all_led_mode_value }} | ||||||
|     "led 1": 0 |     "led 1": 0 | ||||||
|     "led 2": 1 |     "led 2": 1 | ||||||
|     "led 3": 2 |     "led 3": 2 | ||||||
| @ -138,13 +143,23 @@ variables: | |||||||
|     "slow siren": 19 |     "slow siren": 19 | ||||||
|     "open-close": 6 |     "open-close": 6 | ||||||
|     "small-big": 7 |     "small-big": 7 | ||||||
|   # Only 0-8 can be used to set a single LED |   # Only 0-8 + 255 can be used to set a single LED | ||||||
|   max_single_led_effect: 8 |   single_led_compatible_effect_values: | ||||||
|  |     - 0 | ||||||
|  |     - 1 | ||||||
|  |     - 2 | ||||||
|  |     - 3 | ||||||
|  |     - 4 | ||||||
|  |     - 5 | ||||||
|  |     - 6 | ||||||
|  |     - 7 | ||||||
|  |     - 8 | ||||||
|  |     - 255 | ||||||
|   effect: '{{ effect|default("solid") }}' |   effect: '{{ effect|default("solid") }}' | ||||||
|   effect_value: > |   effect_value: > | ||||||
|     {% set val = effect_values[effect | lower] | int %} |     {% set val = effect_values[effect | lower] | int %} | ||||||
|     {% if val > max_single_led_effect %} |     {% if led_value != all_led_mode_value and val not in single_led_compatible_effect_values %} | ||||||
|       {% set val = 1 %} |       {% set val = effect_values["solid"] | int %} | ||||||
|     {% endif %} |     {% endif %} | ||||||
|     {{ val }} |     {{ val }} | ||||||
|  |  | ||||||
| @ -154,28 +169,13 @@ variables: | |||||||
|   use_special_color_preset: > |   use_special_color_preset: > | ||||||
|     {{ special_color_preset != "none" }} |     {{ special_color_preset != "none" }} | ||||||
|  |  | ||||||
|   normal_payload: > |   # Max 7 colors, starting from the bottom LED | ||||||
|     {% 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 }} |  | ||||||
|  |  | ||||||
|   special_colors_orders: |   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] |     "rainbow": [222, 189, 166, 94, 53, 25, 0] | ||||||
|  |     "police": [165, 165, 255, 255, 255, 0, 0] | ||||||
|  |  | ||||||
|   special_color_order: > |   special_color_order: > | ||||||
|     {{ special_colors_orders[special_color_preset | lower] }} |     {{ special_colors_orders[special_color_preset | lower] }} | ||||||
| @ -199,7 +199,24 @@ sequence: | |||||||
|               command: > |               command: > | ||||||
|                 {{ iif(led_value == -1, 1, 3) }} |                 {{ iif(led_value == -1, 1, 3) }} | ||||||
|               command_type: server |               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 |               manufacturer: 4655 | ||||||
|         # Special color preset for all LEDs |         # Special color preset for all LEDs | ||||||
|       - conditions: |       - conditions: | ||||||
|  | |||||||
		Reference in New Issue
	
	Block a user