ZHA - Inovelli Blue Series 2-1 Switch LED Notification Script

A script blueprint to control the LED notification bar on the Inovelli VZM31-SN or VZM35-SN Blue Series 2-1 Switch via ZHA. This script is based on the Z2M-equivalent script and templates shared on Inovelli’s forums.

Features:

  • Only need to create one script using the blueprint
    • All variables, including target switch, are passed when calling the script rather than when configuring it, allowing you to reuse the same script for any Inovelli switch
  • Select from different preset animations + off and clear
  • Provide custom color, brightness and duration for each script call

Requirements

  • ZHA (for Zigbee2MQTT, see this blueprint)
  • An Inovelli VZM31-SN (Light) or VZM35-SN (Fan) Blue Series 2-1 Switch added to your ZigBee network in Home Assistant

Blueprint

Open your Home Assistant instance and show the blueprint import dialog with a specific blueprint pre-filled.

# 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 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_notification_led_zha.yaml
  domain: script
fields:
  switch:
    name: Inovelli Switch
    description: Which light switch to program
    required: true
    selector:
      device:
        filter:
          - integration: zha
            manufacturer: Inovelli
            model: VZM31-SN
          - integration: zha
            manufacturer: Inovelli
            model: VZM35-SN
  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"
  effect:
    name: Effect
    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"
    required: true
    selector:
      select:
        # 'Chase' is legacy, but still supported (equates to 'Medium Chase')
        options:
          - "Off"
          - "Clear"
          - "Solid"
          - "Slow Blink"
          - "Medium Blink"
          - "Fast Blink"
          - "Pulse"
          - "Aurora"
          - "Slow Falling"
          - "Medium Falling"
          - "Fast Falling"
          - "Slow Rising"
          - "Medium Rising"
          - "Fast Rising"
          - "Slow Siren"
          - "Fast Siren"
          - "Chase"
          - "Slow Chase"
          - "Medium Chase"
          - "Fast Chase"
          - "Open-Close"
          - "Small-Big"
    default: "Solid"

  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)
    required: false
    selector:
      number:
        min: 0
        max: 255

  color_preset:
    name: Color Preset
    description: Special color preset to use (overrides color setting and LED selection)
    required: false
    selector:
      select:
        options:
          - "Warm"
          - "Cool"
          - "Rainbow"
          - "Police"

variables:
  all_led_mode_value: -1
  led_values:
    "all": >
      {{ all_led_mode_value }}
    "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 }}

  # 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
  # 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
  effect: '{{ effect|default("solid") }}'
  effect_value: >
    {% set val = effect_values[effect | lower] | int %}
    {% if led_value != all_led_mode_value and val not in single_led_compatible_effect_values %}
      {% set val = effect_values["solid"] | int %}
    {% endif %}
    {{ val }}

  color: "{{ color|default(255) }}"

  special_color_preset: '{{ color_preset|default("none") }}'
  use_special_color_preset: >
    {{ special_color_preset != "none" }}

  # Max 7 colors, starting from the bottom LED
  special_colors_orders:
    "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]
    "police": [165, 165, 255, 255, 255, 0, 0]

  special_color_order: >
    {{ special_colors_orders[special_color_preset | lower] }}

sequence:
  - 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
              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
        # 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

mode: single
max_exceeded: silent

Install

  1. Click the “Import Blueprint” button above and follow the instructions to import the blueprint into your Home Assistant.
  2. Click “Create Script” from the Blueprint. No configuration is needed. You only need one copy of this script, so name it something generic such as “Inovelli LED Notification”

Usage

  1. Call the script via a service call in an automation, in Developer Tools, or in another script.
    • Select the target Inovelli switch from the drop down.
    • Select the target LED or All to apply the effect to all LEDs (there are 7 LEDs in the light bar)
      • Defaults to All
    • Select the specific effect from the drop down.
      • Some effects can only be applied to all LEDs instead of a single LED. If an invalid pair is selected, the effect will be overridden to “Solid”
    • Indicate the specific duration (in seconds), intensity (percentage) and color with the sliders.
    • Select a color for the LED(s)
      • Use this calculator to determine the color value
      • Optionally, select a color preset instead.
        • A color preset will be applied to all LEDs (overrides the individual LED selection)

Changelog:

  • June 8, 2023: Initial release
  • Aug 10, 2023:
    • Add additional effects (thanks @emergent )
    • Improve effect calculation (a lot less repetitive code!)
  • Aug 10, 2023 (again):
    • Add ability to set single LED or all LEDs (thanks @diegomorales17 )
    • Add custom color presets (e.g. “rainbow”)
    • Handle errors where only certain effects are available in single-LED mode versus all-LED mode
  • Aug 11, 2023:
    • Add Warm, Cool and Police custom color presets
    • Improve handling single- versus all-LED effects
  • Oct 31, 2023:
    • Remove model restriction, enabling VZM35-SN usage
  • Oct 23, 2024:
    • Improve model filtering (don’t allow non-ZHA Inovelli switches)

