LZW45 Pixel Effects Script for Home Assistant

Here’s a link to the post on the home assistant forums.

Zwave 1.4 & Open Zwave

Script

lzw45_pixel_effect:
  alias: LZW45 Pixel Effect
  description: Sets the pixel effects for the Inovelli LZW45 LED Strip
  mode: restart
  fields:
    service: 
      description:
        (required) The name of the service. 
          OpenZwave (Beta) -> 'ozw.set_config_parameter'
          OpenZwave (1.4) -> 'zwave.set_config_parameter'
      example: ozw.set_config_parameter
    lzw45: 
      description: (required) The entity_id for the lzw45 LED Strip.
      example: light.lzw45_light_strip_level
    effect:
      description: (required) The desired effect - static, blink, breath, color-wipe, color-wipe-reverse-inverse, color-wipe-random, random-color, single-dynamic, multi-dynamic, rainbow, rainbow-cycle, scan, dual-scan, fade, running-lights, twinkle, twinkle-random, twinkle-fade, twinkle-fade-random, sparkle, flash-sparkle, hyper-sparkle, strobe, blink-rainbow, chase-white, chase-color, chase-random, chase-rainbow, chase-flash, chase-flash-random, chase-rainbow-white, chase-blackout, chase-blackout-rainbow, color-sweep-random, running-color, running-red-blue, running-random, larson-scanner, comet, fireworks, fireworks-random, merry-christmas, circus-combustus, halloween, aurora
      example: breath
    brightness_pct:
      description: (optional) The brightness percent, 0 - 99.  Defaults to 99 if omitted.
      example: 99
  variables:
    service: >
      {{ service | default('ozw.set_config_parameter') }}
    node_id: >
      {%- if lzw45 is not defined %}
        0
      {%- else %}
        {%- set node_id = state_attr(lzw45, 'node_id') %}
        {{ node_id if node_id else 0 }}
      {%- endif %}
    byte1: >
      {%- set effect = effect | default('static') | lower | replace(' ', '-') %}
      {%- set effects = [
        'static',
        'blink',
        'breath',
        'color-wipe',
        'color-wipe-reverse-inverse',
        'color-wipe-random',
        'random-color',
        'single-dynamic',
        'multi-dynamic',
        'rainbow',
        'rainbow-cycle',
        'scan',
        'dual-scan',
        'fade',
        'running-lights',
        'twinkle',
        'twinkle-random',
        'twinkle-fade',
        'twinkle-fade-random',
        'sparkle',
        'flash-sparkle',
        'hyper-sparkle',
        'strobe',
        'blink-rainbow',
        'chase-white',
        'chase-color',
        'chase-random',
        'chase-rainbow',
        'chase-flash',
        'chase-flash-random',
        'chase-rainbow-white',
        'chase-blackout',
        'chase-blackout-rainbow',
        'color-sweep-random',
        'running-color',
        'running-red-blue',
        'running-random',
        'larson-scanner',
        'comet',
        'fireworks',
        'fireworks-random',
        'merry-christmas',
        'circus-combustus',
        'halloween',
        'aurora'
      ] %}
      {{ effects.index(effect) + 1 if effect in effects else 1 }}
    byte2: >
      {%- set pct = (brightness_pct | default(99)) | int %}
      {%- if 0 <= pct <= 99 %}
        {{ pct }}
      {%- else %}
        99
      {%- endif %}
    bytes: >
      {{ byte2 * 2**8 + byte1 }}
  sequence:
  - condition: template
    value_template: "{{ node_id != 0 }}"
  - service: "{{ service }}"
    data:
      node_id: "{{ node_id }}"
      parameter: 31
      value: "{{ bytes }}"

Service

service: script.lzw45_pixel_effect_zwave_js
data:
  service: ozw.set_config_parameter
  lzw45: light.light_strip
  effect: aurora
  brightness_pct: 99

Zwave JS

Script

