--- # Calculation References: # https://nathanfiscus.github.io/inovelli-notification-calc/ # https://community.inovelli.com/t/home-assistant-2nd-gen-switch-rgb-working/168/62 # https://docs.google.com/spreadsheets/u/1/d/1SGJrJHCUtz8AzznWL_mLCTJjjr2U0IpltcUkRr7N_6M/edit?usp=sharing # # Changes: # July 22, 2020: Incorporating changes from Kevin Schlichter. # https://github.com/kschlichter/Home-Assistant-Inovelli-Red-Dimmer-Switch # # September 17, 2020: There are some massive improvements to my version of this code. Here are the highlights: # 1. Choose - using the recently added choose: feature a separate call has been created for the Z-wave and OZW # versions of the service call. # 2. Variables - using 0.115’s new variables: feature the variables sent each service call only have to be # calculated once. # 3. Supported Features - I realized that I could probably tell the difference between modules using the # “supported_features” attribute of each switch. For example my dimmer’s supported features is “33”. # # September 18, 2020: Added "model" parameter with options of dimmer, switch, combo_light, combo_fan. This replaces # supported_features as the combo fan/light switch also had the same supported_features value. # variables: model: | {% if model is string %} {{ model }} {%- elif state_attr(entity_id, 'product_name') is string %} {%- if 'LZW31' in state_attr(entity_id, 'product_name') %} dimmer {%- elif 'LZW36' in state_attr(entity_id, 'product_name') %} combo_light {%- else %} switch {%- endif %} {%- else %} dimmer {%- endif %} parameters: dimmer: 16 combo_light: 24 combo_fan: 25 switch: 8 color: | {%- if color is not number %} {{ color|default("Yellow") }} {%- else %} {{ color|int }} {% endif %} # 1-10 level: '{{ level|default(4) }}' duration: '{{ duration|default("Indefinitely") }}' effect: '{{ effect|default("Blink") }}' colors: "Off": 0 "Red": 1 "Orange": 21 "Yellow": 42 "Green": 85 "Cyan": 127 "Teal": 145 "Blue": 170 "Purple": 195 "Light Pink": 220 "Pink": 234 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": 0 "Solid": 1 "Fast Blink": 2 "Slow Blink": 3 "Blink": 3 "Pulse": 4 "Breath": 4 sequence: # Preform the Inovelli math. - variables: parameter: '{{ parameters[model|default("dimmer")] }}' color: '{{ colors[color|default("purple")|title] }}' duration: '{{ durations[duration|default("10 Seconds")|title] }}' effect: | {% if model == "switch" %} {{- effects_switch[effect|default("Blink")|title]|int }} {%- else %} {{- effects_dimmer[effect|default("Blink")|title]|int }} {% endif %} inovelli_math: | {%- if effect|int > 0 %} {{ color|int + (level|int * 256) + (duration|int * 65536) + (effect|int * 16777216) }} {%- else %} 0 {% endif %} # - service: script.debug # data: # id: "inovelli_led" # message: | # node_id: '{{ state_attr(entity_id,"node_id") }}' # parameter: '{{ parameter }}' # value: '{{ inovelli_math }}' - choose: # The Z-wave integration requires this service call. - conditions: - '{{ entity_id.split(".")[0] == "zwave" }}' sequence: # Clear the previous effect. - service: zwave.set_config_parameter data_template: node_id: '{{ state_attr(entity_id,"node_id") }}' parameter: '{{ parameter }}' size: 4 value: '0' # Start the new effect. - service: zwave.set_config_parameter data_template: node_id: '{{ state_attr(entity_id,"node_id") }}' parameter: '{{ parameter }}' size: 4 value: '{{ inovelli_math }}' # The OZW integration requires this service call. default: # Clear the previous effect. - service: ozw.set_config_parameter data_template: node_id: '{{ state_attr(entity_id,"node_id") }}' parameter: '{{ parameter }}' value: '0' # Start the new effect. - service: ozw.set_config_parameter data_template: node_id: '{{ state_attr(entity_id,"node_id") }}' parameter: '{{ parameter }}' value: '{{ inovelli_math }}'