2023-06-08 10:41:57 +00:00
|
|
|
# This blueprint will allow you to make one generic script, and pass in all variables, including target switch, effect, colors, etc. on each call.
|
|
|
|
# Users do NOT need to set up a per-device copy of this script.
|
|
|
|
|
|
|
|
blueprint:
|
|
|
|
name: Inovelli VZM31-SN Notification LED (ZHA)
|
|
|
|
description: >-
|
|
|
|
A script that sets the notification LED bar of an Inovelli light switch.
|
|
|
|
source_url: https://raw.githubusercontent.com/nwithan8/configs/main/home_assistant/blueprints/scripts/inovelli_vzm31-sn_notification_led_zha.yaml
|
|
|
|
domain: script
|
|
|
|
fields:
|
|
|
|
switch:
|
|
|
|
name: Inovelli VZM31-SN
|
|
|
|
description: Which light switch to program
|
|
|
|
required: true
|
|
|
|
selector:
|
|
|
|
device:
|
|
|
|
integration: zha
|
|
|
|
manufacturer: Inovelli
|
|
|
|
model: VZM31-SN
|
2023-08-11 00:06:54 +00:00
|
|
|
led:
|
|
|
|
name: LED
|
|
|
|
description: Which LED to program (LED 1 is the bottom-most LED)
|
|
|
|
required: false
|
|
|
|
selector:
|
|
|
|
select:
|
|
|
|
options:
|
|
|
|
- "All"
|
|
|
|
- "LED 1"
|
|
|
|
- "LED 2"
|
|
|
|
- "LED 3"
|
|
|
|
- "LED 4"
|
|
|
|
- "LED 5"
|
|
|
|
- "LED 6"
|
|
|
|
- "LED 7"
|
|
|
|
default: "All"
|
2023-06-08 10:41:57 +00:00
|
|
|
effect:
|
|
|
|
name: Effect
|
2023-08-11 00:06:54 +00:00
|
|
|
description: >
|
|
|
|
Effect to use. Some effects cannot be used on a single LED; if an invalid match is provided, the effect will be overriden to "Solid"
|
2023-06-08 10:41:57 +00:00
|
|
|
required: true
|
|
|
|
selector:
|
|
|
|
select:
|
2023-08-10 20:46:14 +00:00
|
|
|
# 'Chase' is legacy, but still supported (equates to 'Medium Chase')
|
2023-06-08 10:41:57 +00:00
|
|
|
options:
|
|
|
|
- "Off"
|
|
|
|
- "Clear"
|
|
|
|
- "Solid"
|
|
|
|
- "Slow Blink"
|
2023-08-10 20:46:14 +00:00
|
|
|
- "Medium Blink"
|
|
|
|
- "Fast Blink"
|
2023-06-08 10:41:57 +00:00
|
|
|
- "Pulse"
|
2023-08-10 20:46:14 +00:00
|
|
|
- "Aurora"
|
|
|
|
- "Slow Falling"
|
|
|
|
- "Medium Falling"
|
|
|
|
- "Fast Falling"
|
|
|
|
- "Slow Rising"
|
|
|
|
- "Medium Rising"
|
|
|
|
- "Fast Rising"
|
|
|
|
- "Slow Siren"
|
|
|
|
- "Fast Siren"
|
2023-06-08 10:41:57 +00:00
|
|
|
- "Chase"
|
2023-08-10 20:46:14 +00:00
|
|
|
- "Slow Chase"
|
|
|
|
- "Medium Chase"
|
|
|
|
- "Fast Chase"
|
2023-06-08 10:41:57 +00:00
|
|
|
- "Open-Close"
|
|
|
|
- "Small-Big"
|
2023-08-11 00:06:54 +00:00
|
|
|
default: "Solid"
|
2023-06-08 10:41:57 +00:00
|
|
|
|
|
|
|
duration:
|
|
|
|
name: Duration
|
|
|
|
description: How long the effect should last, in seconds (1-254, 255 for indefinite)
|
|
|
|
required: true
|
|
|
|
selector:
|
|
|
|
number:
|
|
|
|
min: 1
|
|
|
|
max: 255
|
|
|
|
level:
|
|
|
|
name: Intensity
|
|
|
|
description: How intense the light should be, percentage (0-100)
|
|
|
|
required: true
|
|
|
|
selector:
|
|
|
|
number:
|
|
|
|
min: 0
|
|
|
|
max: 100
|
|
|
|
color:
|
|
|
|
name: Color
|
|
|
|
description: The color the light should be, (0-254, 255 for white)
|
2023-08-11 00:06:54 +00:00
|
|
|
required: false
|
2023-06-08 10:41:57 +00:00
|
|
|
selector:
|
|
|
|
number:
|
|
|
|
min: 0
|
|
|
|
max: 255
|
|
|
|
|
2023-08-11 00:06:54 +00:00
|
|
|
color_preset:
|
|
|
|
name: Color Preset
|
|
|
|
description: Special color preset to use (overrides color setting and LED selection)
|
|
|
|
required: false
|
|
|
|
selector:
|
|
|
|
select:
|
|
|
|
options:
|
2023-08-11 22:57:01 +00:00
|
|
|
- "Warm"
|
|
|
|
- "Cool"
|
2023-08-11 00:06:54 +00:00
|
|
|
- "Rainbow"
|
2023-08-11 22:57:01 +00:00
|
|
|
- "Police"
|
2023-08-11 00:06:54 +00:00
|
|
|
|
2023-08-10 20:46:14 +00:00
|
|
|
variables:
|
2023-08-11 22:57:01 +00:00
|
|
|
all_led_mode_value: -1
|
2023-08-11 00:06:54 +00:00
|
|
|
led_values:
|
2023-08-11 22:57:01 +00:00
|
|
|
"all": >
|
|
|
|
{{ all_led_mode_value }}
|
2023-08-11 00:06:54 +00:00
|
|
|
"led 1": 0
|
|
|
|
"led 2": 1
|
|
|
|
"led 3": 2
|
|
|
|
"led 4": 3
|
|
|
|
"led 5": 4
|
|
|
|
"led 6": 5
|
|
|
|
"led 7": 6
|
|
|
|
led: '{{ led|default("all") }}'
|
|
|
|
led_value: >-
|
|
|
|
{{ led_values[led | lower] | int }}
|
|
|
|
|
2023-08-10 20:46:14 +00:00
|
|
|
# Main + legacy effects mapping
|
|
|
|
effect_values:
|
|
|
|
"off": 0
|
|
|
|
"clear": 255
|
|
|
|
"solid": 1
|
|
|
|
"slow blink": 3
|
|
|
|
"medium blink": 15
|
|
|
|
"fast blink": 2
|
|
|
|
"pulse": 4
|
|
|
|
"aurora": 8
|
|
|
|
"slow falling": 9
|
|
|
|
"medium falling": 10
|
|
|
|
"fast falling": 11
|
|
|
|
"slow rising": 12
|
|
|
|
"medium rising": 13
|
|
|
|
"fast rising": 14
|
|
|
|
"chase": 5
|
|
|
|
"slow chase": 16
|
|
|
|
"medium chase": 5
|
|
|
|
"fast chase": 17
|
|
|
|
"fast siren": 18
|
|
|
|
"slow siren": 19
|
|
|
|
"open-close": 6
|
|
|
|
"small-big": 7
|
2023-08-11 22:57:01 +00:00
|
|
|
# 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
|
2023-08-11 00:06:54 +00:00
|
|
|
effect: '{{ effect|default("solid") }}'
|
|
|
|
effect_value: >
|
|
|
|
{% set val = effect_values[effect | lower] | int %}
|
2023-08-11 22:57:01 +00:00
|
|
|
{% if led_value != all_led_mode_value and val not in single_led_compatible_effect_values %}
|
|
|
|
{% set val = effect_values["solid"] | int %}
|
2023-08-11 00:06:54 +00:00
|
|
|
{% endif %}
|
|
|
|
{{ val }}
|
|
|
|
|
|
|
|
color: "{{ color|default(255) }}"
|
|
|
|
|
|
|
|
special_color_preset: '{{ color_preset|default("none") }}'
|
|
|
|
use_special_color_preset: >
|
|
|
|
{{ special_color_preset != "none" }}
|
|
|
|
|
2023-08-11 22:57:01 +00:00
|
|
|
# Max 7 colors, starting from the bottom LED
|
2023-08-11 00:06:54 +00:00
|
|
|
special_colors_orders:
|
2023-08-11 22:57:01 +00:00
|
|
|
"none": [ ]
|
|
|
|
"warm": [ 45, 38, 31, 23, 17, 10, 0 ]
|
|
|
|
"cool": [ 56, 73, 98, 119, 151, 175, 187]
|
2023-08-11 00:06:54 +00:00
|
|
|
"rainbow": [222, 189, 166, 94, 53, 25, 0]
|
2023-08-11 22:57:01 +00:00
|
|
|
"police": [165, 165, 255, 255, 255, 0, 0]
|
2023-08-11 00:06:54 +00:00
|
|
|
|
|
|
|
special_color_order: >
|
|
|
|
{{ special_colors_orders[special_color_preset | lower] }}
|
2023-08-10 20:46:14 +00:00
|
|
|
|
2023-06-08 10:41:57 +00:00
|
|
|
sequence:
|
2023-08-11 00:06:54 +00:00
|
|
|
- choose:
|
|
|
|
# Single color for one or all LEDs
|
|
|
|
- conditions:
|
|
|
|
- condition: template
|
|
|
|
value_template: >
|
|
|
|
{{ not use_special_color_preset }}
|
|
|
|
sequence:
|
|
|
|
- service: zha.issue_zigbee_cluster_command
|
|
|
|
data:
|
|
|
|
ieee: >
|
|
|
|
{{ (device_attr(switch, "identifiers")|list).0.1 }}
|
|
|
|
endpoint_id: 1
|
|
|
|
cluster_id: 64561
|
|
|
|
cluster_type: in
|
|
|
|
# 1 = all LEDs, 3 = specific LED
|
|
|
|
command: >
|
|
|
|
{{ iif(led_value == -1, 1, 3) }}
|
|
|
|
command_type: server
|
2023-08-11 22:57:01 +00:00
|
|
|
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 }}
|
2023-08-11 00:06:54 +00:00
|
|
|
manufacturer: 4655
|
|
|
|
# Special color preset for all LEDs
|
|
|
|
- conditions:
|
|
|
|
- condition: template
|
|
|
|
value_template: >
|
|
|
|
{{ use_special_color_preset }}
|
|
|
|
sequence:
|
|
|
|
- repeat:
|
|
|
|
count: "{{ special_color_order | count }}"
|
|
|
|
sequence:
|
|
|
|
- service: zha.issue_zigbee_cluster_command
|
|
|
|
data:
|
|
|
|
ieee: >
|
|
|
|
{{ (device_attr(switch, "identifiers")|list).0.1 }}
|
|
|
|
endpoint_id: 1
|
|
|
|
cluster_id: 64561
|
|
|
|
cluster_type: in
|
|
|
|
# 1 = all LEDs, 3 = specific LED
|
|
|
|
command: 3
|
|
|
|
command_type: server
|
|
|
|
# Index starts at 1 like an idiot
|
|
|
|
params:
|
|
|
|
"led_number": "{{ repeat.index - 1}}"
|
|
|
|
"led_effect": "{{ effect_value }}"
|
|
|
|
"led_color": "{{ special_color_order[repeat.index - 1] | int }}"
|
|
|
|
"led_level": "{{ level }}"
|
|
|
|
"led_duration": "{{ duration }}"
|
|
|
|
manufacturer: 4655
|
2023-06-08 10:41:57 +00:00
|
|
|
|
|
|
|
mode: single
|
2023-08-10 20:46:14 +00:00
|
|
|
max_exceeded: silent
|