ZWave-JS - Inovelli LZW31-SN Red-Series Dimmer

Based on the OZW blueprint by @troy

This is a blueprint for triggering actions based on presses of the On/Off/Config buttons of the Inovelli LZW31 Red-Series Dimmer using the new ZWave-JS Integration.

blueprint:
  name: Inovelli Red Series LZW31-SN Dimmer (ZWave-JS)
  description: Create automations for the Inovelli Red Series LZW31-SN Dimmer using the ZWave-JS integration. 
  domain: automation
  input:
    inovelli_switch:
      name: Inovelli Dimmer
      description: "List of available inovelli LZW31-SN dimmers."
      selector:
          device:
            integration: zwave_js
            manufacturer: Inovelli
            model: LZW31-SN
    ## Config Press 1 time
    config_button:
      name: Button C - Config press 1x
      description: "Action to run, when the config button is pressed one time."
      default: []
      selector:
        action: {}
    ## Paddle Press 1 time
    button_a:
      name: Button A - Up/On press 1x
      description: "Action to run, when the button is pressed one time."
      default: []
      selector:
        action: {}
    button_b:
      name: Button B - Down/Off press 1x
      description: "Action to run, when the button is pressed one time."
      default: []
      selector:
        action: {}
    ## Paddle Held Down
    button_a_held:
      name: Button A - Up/On held down
      description: "Action to run, when the button is held down."
      default: []
      selector:
        action: {}
    button_b_held:
      name: Button B - Down/Off held down
      description: "Action to run, when the button is held down."
      default: []
      selector:
        action: {}
    ## Paddle Press 2 times
    button_a2:
      name: Button A - Up/On press 2x
      description: "Action to run, when the button is pressed two times."
      default: []
      selector:
        action: {}
    button_b2:
      name: Button B - Down/Off press 2x
      description: "Action to run, when the button is pressed two times."
      default: []
      selector:
        action: {}
    ## Paddle Press 3 times
    button_a3:
      name: Button A - Up/On press 3x
      description: "Action to run, when the button is pressed three times."
      default: []
      selector:
        action: {}
    button_b3:
      name: Button B - Down/Off press 3x
      description: "Action to run, when the button is pressed three times."
      default: []
      selector:
        action: {}
    ## Paddle Press 4 times
    button_a4:
      name: Button A - Up/On press 4x
      description: "Action to run, when the button is pressed four times."
      default: []
      selector:
        action: {}
    button_b4:
      name: Button B - Down/Off press 4x
      description: "Action to run, when the button is pressed four times."
      default: []
      selector:
        action: {}
    ## Paddle Press 5 times
    button_a5:
      name: Button A - Up/On press 5x
      description: "Action to run, when the button is pressed five times."
      default: []
      selector:
        action: {}
    button_b5:
      name: Button B - Down/Off press 5x
      description: "Action to run, when the button is pressed five times."
      default: []
      selector:
        action: {}
mode: single
max_exceeded: silent
variables:
  device_id: !input inovelli_switch
trigger:
  - platform: event
    event_type: zwave_js_value_notification
condition: "{{ trigger.event.data.device_id == device_id }}"
action:
  - variables:
      button_id: "{{ trigger.event.data.property_key_name }}"
      press_count: "{{ trigger.event.data.value }}"
  - service: "logbook.log"
    data:
      name: "Button Id"
      message: "{{ button_id }}"
  - service: "logbook.log"
    data:
      name: "Press Count"
      message: "{{ press_count }}"
  - service: "logbook.log"
    data:
      name: "Device"
      message: "{{ zwave_device }}"
  - choose:
    - conditions: '{{ button_id == "003" and press_count == "KeyPressed" }}'
      sequence: !input config_button
    - conditions: '{{ button_id == "002" and press_count == "KeyPressed" }}'
      sequence: !input button_a
    - conditions: '{{ button_id == "001" and press_count == "KeyPressed" }}'
      sequence: !input button_b
    - conditions: '{{ button_id == "002" and press_count == "KeyHeldDown" }}'
      sequence: !input button_a_held
    - conditions: '{{ button_id == "001" and press_count == "KeyHeldDown" }}'
      sequence: !input button_b_held
    - conditions: '{{ button_id == "002" and press_count == "KeyPressed2x" }}'
      sequence: !input button_a2
    - conditions: '{{ button_id == "001" and press_count == "KeyPressed2x" }}'
      sequence: !input button_b2
    - conditions: '{{ button_id == "002" and press_count == "KeyPressed3x" }}'
      sequence: !input button_a3
    - conditions: '{{ button_id == "001" and press_count == "KeyPressed3x" }}'
      sequence: !input button_b3
    - conditions: '{{ button_id == "002" and press_count == "KeyPressed4x" }}'
      sequence: !input button_a4
    - conditions: '{{ button_id == "001" and press_count == "KeyPressed4x" }}'
      sequence: !input button_b4
    - conditions: '{{ button_id == "002" and press_count == "KeyPressed5x" }}'
      sequence: !input button_a5
    - conditions: '{{ button_id == "001" and press_count == "KeyPressed5x" }}'
      sequence: !input button_b5