lzw45_pixel_effect:
  alias: LZW45 Pixel Effect
  description: Sets the pixel effects for the Inovelli LZW45 LED Strip
  mode: restart
  fields:
    lzw45: 
      description: (required) The entity_id for the lzw45 LED Strip.
      example: light.light_strip
    effect:
      description: (required) The desired effect - static, blink, breath, color-wipe, color-wipe-reverse-inverse, color-wipe-random, random-color, single-dynamic, multi-dynamic, rainbow, rainbow-cycle, scan, dual-scan, fade, running-lights, twinkle, twinkle-random, twinkle-fade, twinkle-fade-random, sparkle, flash-sparkle, hyper-sparkle, strobe, blink-rainbow, chase-white, chase-color, chase-random, chase-rainbow, chase-flash, chase-flash-random, chase-rainbow-white, chase-blackout, chase-blackout-rainbow, color-sweep-random, running-color, running-red-blue, running-random, larson-scanner, comet, fireworks, fireworks-random, merry-christmas, circus-combustus, halloween, aurora
      example: breath
    brightness_pct:
      description: (optional) The brightness percent, 0 - 99.  Defaults to 99 if omitted.
      example: 99
  variables:
    byte1: >
      {%- set effect = effect | default('static') | lower | replace(' ', '-') %}
      {%- set effects = [
        'static',
        'blink',
        'breath',
        'color-wipe',
        'color-wipe-reverse-inverse',
        'color-wipe-random',
        'random-color',
        'single-dynamic',
        'multi-dynamic',
        'rainbow',
        'rainbow-cycle',
        'scan',
        'dual-scan',
        'fade',
        'running-lights',
        'twinkle',
        'twinkle-random',
        'twinkle-fade',
        'twinkle-fade-random',
        'sparkle',
        'flash-sparkle',
        'hyper-sparkle',
        'strobe',
        'blink-rainbow',
        'chase-white',
        'chase-color',
        'chase-random',
        'chase-rainbow',
        'chase-flash',
        'chase-flash-random',
        'chase-rainbow-white',
        'chase-blackout',
        'chase-blackout-rainbow',
        'color-sweep-random',
        'running-color',
        'running-red-blue',
        'running-random',
        'larson-scanner',
        'comet',
        'fireworks',
        'fireworks-random',
        'merry-christmas',
        'circus-combustus',
        'halloween',
        'aurora'
      ] %}
      {{ effects.index(effect) + 1 if effect in effects else 1 }}
    byte2: >
      {%- set pct = (brightness_pct | default(99)) | int %}
      {%- if 0 <= pct <= 99 %}
        {{ pct }}
      {%- else %}
        99
      {%- endif %}
    bytes: >
      {{ byte2 * 2**8 + byte1 }}
  sequence:
  - condition: template
    value_template: "{{ lzw45 is defined }}"

  - service: zwave_js.bulk_set_partial_config_parameters
    target:
      entity_id: "{{ lzw45 }}"
    data:
      parameter: 31
      value: "{{ bytes }}"

Service

service: script.lzw45_pixel_effect_zwave_js
data:
  lzw45: light.light_strip
  effect: aurora
  brightness_pct: 99
3 Likes

Hey @petro

To confirm, this script currently still doesn’t work with zwave_js.set_config_parameter ?

No, the script needs to be updated. But there’s a larger issue at hand, partial parameters cannot be set currently as a full param. That is needed for these scripts to work.

Do we know why ZWaveJS adjusted how some of the parameters are set up? I’m a little confused why LZW30-SN and LZW45 had the the notification parameter broken up into several different parameters when both existed previously as a single parameter (8 and 21 respectfully) on OZW. It’s been something I’ve been a little curious about for a bit, but haven’t seen it written out online, curious if you happened to know :slight_smile:

I’m just happy the dimmer switches can still be configured with one parameter, I do rely on those effects more than anything else.

OZW stands for OpenZwave, which is a completely different driver than Zwave JS.

Oh I understand that, I guess each integration is designed in a particular way where OZW could combine all the parameters into one single field, whereas ZWaveJS cannot? I’m more just curious as to why it worked with one field in previous ZWave integrations but the same methods are no longer possible on Zwave JS.

I’m sure there’s a reason why this is, but maybe if it were possible to combine the fields into one again, we wouldn’t need to find a way to set partial parameters? (I obviously have no idea what I’m talking about, but something I was wondering none the less.

Noo… openzwave couldn’t. That’s why they were never separated. Zwavejs can separate them. Now we just need a way to combine them all and send them at the same time. Currently you can send them one at a time, but that doesn’t work with how the inovelli firmware works.

1 Like

Huh, maybe I misunderstood the problem then. I just remember with OZW I could set the light strips parameter 21 to a value which was the color + brightness + effect + duration in one, but that’s now separated out. Ditto for the on/off switch, but the dimmer stayed the same. I’ll keep my eyes out for possible changes or improvements for setting partial parameters at once in the future :slight_smile:

I did see your script for the lightstrip in another thread and how you’ve been working around the partial parameter limitation using MQTT, so I’ll probably go that route as well for the time being at least. Thanks for explaining it out!

Sorry to bump a thread that is a bit old. I have been sitting on my LZW45 for a few weeks now waiting for a free evening to play around. I am trying to add this script (ZWave-JS version) to Home Assistant and receiving an error “Message malformed: extra keys not allowed @ data[‘lzw45_pixel_effect’]”. I’m not sure where to go from this point to get Pixel Effects working. I appreciate any advice that the community can offer.

You’re calling the service wrong. Check my example against what you have in your config.

If you’re getting that error in configuration.yaml, you aren’t putting the script in the script section.

I should have included a bit more info in my original post.

I am getting this error when trying to save the script as a new script via yaml editor. I’m going to configuration > scripts > Add Script. I’m then going into YAML mode and pasting this script. The error presents once trying to press save.

I will admit I’m rather new to all of this, so I may not be putting this script in the correct place. Please let me know where I’ve gone astray.

Then remove the first line when pasting, the name is auto generated when you use the script editor in the UI.

Yeah I think the code above is to be pasted into the script.yaml in your files of HA. That is the “old fashioned” way of doing it. With the new UI the automation ID is auto-generated so you can delete the first line and undo the indent of the entire thing to the left by one.

@petro and @kreene1987 Thank you both so much. My first attempt resulted in bad indentation, but after another try the script went in as expected. I appreciate the help and I’m looking forward to learning more about these products and HA in general.

1 Like

Please mark as resolved (solution) on @petro 's post so we know the need is closed out! Thanks for reaching out.