Thanks

3 Likes

I can’t seem to get this to work when I add it as a parallel task within the Inovelli Automation blueprint.

Specifically I wanted to use this to set a different animation on the Down Paddle press from the default animation. When I set it to that action it works only if the light is already off - in other words it does not override the default down animation of the LEDs when the lights are in the On position to begin with.

So I know it is working when the lights are already off but if they are on (and the LED light bar is on) it does the standard lowering animation and never triggers this script.

Hmm, interesting. I’ll see if I can replicate this and figure out a solution.

It sounds like you might need to disable the default on/off LED light color/intensity settings and use this script as the only thing modifying the LED light.

I personally have the LED disabled for both on and off states, so I haven’t had to compete with the built-in on-to-off animation.
image

This thread on Inovelli’s forum seems to be about the same thing.

The blueprint was missing a bunch of effects which I assume have only been recently released (I only got my Inovelli switches a few days ago so I have no idea). I made an updated version of the blueprint that adds these missing effects. I put it below or it can be imported from here:

# 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
  effect:
    name: Effect
    description: Effect to use
    required: true
    selector:
      select:
        options:
          - "Off"
          - "Clear Effect"
          - "Solid"
          - "Slow Blink"
          - "Medium Blink"
          - "Fast Blink"
          - "Pulse"
          - "Aurora"
          - "Slow Falling"
          - "Medium Falling"
          - "Fast Falling"
          - "Slow Rising"
          - "Medium Rising"
          - "Fast Rising"
          - "Slow Chase"
          - "Medium Chase"
          - "Fast Chase"
          - "Open-Close"
          - "Small-Big"
  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)
    required: true
    selector:
      number:
        min: 0
        max: 255

sequence:
  - choose:
      - conditions:
          - condition: template
            value_template: >
              {{ effect == "Off"}}
        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
              command: 1
              command_type: server
              args:
                - 0
                - "{{ color }}"
                - "{{ level }}"
                - "{{ duration }}"
              manufacturer: 4655
      - conditions:
          - condition: template
            value_template: >
              {{ effect == "Clear Effect"}}
        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
              command: 1
              command_type: server
              args:
                - 255
                - "{{ color }}"
                - "{{ level }}"
                - "{{ duration }}"
              manufacturer: 4655
      
      - conditions:
          - condition: template
            value_template: >
              {{ effect == "Solid"}}
        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
              command: 1
              command_type: server
              args:
                - 1
                - "{{ color }}"
                - "{{ level }}"
                - "{{ duration }}"
              manufacturer: 4655
      - conditions:
          - condition: template
            value_template: >
              {{ effect == "Slow Blink"}}
        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
              command: 1
              command_type: server
              args:
                - 3
                - "{{ color }}"
                - "{{ level }}"
                - "{{ duration }}"
              manufacturer: 4655
              
      - conditions:
          - condition: template
            value_template: >
              {{ effect == "Medium Blink"}}
        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
              command: 1
              command_type: server
              args:
                - 15
                - "{{ color }}"
                - "{{ level }}"
                - "{{ duration }}"
              manufacturer: 4655
      - conditions:
          - condition: template
            value_template: >
              {{ effect == "Fast Blink"}}
        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
              command: 1
              command_type: server
              args:
                - 3
                - "{{ color }}"
                - "{{ level }}"
                - "{{ duration }}"
              manufacturer: 4655
      - conditions:
          - condition: template
            value_template: >
              {{ effect == "Pulse"}}
        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
              command: 1
              command_type: server
              args:
                - 4
                - "{{ color }}"
                - "{{ level }}"
                - "{{ duration }}"
              manufacturer: 4655
      - conditions:
          - condition: template
            value_template: >
              {{ effect == "Aurora"}}
        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
              command: 1
              command_type: server
              args:
                - 8
                - "{{ color }}"
                - "{{ level }}"
                - "{{ duration }}"
              manufacturer: 4655
      - conditions:
          - condition: template
            value_template: >
              {{ effect == "Slow Falling"}}
        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
              command: 1
              command_type: server
              args:
                - 9
                - "{{ color }}"
                - "{{ level }}"
                - "{{ duration }}"
              manufacturer: 4655
      - conditions:
          - condition: template
            value_template: >
              {{ effect == "Medium Falling"}}
        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
              command: 1
              command_type: server
              args:
                - 10
                - "{{ color }}"
                - "{{ level }}"
                - "{{ duration }}"
              manufacturer: 4655
      - conditions:
          - condition: template
            value_template: >
              {{ effect == "Fast Falling"}}
        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
              command: 1
              command_type: server
              args:
                - 11
                - "{{ color }}"
                - "{{ level }}"
                - "{{ duration }}"
              manufacturer: 4655
      - conditions:
          - condition: template
            value_template: >
              {{ effect == "Slow Rising"}}
        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
              command: 1
              command_type: server
              args:
                - 12
                - "{{ color }}"
                - "{{ level }}"
                - "{{ duration }}"
              manufacturer: 4655
      - conditions:
          - condition: template
            value_template: >
              {{ effect == "Medium Rising"}}
        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
              command: 1
              command_type: server
              args:
                - 13
                - "{{ color }}"
                - "{{ level }}"
                - "{{ duration }}"
              manufacturer: 4655
      - conditions:
          - condition: template
            value_template: >
              {{ effect == "Fast Rising"}}
        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
              command: 1
              command_type: server
              args:
                - 14
                - "{{ color }}"
                - "{{ level }}"
                - "{{ duration }}"
              manufacturer: 4655
      - conditions:
          - condition: template
            value_template: >
              {{ effect == "Slow Chase"}}
        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
              command: 1
              command_type: server
              args:
                - 16
                - "{{ color }}"
                - "{{ level }}"
                - "{{ duration }}"
              manufacturer: 4655
      - conditions:
          - condition: template
            value_template: >
              {{ effect == "Medium Chase"}}
        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
              command: 1
              command_type: server
              args:
                - 2
                - "{{ color }}"
                - "{{ level }}"
                - "{{ duration }}"
              manufacturer: 4655
      - conditions:
          - condition: template
            value_template: >
              {{ effect == "Fast Chase"}}
        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
              command: 1
              command_type: server
              args:
                - 17
                - "{{ color }}"
                - "{{ level }}"
                - "{{ duration }}"
              manufacturer: 4655
      - conditions:
          - condition: template
            value_template: >
              {{ effect == "Open-Close"}}
        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
              command: 1
              command_type: server
              args:
                - 6
                - "{{ color }}"
                - "{{ level }}"
                - "{{ duration }}"
              manufacturer: 4655
      - conditions:
          - condition: template
            value_template: >
              {{ effect == "Small-Big"}}
        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
              command: 1
              command_type: server
              args:
                - 7
                - "{{ color }}"
                - "{{ level }}"
                - "{{ duration }}"
              manufacturer: 4655
