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
2 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!