[Z2M] Inovelli Blue Series Switch LED Notification Script (VZM31-SN, VZM35-SN)

Still not there yet, unfortunately:

Message malformed: required key not provided @ data['sequence']

When you imported the blueprint again did reload scripts?
I just imported the blueprint and created a new script to test and it works. :confused:

scripts.yaml

inovelli_blue_led_zigbee2mqtt:
  alias: Inovelli Blue LED (Zigbee2MQTT)
  use_blueprint:
    path: zanix/inovelli_blue_led_zigbee2mqtt.yaml
  mode: single
  icon: mdi:led-on

Service call yaml

service: script.inovelli_blue_led_zigbee2mqtt
data:
  color: Cyan
  level: 100
  effect: Fast Rising
  duration: 8 Seconds
  target:
    entity_id: light.office_switch
  command_path_map:
    light.office_switch: zigbee2mqtt/Office Switch/set
  enable_debug: true

Debug output

DEBUG: script.inovelli_blue_led

entity list: [‘light.office_switch’]
entity count: 1
led: all (-1)
color: Cyan (127)
level: 100
effect: Fast Rising (fast_rising)
duration: 8 Seconds (8)
command_path_map: {‘light.office_switch’: ‘zigbee2mqtt/Office Switch/set’}

DEBUG: script.inovelli_blue_led::light.office_switch

entity: light.office_switch
device name: Office Switch
topic: zigbee2mqtt/Office Switch/set
payload: {“led_effect”: {“color”: 127, “duration”: 8, “effect”: “fast_rising”, “level”: 100}}

I removed the script and blueprint completely, this happens when I’m trying to create a script from a blueprint.

I’m not sure what to do at this point. I am able to import it to my main and test Home Assistant instances.
Maybe check your scripts.yaml for errors

My scripts.yaml is empty, there was “[]” in it, but removing or re-adding it doesn’t change anything.
I’m looking at the code in Github, aren’t there extra spaces on the lines 476-482? It’s 6 of them before “sequence”, 8 before “- variables” and 12 before “command_path”. I’m not an expert, but the pattern seems to be a bit off :slight_smile:

      sequence:
        - variables:
            # Check for a command_path override.
            command_path: >-
              {% if repeat.item in command_path_map %}
                {{ command_path_map[repeat.item] }}
              {% else %}
                zigbee2mqtt/{{ device_attr(repeat.item, "name") }}/set
              {% endif %}

I use yamllint and an action on GitHub to check my yaml and the only issues it reports is “Line too long”.

When you import it, this section ends up looking like this.

- repeat:
    for_each: '{{ entity_list }}'
    sequence:
    - variables:
        command_path: "{% if repeat.item in command_path_map %}\n  {{ command_path_map[repeat.item]
          }}\n{% else %}\n  zigbee2mqtt/{{ device_attr(repeat.item, \"name\") }}/set\n{%
          endif %}"

As far as I know yaml, command_path is a child of variables so it should be indented like that.

Thanks for explaining. I’ll try adding it manually via scrips.yaml, I wasn’t able to do that right away, but I’ll give it another try

I figured it out, thanks a lot, @zanixmechanix! For some odd reason the code wasn’t downloaded into the file

/config/blueprints/script/zanixmechanix/z2m-inovelli-vzm31-sn-blue-series-2-1-switch-led-notification-script.yaml

I copied the code from GitHub there, manually, and the script works as expected! Thanks a lot for your support and patience!

That’s weird, glad it works now!

Was having the same issue, finally figured it out.
For anyone getting similar errors or not being able to get the script to load that previously used scripts in a folder, you might need to check your configuration.yaml and add

script: !include scripts.yaml
script manual: !include_dir_named scripts

When I try to use this blueprint it is not showing any inputs. What am I doing wrong?

I outlined the use of this blueprint in the original post just below the “Import Blueprint” button.
The idea is you create a script that references this blueprint, then you call the script using script fields rather than using blueprint inputs.

1 Like

I saw your original post before you got it working. Would it still be useful to offer this as a standard script in addition to a blueprint?

No need to. I was just a bit frustrated but it was 100% not your fault, HA should have a “repair” condition come up when they added the UI and blueprint script functionality for those of us that were already using scripts in yaml. Maybe add a note to the first post for anyone to check there !include references in configuration.yaml

I added some additional information to check configuration.yaml and included instructions for adding the blueprint using just yaml.

Hopefully it helps others if they run into the same issue.

Thanks for making this! Is there any chance you’d consider adapting a version for ZHA?

Probably not since I don’t use ZHA.
However, there is a thread on the Inovelli forum that mentions using device actions to control the LED bar.
Changing LED bar for notifications in HomeAssistant - Switches / General Discussion - Inovelli Community

Hey, quick question. Are we able to separate LED brightness for when a light switch is On and when it is Off? Currently, it looks like the LED brightness is the same for both.

Edit: Now that I have been playing around with the script for a bit. I see how the notification feature functions. I was looking for a way to change just the default LED color to a different one temporarily For example, while the door is unlocked all LED bars turn red. When locked, they turn back to blue.

While this script does give that functionality, making it a notification causes the loss of different brightnesses for when a switch is on or off and it loses the ability to see the current brightness of a light on the light switch.

Would you happen to know how easy or hard it would be to convert the script from notifications to regular LED colors?

You are correct, this Blueprint script only sets led_effect and individual_led_effect in Z2M.

If you want to set the default LED values, you can set the entities provided by the MQTT integration.
To find these, go to the device in Settings > Devices > MQTT > Device Name you will find LedColorWhenOff/On, LedIntensityWhenOff/On, and the per-LED variants DefaultLed#ColorWhenOff/On and DefaultLed#IntensityWhenOff/On.

Got it. Yeah, I see that. I tried editing the script a bit, but I think it’s a bit out of my wheelhouse for now. Maybe later down the line I’ll give it another go. Thanks for your help!