mode: parallel
max: 100```

Nice! Where did you find these additional effects?

https://inovelliusa.github.io/inovelli-switch-toolbox/

Thanks! There were a couple issues with the blueprint you made, so I went ahead and added in the new effects you discovered into my original blueprint (and took the opportunity to clean up some really messy code I had originally).

@nwithan8 I took some of your ideas in consideration for another blueprint that takes targets (such as areas, devices, entities) and iterates over all switches found that correspond with the target. This way you can use only one script to send animations to multiple switches at a time. Would love your feedback! Thanks

ZHA - Inovelli Blue Series Animated Notifications to single or multiple switches simultaneously!

I don’t see the siren ones listed in the calculator. Did you just try different numbers to see if they worked?

Yep, pretty much :slight_smile:

I know even more exist, because Z2M has support for them: https://github.com/zanix/home-assistant-blueprints/blob/3375e30ec6c527cd9008f9afbba9e08b735a5722/script/inovelli_blue_led_zigbee2mqtt.yaml#L94

Just need to dive into the Z2M source to figure out what numbers these map to.

I’m liking the custom color presets, I might have to add that to my blueprint.

1 Like

Trying to do some prep work while I patiently wait for two of my inovelli pre-orders. For those of you who have devices on hand, are the LED effects synced between the 7 different sites? i.e. if I have a script that runs 7 actions to set each LED to its desired state will those set to slow blink, slow blink synchronously? Or will it depend on the timing of the command? Will using the ‘Run Parallel’ action cut down this timing difference or would the delay between zigbee transmissions ruin any chance at being in sync?

There will always be a slight delay because it is having to send 7 separate commands. That said, the delay is usually inperceptible.

Okay so with some careful timing in a script I could get multiple led sites in phase and out of phase? I’m thinking of making notifications for the weather forecast at the start of the day and I want to build one for rain that has alternating slow blink blue leds.

Just used this blueprint after getting my first switches and it works great! Quick question: does it only work for light switches and not the fan switch? Just wanted to make sure I wasn’t doing anything wrong since only my light switch appears in the drop down. Thanks!

1 Like

Not sure, I actually just got some fan switches myself this week, I’ll make sure they work and/or update the blueprint!

I have updated the blueprint to allow for the fan version as well!

Thank you! You’re the best!!!

1 Like

This script is throwing issues for me all of a sudden whenever I call it. A trace on the script shows:

Error: Failed to issue cluster command with status: <Status.FAILURE: 1>

The LED bar does not display the notifications I specified in the action call.

EDIT: Nevermind, I had chosen some incompatible options (like an effect and a color). Sorry, don’t mind me!