Edit 4/7/21: Updated to support HA 2021.4.0 release

21 Likes

This is great and has saved me a ton of time trying to find out button ids and press_counts variable keys. It seems you can only program 1 type of button press condition per set of actions. I wonder if it would be possible to set multiple button press configurations with different actions all in one automation? That would make each switch much more organized when they have different actions for different button presses vs having like 6 automations to handle them all.

You should be able to use all the actions in the same automation. What part is causing the problems?

Let me try again and get the error.

It must have been an unrelated error (lots of config changes due to migrating to zwavejs)! It works GREAT! This is amazing. Thank you for the work you did on this.

This breaks with the latest version of Home Assistant/zwavejs (probably the latter).

It looks like the nice values have been replaced with integers, i.e. KeyPressed => 0, KeyPressed2x => 3.

I haven’t had a chance to dig in deeper as to why.

edit: Looks like it’s a bug in Home Assistant

UPDATE: This works for 2021.03.0 ONLY. Use Jeremy’s original version above for 2021.03.1 and above.


@jerelabs Here is a version fixed for Home Assistant 2021.03.0. These are fixes that I used in my personal automation. I have tested it out with every click combination (including holding down the buttons, which I’ve never tried before).

This is my first time playing with Blueprints and I see why everyone is excited about them now! :slight_smile:

blueprint:
  name: Inovelli Red Series LZW31-SN Dimmer (ZWave-JS)
  description: Create automations for the Inovelli Red Series LZW31-SN Dimmer using the ZWave-JS integration. 
  domain: automation
  input:
    inovelli_switch:
      name: Inovelli Dimmer
      description: "List of available inovelli LZW31-SN dimmers."
      selector:
          device:
            integration: zwave_js
            manufacturer: Inovelli
            model: LZW31-SN
    ## Config Press 1 time
    config_button:
      name: Button C - Config press 1x
      description: "Action to run, when the config button is pressed one time."
      default: []
      selector:
        action: {}
    ## Paddle Press 1 time
    button_a:
      name: Button A - Up/On press 1x
      description: "Action to run, when the button is pressed one time."
      default: []
      selector:
        action: {}
    button_b:
      name: Button B - Down/Off press 1x
      description: "Action to run, when the button is pressed one time."
      default: []
      selector:
        action: {}
    ## Paddle Held Down
    button_a_held:
      name: Button A - Up/On held down
      description: "Action to run, when the button is held down."
      default: []
      selector:
        action: {}
    button_b_held:
      name: Button B - Down/Off held down
      description: "Action to run, when the button is held down."
      default: []
      selector:
        action: {}
    ## Paddle Press 2 times
    button_a2:
      name: Button A - Up/On press 2x
      description: "Action to run, when the button is pressed two times."
      default: []
      selector:
        action: {}
    button_b2:
      name: Button B - Down/Off press 2x
      description: "Action to run, when the button is pressed two times."
      default: []
      selector:
        action: {}
    ## Paddle Press 3 times
    button_a3:
      name: Button A - Up/On press 3x
      description: "Action to run, when the button is pressed three times."
      default: []
      selector:
        action: {}
    button_b3:
      name: Button B - Down/Off press 3x
      description: "Action to run, when the button is pressed three times."
      default: []
      selector:
        action: {}
    ## Paddle Press 4 times
    button_a4:
      name: Button A - Up/On press 4x
      description: "Action to run, when the button is pressed four times."
      default: []
      selector:
        action: {}
    button_b4:
      name: Button B - Down/Off press 4x
      description: "Action to run, when the button is pressed four times."
      default: []
      selector:
        action: {}
    ## Paddle Press 5 times
    button_a5:
      name: Button A - Up/On press 5x
      description: "Action to run, when the button is pressed five times."
      default: []
      selector:
        action: {}
    button_b5:
      name: Button B - Down/Off press 5x
      description: "Action to run, when the button is pressed five times."
      default: []
      selector:
        action: {}
mode: single
max_exceeded: silent
trigger:
  - platform: event
    event_type: zwave_js_event
