Skip to content

Instantly share code, notes, and snippets.

@simeononsecurity
Created November 16, 2024 22:23
Show Gist options
  • Save simeononsecurity/ecdd9ca5c29c1533f961c0f4ec3fc204 to your computer and use it in GitHub Desktop.
Save simeononsecurity/ecdd9ca5c29c1533f961c0f4ec3fc204 to your computer and use it in GitHub Desktop.
blueprint:
name: Inovelli LED Color Based on Weather
description: >
Set the LED color of Inovelli dimmers and switches based on the current
weather conditions from a specified weather entity. Specific to Z-Wave
devices using Z-Wave JS and Zigbee devices using ZHA.
domain: automation
input:
weather_entity:
name: Weather Entity
description: "Select the weather entity to use for determining LED color."
selector:
entity:
domain: weather
inovelli_dimmer:
name: Inovelli Dimmer
description: List of available Inovelli dimmers.
default: {}
selector:
target:
device:
- integration: zwave_js
manufacturer: Inovelli
model: LZW31-SN
- integration: zwave_js
manufacturer: Inovelli
model: LZW31
inovelli_switch:
name: Inovelli On/Off Switch
description: List of available Inovelli On/Off switches.
default: {}
selector:
target:
device:
- integration: zwave_js
manufacturer: Inovelli
model: LZW30-SN
- integration: zwave_js
manufacturer: Inovelli
model: LZW30
inovelli_fan_light_combo:
name: Inovelli Fan/Light Combo
description: List of available Inovelli fan/light combo switches.
default: {}
selector:
target:
device:
integration: zwave_js
manufacturer: Inovelli
model: LZW36
inovelli_red_2_in_1:
name: Inovelli Red 2-in-1 Switch
description: List of available Inovelli Red 2-in-1 switches.
default: {}
selector:
target:
device:
integration: zwave_js
manufacturer: Inovelli
model: VZW31-SN
inovelli_blue_2_in_1:
name: Inovelli Blue 2-in-1 Switch
description: List of available Inovelli Blue 2-in-1 switches.
default: []
selector:
target:
device:
integration: zha
manufacturer: Inovelli
model: VZM31-SN
variables:
weather_state: !input weather_entity
color: >
{% set weather = states(weather_state) %}
{% if weather == 'clear-night' %}
170 # Blue for clear night
{% elif weather == 'rainy' %}
85 # Green for rainy
{% elif weather == 'cloudy' %}
195 # Purple for cloudy
{% elif weather == 'sunny' %}
42 # Yellow for sunny
{% elif weather == 'partlycloudy' %}
21 # Orange for partly cloudy
{% elif weather == 'fog' %}
234 # Pink for foggy
{% elif weather == 'windy' %}
127 # Cyan for windy
{% elif weather == 'snowy' %}
255 # White for snowy
{% else %}
0 # Off for unknown conditions
{% endif %}
inovelli_dimmer: !input inovelli_dimmer
inovelli_switch: !input inovelli_switch
inovelli_fan_light_combo: !input inovelli_fan_light_combo
inovelli_red_2_in_1: !input inovelli_red_2_in_1
inovelli_blue_2_in_1: !input inovelli_blue_2_in_1
trigger:
- platform: state
entity_id: !input weather_entity
action:
- choose:
- conditions:
- condition: template
value_template: 'True'
sequence:
repeat:
for_each:
- inovelli_switch
- inovelli_dimmer
- inovelli_fan_light_combo
- inovelli_red_2_in_1
- inovelli_blue_2_in_1
sequence:
choose:
- conditions: "{{ inovelli_dimmer|length > 0 and repeat.item == 'inovelli_dimmer' }}"
sequence:
# Set color for dimmers
- service: zwave_js.multicast_set_value
data:
command_class: '112'
property: '13'
value: "{{ color }}"
target: !input inovelli_dimmer
- conditions: "{{ inovelli_switch|length > 0 and repeat.item == 'inovelli_switch' }}"
sequence:
# Set color for switches
- service: zwave_js.multicast_set_value
data:
command_class: '112'
property: '5'
value: "{{ color }}"
target: !input inovelli_switch
- conditions: "{{ inovelli_fan_light_combo|length > 0 and repeat.item == 'inovelli_fan_light_combo' }}"
sequence:
# Set color for Fan/Light combo light
- service: zwave_js.multicast_set_value
data:
command_class: '112'
property: '18'
value: "{{ color }}"
target: !input inovelli_fan_light_combo
# Set color for Fan/Light combo fan
- service: zwave_js.multicast_set_value
data:
command_class: '112'
property: '20'
value: "{{ color }}"
target: !input inovelli_fan_light_combo
- conditions: "{{ inovelli_red_2_in_1|length > 0 and repeat.item == 'inovelli_red_2_in_1' }}"
sequence:
# Set color for Red 2-in-1 on
- service: zwave_js.multicast_set_value
data:
command_class: '112'
property: '95'
value: "{{ color }}"
target: !input inovelli_red_2_in_1
# Set color for Red 2-in-1 off
- service: zwave_js.multicast_set_value
data:
command_class: '112'
property: '96'
value: "{{ color }}"
target: !input inovelli_red_2_in_1
- conditions: "{{ inovelli_blue_2_in_1|length > 0 and repeat.item == 'inovelli_blue_2_in_1' }}"
sequence:
- repeat:
for_each: "{{ inovelli_blue_2_in_1.device_id }}"
sequence:
# Set color for Blue 2-in-1 off
- service: zha.set_zigbee_cluster_attribute
data:
cluster_type: in
endpoint_id: 1
cluster_id: 64561
attribute: 96
manufacturer: "4655"
ieee: >
{{ (device_attr(repeat.item, "identifiers")|list).0.1 }}
value: "{{ color }}"
# Set color for Blue 2-in-1 on
- service: zha.set_zigbee_cluster_attribute
data:
cluster_type: in
endpoint_id: 1
cluster_id: 64561
attribute: 95
manufacturer: "4655"
ieee: >
{{ (device_attr(repeat.item, "identifiers")|list).0.1 }}
value: "{{ color }}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment