Last active
November 27, 2023 05:35
-
-
Save spencermamer/31a2b36cdcf208371645112e35e57fd9 to your computer and use it in GitHub Desktop.
Notification Blueprint Inovelli
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mode: parallel | |
variables: | |
# Set to true to create a "persistent_notification" with debugging information. | |
debug: '{{ iif(enable_debug is defined, enable_debug, false) }}' | |
entity_list: "{{ entity_id|default('switch.dining_room_lights') }}" | |
level: "{{ level|default(40)|int(default=0) }}" | |
duration: '{{ duration|default("Indefinitely")|title }}' | |
effect: '{{ effect|default("Blink")|title }}' | |
level_parameters: | |
dimmer: "unknown" | |
combo_light: "unknown" | |
combo_fan: "unknown" | |
switch: "LED Effect Brightness" | |
twoinone: "All LED Strip Effect - Level" | |
bluetwoinone: "none" | |
color_parameters: | |
dimmer: "unknown" | |
combo_light: "unknown" | |
combo_fan: "unknown" | |
switch: "LED Effect Color" | |
twoinone: "All LED Strip Effect - Color" | |
bluetwoinone: "none" | |
type_parameters: | |
dimmer: "unknown" | |
combo_light: "unknown" | |
combo_fan: "unknown" | |
switch: "LED Effect Type" | |
twoinone: "All LED Strip Effect - Effect" | |
bluetwoinone: "none" | |
duration_parameters: | |
dimmer: "unknown" | |
combo_light: "unknown" | |
combo_fan: "unknown" | |
switch: "LED Effect Duration" | |
twoinone: "All LED Strip Effect - Duration" | |
bluetwoinone: "none" | |
colors: | |
"Off": 0 | |
"Red": 1 | |
"Orange": 21 | |
"Yellow": 42 | |
"Green": 85 | |
"Cyan": 127 | |
"Teal": 145 | |
"Blue": 170 | |
"Purple": 195 | |
"Light Pink": 220 | |
"Pink": 234 | |
"White": 255 | |
durations: | |
"Off": 0 | |
"1 Second": 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 | |
"2 Minutes": 62 | |
"3 Minutes": 63 | |
"4 Minutes": 64 | |
"10 Minutes": 70 | |
"15 Minutes": 75 | |
"30 Minutes": 90 | |
"45 Minutes": 105 | |
"1 Hour": 120 | |
"2 Hours": 122 | |
"Indefinitely": 255 | |
effects_dimmer: | |
"Off": 0 | |
"Solid": 1 | |
"Chase": 2 | |
"Fast Blink": 3 | |
"Slow Blink": 4 | |
"Blink": 4 | |
"Pulse": 5 | |
"Breath": 5 | |
effects_switch: | |
"Off": "Off" | |
"Solid": "Solid" | |
"Fast Blink": "Fast Blink" | |
"Slow Blink": "Slow Blink" | |
"Pulse": "Pulse" | |
"Chase": "Pulse" | |
"Open/Close": "Pulse" | |
"Small To Big": "Pulse" | |
"Aurora": "Pulse" | |
"Breath": "Pulse" | |
"Slow Falling": "Slow Blink" | |
"Medium Falling": "Slow Blink" | |
"Fast Falling": "Fast Blink" | |
"Slow Rising": "Slow Blink" | |
"Medium Rising": "Slow Blink" | |
"Fast Rising": "Fast Blink" | |
"Medium Blink": "Slow Blink" | |
"Blink": "Slow Blink" | |
"Slow Chase": "Slow Blink" | |
"Fast Chase": "Fast Blink" | |
"Fast Siren": "Fast Blink" | |
"Slow Siren": "Slow Blink" | |
effects_twoinone: | |
"Off": "Off" | |
"Solid": "Solid" | |
"Fast Blink": "Fast blink" | |
"Slow Blink": "Slow blink" | |
"Pulse": "Pulse" | |
"Chase": "Chase" | |
"Open/Close": "Open/close" | |
"Small To Big": "Small to big" | |
"Aurora": "Aurora" | |
"Breath": "Aurora" | |
"Slow Falling": "Slow fall" | |
"Medium Falling": "Medium fall" | |
"Fast Falling": "Fast fall" | |
"Slow Rising": "Slow rise" | |
"Medium Rising": "Medium rise" | |
"Fast Rising": "Fast rise" | |
"Medium Blink": "Medium blink" | |
"Blink": "Medium blink" | |
"Slow Chase": "Slow chase" | |
"Fast Chase": "Fast chase" | |
"Fast Siren": "Fast siren" | |
"Slow Siren": "Slow siren" | |
effects_bluetwoinone: | |
'Off': 'off' | |
'Clear': 'clear_effect' | |
'Solid': 'solid' | |
'Aurora': 'aurora' | |
'Chase': 'chase' | |
'Fast Blink': 'fast_blink' | |
'Fast Chase': 'fast_chase' | |
'Fast Falling': 'fast_falling' | |
'Fast Rising': 'fast_rising' | |
'Fast Siren': 'fast_siren' | |
'Medium Blink': 'medium_blink' | |
'Medium Falling': 'medium_falling' | |
'Medium Rising': 'medium_rising' | |
'Open/Close': 'open_close' | |
'Open Close': 'open_close' | |
'Pulse': 'pulse' | |
'Slow Blink': 'slow_blink' | |
'Slow Chase': 'slow_chase' | |
'Slow Falling': 'slow_falling' | |
'Slow Rising': 'slow_rising' | |
'Slow Siren': 'slow_siren' | |
'Small To Big': 'small_to_big' | |
sequence: | |
- variables: | |
color_value: | | |
{%- if color is not number %} | |
{%- set color = color|default("Yellow")|title %} | |
{%- else %} | |
{%- set color = color|int(default=0) %} | |
{% endif %} | |
{{ colors[color|title]|int(default=0) }} | |
# Loop through each entity_id | |
- repeat: | |
for_each: '{{ entity_list }}' | |
sequence: | |
- variables: | |
# Automatically extract the model name. | |
model_name: | | |
{%- set model_name = device_attr(repeat.item, "model") %} | |
{%- if "(" in model_name %} | |
{%- set model_name = model_name|regex_replace(find='.+[\(]', replace='')|regex_replace(find='[\)].*', replace='') %} | |
{%- endif %} | |
{%- if "-" in model_name %} | |
{{ model_name.split("-")[0] }} | |
{%- else %} | |
{{ model_name }} | |
{%- endif %} | |
# 1st. Use the automatically detected "model_name". | |
# 2nd. Assume the model type is "dimmer". | |
model_type: | | |
{%- if model_name is string %} | |
{%- if "LZW31" in model_name %} | |
dimmer | |
{%- elif "VZW31" in model_name %} | |
twoinone | |
{%- elif "LZW36" in model_name %} | |
{%- set domain = repeat.item.split(".")[0] %} | |
{%- if domain == "fan" %} | |
combo_fan | |
{%- else %} | |
combo_light | |
{%- endif %} | |
{%- elif "VZM31" in model_name %} | |
bluetwoinone | |
{%- else %} | |
switch | |
{%- endif %} | |
{%- else %} | |
dimmer | |
{%- endif %} | |
level_parameter: "{{ level_parameters[model_type|lower] }}" | |
color_parameter: "{{ color_parameters[model_type|lower] }}" | |
type_parameter: "{{ type_parameters[model_type|lower] }}" | |
duration_parameter: "{{ duration_parameters[model_type|lower] }}" | |
effect_value: | | |
{% if model_type == "switch" %} | |
{{- effects_switch[effect|default("Blink")|title] }} | |
{%- elif model_type == "twoinone" %} | |
{{- effects_twoinone[effect|default("Blink")|title] }} | |
{%- elif model_type == "bluetwoinone" %} | |
{{- effects_bluetwoinone[effect|default("Blink")|title] }} | |
{%- else %} | |
{{- effects_dimmer[effect|default("Blink")|title] }} | |
{% endif %} | |
duration_value: |- | |
{%- if effect|title == "Off" %} | |
0 | |
{% else %} | |
{{ durations[duration|default("Indefinitely")|title] }} | |
{% endif %} | |
level_value: | | |
{%- if model_type == "twoinone" or model_type == "bluetwoinone" %} | |
{{ level|default(40)|int(default=0) }} | |
{%- else %} | |
{{ ((level|default(40)|float(default=0)) / 10)|round(0)|int(default=0) }} | |
{% endif %} | |
mqtt_command_path: >- | |
zigbee2mqtt/{{ device_attr(repeat.item, "name") }}/set | |
mqtt_payload: |- | |
{% set payload_data = { | |
"led_effect": { | |
"effect": effect_value, | |
"color": color_value, | |
"level": level_value, | |
"duration": duration_value | |
} | |
} %} | |
{{ payload_data|tojson }} | |
# Set debug = true above to provide output troubleshooting information. | |
- choose: | |
- conditions: | |
- '{{ debug == true }}' | |
sequence: | |
- service: persistent_notification.create | |
data: | |
title: "DEBUG: script.inovelli_led" | |
message: | | |
entity_id: {{ repeat.item }} | |
model_name: {{ model_name }} | |
model_type: {{ model_type }} | |
color: {{ color|title }} | |
level: {{ level }} | |
duration: {{ duration|title }} | |
effect: {{ effect|title }}' | |
{% if model_type == "bluetwoinone" %} | |
mqtt_command_path: {{ mqtt_command_path }} | |
mqtt_payload: {{ mqtt_payload }} | |
{% else %} | |
level parameter: {{ level_parameter }} | |
level value: {{ level_value }} | |
color parameter: {{ color_parameter }} | |
color value: {{ color_value }} | |
type parameter: {{ type_parameter }} | |
type value: {{ effect_value }} | |
duration parameter: {{ duration_parameter }} | |
duration value: {{ duration_value }} | |
{%- endif %} | |
- if: | |
- condition: template | |
value_template: '{{ model_type == "bluetwoinone" }}' | |
then: | |
- service: mqtt.publish | |
data: | |
topic: '{{ mqtt_command_path }}' | |
payload_template: "{{ mqtt_payload }}" | |
else: | |
- service: zwave_js.set_config_parameter | |
target: | |
entity_id: "{{ repeat.item }}" | |
data: | |
entity_id: "{{ repeat.item }}" | |
parameter: "{{ level_parameter }}" | |
value: "{{ level_value }}" | |
- service: zwave_js.set_config_parameter | |
target: | |
entity_id: "{{ repeat.item }}" | |
data: | |
entity_id: "{{ repeat.item }}" | |
parameter: "{{ color_parameter }}" | |
value: "{{ color_value }}" | |
- service: zwave_js.set_config_parameter | |
target: | |
entity_id: "{{ repeat.item }}" | |
data: | |
entity_id: "{{ repeat.item }}" | |
parameter: "{{ type_parameter }}" | |
value: "{{ effect_value }}" | |
- service: zwave_js.set_config_parameter | |
target: | |
entity_id: "{{ repeat.item }}" | |
data: | |
entity_id: "{{ repeat.item }}" | |
parameter: "{{ duration_parameter }}" | |
value: "{{ duration_value }}" | |
fields: | |
entity_id: | |
name: Entities | |
description: Inovelli devices to notify. | |
example: switch.dining_room_lights | |
selector: | |
entity: | |
domain: | |
- light | |
- switch | |
- fan | |
integration: zwave_js | |
multiple: true | |
color: | |
name: Color | |
description: Choose a color. | |
default: Purple | |
selector: | |
select: | |
options: | |
- "Off" | |
- Red | |
- Orange | |
- Yellow | |
- Green | |
- Cyan | |
- Teal | |
- Blue | |
- Purple | |
- Light Pink | |
- Pink | |
- White | |
level: | |
name: Brightness level | |
description: Value from 0 (off) to 10 (100% brightness). | |
default: 40 | |
selector: | |
number: | |
min: 0 | |
max: 100 | |
effect: | |
name: Effect | |
description: Choose an effect. | |
default: Blink | |
selector: | |
select: | |
options: | |
- "Off" | |
- Solid | |
- Chase | |
- Fast Blink | |
- Slow Blink | |
- Blink | |
- Pulse | |
- Breath | |
- "Open/Close" | |
- Small To Big | |
- Aurora | |
- Breath | |
- Slow Falling | |
- Medium Falling | |
- Fast Falling | |
- Slow Rising | |
- Medium Rising | |
- Fast Rising | |
- Medium Blink | |
- Slow Chase | |
- Fast Chase | |
- Fast Siren | |
- Slow Siren | |
duration: | |
name: Duration | |
description: How long should the effect run? | |
default: 10 Seconds | |
selector: | |
select: | |
options: | |
- "Off" | |
- 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 | |
- 10 Minutes | |
- 15 Minutes | |
- 30 Minutes | |
- 45 Minutes | |
- 1 Hour | |
- 2 Hours | |
- Indefinitely | |
enable_debug: | |
name: Enable debug output? | |
selector: | |
boolean: |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Initial