variables:
  device_id: !input inovelli_switch
  presses: |
    {% set value = trigger.event.data.value %}
    {% if value is number %}
      {% if value|int == 1 %}
        KeyHeldRelease
      {% elif value|int == 2 %}
        KeyHeldDown
      {% elif value|int == 0 %}
        1
      {% else %}
        {{ value|int - 1 }}
      {% endif %}
    {% else %}
      {{ value|replace("KeyPressed","")|replace("x","") }}
    {% endif %}
  button: |
    {% if trigger.event.data.property_key_name|int == 1 %}
      bottom
    {% elif trigger.event.data.property_key_name|int == 2 %}
      top
    {% elif trigger.event.data.property_key_name|int == 3 %}
      config
    {% endif %}
condition: "{{ trigger.event.data.device_id == device_id }}"
action:
  # - service: "logbook.log"
  #   data:
  #     name: "Button"
  #     message: "{{ button }}"
  # - service: "logbook.log"
  #   data:
  #     name: "Presses"
  #     message: "{{ presses }}"
  - choose:
    - conditions: '{{ button == "config" }}'
      sequence: !input config_button
    - conditions: '{{ button == "top" and presses|int == 1 }}'
      sequence: !input button_a
    - conditions: '{{ button == "bottom" and presses|int == 1 }}'
      sequence: !input button_b
    - conditions: '{{ button == "top" and presses == "KeyHeldDown" }}'
      sequence: !input button_a_held
    - conditions: '{{ button == "bottom" and presses == "KeyHeldDown" }}'
      sequence: !input button_b_held
    - conditions: '{{ button == "top" and presses|int == 2 }}'
      sequence: !input button_a2
    - conditions: '{{ button == "bottom" and presses|int == 2 }}'
      sequence: !input button_b2
    - conditions: '{{ button == "top" and presses|int == 3 }}'
      sequence: !input button_a3
    - conditions: '{{ button == "bottom" and presses|int == 3 }}'
      sequence: !input button_b3
    - conditions: '{{ button == "top" and presses|int == 4 }}'
      sequence: !input button_a4
    - conditions: '{{ button == "bottom" and presses|int == 4 }}'
      sequence: !input button_b4
    - conditions: '{{ button == "top" and presses|int == 5 }}'
      sequence: !input button_a5
    - conditions: '{{ button == "bottom" and presses|int == 5 }}'
      sequence: !input button_b5
1 Like

Thanks for sharing!

If you use trigger.event.data.value_raw instead your Blueprint won’t break when they fix the bug :slight_smile:.

I had this is node-red before, wish I could figure it out again.

Jeremy’s original version above should work again with the Z-Wave JS event value fix in Home Assistant 2012.03.1 (https://github.com/home-assistant/core/pull/47408).

Thanks for the contribution, this is great!

UPDATE : After banging my head on my desk trying to get HA to see my switch correctly (restarting the server, updating ZwaveJS, restarting the integration, etc. etc.), I excluded it and re-added it. HA was able to see it properly the second time and now it’s listed as available for the Blueprint to use. Thanks!

Super basic question - I’m transitioning from Hubitat and only got HA with Z-Wave JS up and running yesterday. How do I assign this to a LZW31-SN device I have already linked via Z-Wave JS? I don’t see any way to tell HA that it’s an Inovelli device.

I’ve added the Blueprint, but when I go to use it, it doesn’t seem to find my LZW31-SN as a suitable device (it doesn’t show up in the drop-down).

I think there was a breaking change in the April update. zwave_event went to zwave_js_value_notification

1 Like

Updated the blueprint to support the April 2021 release. Please let me know if there are any issues and I’ll update.

5 Likes

Is anyone able to use set_config_parameter to get this to change colors or anything?

Thanks for the update, now some of my automations which broke during the April update work again.

I have a problem that many of my Inovelliy LZW31-SN devices show “unknown” as Manufacturer and Model. They work fine, but I cannot select these in your blueprint, they don’t show up in the Device drop-down.

Any idea how I can “force” these devices to show the correct values for Manufacturer and Model?

/Hermann

How is everyone using this to emulate dimming for a smart bulb? I would like to dim/brighten my Hue bulbs using the held down and maybe add the released event. It would be nice to do it all within the same blueprint but it seems that you just get a single held down and released event.

Thanks in advanced for any ideas.

Jason

2 Likes

Echoing what jrhubott said, this is still the missing piece for me (using these with Hue bulbs). I’d really love to be able to use press and hold dimming.

2 Likes

Anyone figure out the Hue dimming with this blueprint?

1 Like

Anyone know why I would be getting this error:

Error: UndefinedError: ‘dict object’ has no attribute ‘event’

Step ConfigChanged VariablesRelated logbook entries

I can’t get any automations to work using the blueprint. When I click the defined button - in this case the C button, it fires the event, but it does not do the next steps and ends up with that error.