Skip to content

Instantly share code, notes, and snippets.

@mitchcapper
Last active April 12, 2024 22:12
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save mitchcapper/ce031de253c0300a7141f43a6e1a405c to your computer and use it in GitHub Desktop.
Save mitchcapper/ce031de253c0300a7141f43a6e1a405c to your computer and use it in GitHub Desktop.
Home Assistant Blueprint - Inovelli On/Off or Dimmer Scene to Actions ZWave-JS Version
# Note for black dimmer series you need very specific firmware versions to support scenes: https://support.inovelli.com/portal/en/kb/articles/firmware-change-log-lzw31-dimmer-switch-black-series
blueprint:
name: Inovelli On/Off or Dimmer Switch Scenes (ZWave-JS)
description: >
Perform actions on various scenes supported by the Inovelli On/Off or Dimmer Switches
Note that the x2, x3, x4, x5 variants DO NOT work if you have put your switch in 'Instant On' mode.
Note for black dimmer series you need very specific firmware versions to support scenes: https://support.inovelli.com/portal/en/kb/articles/firmware-change-log-lzw31-dimmer-switch-black-series
domain: automation
input:
inovelli_switch:
name: Inovelli On/Off Switch
description: The Inovelli On/Off or Dimmer Switch to do actions on
selector:
device:
multiple: true
integration: zwave_js
manufacturer: Inovelli
up_action:
name: Press Up Once Action
description: Action to perform when pressing up once
default: []
selector:
action:
down_action:
name: Press Down Once Action
description: Action to perform when pressing down once
default: []
selector:
action:
up_hold_action:
name: Hold Up Action
description: Action to perform when holding the up button
default: []
selector:
action:
up_release_action:
name: Release Up Action
description: Action to perform when releasing the up button
default: []
selector:
action:
down_hold_action:
name: Hold Down Action
description: Action to perform when holding the down button
default: []
selector:
action:
down_release_action:
name: Release Down Action
description: Action to perform when releasing the down button
default: []
selector:
action:
config_action:
name: Config Button Action
description: The action to perform when the config button is pressed once
default: []
selector:
action:
up_x2_action:
name: Press Up Twice Action
description: Action to perform when pressing up twice
default: []
selector:
action:
down_x2_action:
name: Press Down Twice Action
description: Action to perform when pressing down twice
default: []
selector:
action:
up_x3_action:
name: Press Up 3 Times Action
description: Action to perform on when pressing up 3 times
default: []
selector:
action:
down_x3_action:
name: Press Down 3 Times Action
description: Action to perform when pressing down 3 times
default: []
selector:
action:
up_x4_action:
name: Press Up 4 Times Action
description: Action to perform when pressing up 4 times
default: []
selector:
action:
down_x4_action:
name: Press Down 4 Times Action
description: Action to perform when pressing down 4 times
default: []
selector:
action:
up_x5_action:
name: Press Up 5 Times Action
description: Action to perform when pressing up 5 times
default: []
selector:
action:
down_x5_action:
name: Press Down 5 Times Action
description: Action to perform when pressing down 5 times
default: []
selector:
action:
mode: parallel
max_exceeded: silent
variables:
# Mappings from https://support.inovelli.com/portal/en/kb/articles/how-to-setting-up-scenes-in-home-assistant
# Buttons (scene_id)
down_button: "001"
up_button: "002"
config_button: "003"
# Action types (scene_value_id)
press_x1: "KeyPressed"
press_x2: "KeyPressed2x"
press_x3: "KeyPressed3x"
press_x4: "KeyPressed4x"
press_x5: "KeyPressed5x"
hold: "KeyHeldDown"
release: "KeyReleased"
# Shorthand to access the trigger data
button: "{{ trigger.event.data.property_key_name }}"
action_type: "{{ trigger.event.data.value }}"
trigger:
- platform: event
event_type: zwave_js_value_notification
event_data:
command_class: 91
device_id: !input inovelli_switch
action:
choose:
- conditions: "{{ button == up_button }}"
sequence:
- choose:
- conditions: "{{ action_type == press_x1 }}"
sequence: !input up_action
- conditions: "{{ action_type == press_x2 }}"
sequence: !input up_x2_action
- conditions: "{{ action_type == press_x3 }}"
sequence: !input up_x3_action
- conditions: "{{ action_type == press_x4 }}"
sequence: !input up_x4_action
- conditions: "{{ action_type == press_x5 }}"
sequence: !input up_x5_action
- conditions: "{{ action_type == hold }}"
sequence: !input up_hold_action
- conditions: "{{ action_type == release }}"
sequence: !input up_release_action
- conditions: "{{ button == down_button }}"
sequence:
- choose:
- conditions: "{{ action_type == press_x1 }}"
sequence: !input down_action
- conditions: "{{ action_type == press_x2 }}"
sequence: !input down_x2_action
- conditions: "{{ action_type == press_x3 }}"
sequence: !input down_x3_action
- conditions: "{{ action_type == press_x4 }}"
sequence: !input down_x4_action
- conditions: "{{ action_type == press_x5 }}"
sequence: !input down_x5_action
- conditions: "{{ action_type == hold }}"
sequence: !input down_hold_action
- conditions: "{{ action_type == release }}"
sequence: !input down_release_action
- conditions: "{{ button == config_button and action_type == press_x1 }}"
sequence: !input config_action
@crkochan
Copy link

crkochan commented Jul 7, 2023

I recommend adding multiple: true in the selector to enable setting common actions for a group of switches.

      selector:
        device:
          integration: zwave_js
          manufacturer: Inovelli
          multiple: true

@mitchcapper
Copy link
Author

I recommend adding multiple: true in the selector to enable setting common actions for a group of switches.

good call updated.

@crkochan
Copy link

crkochan commented Jul 8, 2023

I recommend adding multiple: true in the selector to enable setting common actions for a group of switches.

good call updated.

Actually, it was just a liiiiittle bit more complicated than I originally thought, but not terribly so.

  • I tweaked the input just a little bit more
input:
 inovelli_devices:
   name: Inovelli Dimmer/Switch
   description: The Inovelli On/Off or Dimmer Switch to do actions on
   selector:
     device:
       integration: zwave_js
       manufacturer: Inovelli
       multiple: true
  • I added two more items to the variables section
device_id: '{{ trigger.event.data.device_id }}'
device_list: !input inovelli_devices
  • And I had to add a couple items to the front of the action section
action:
  - variables:
      trigger_device_id: |
        {% if device_id in device_list %}
          {{ device_id }}
        {% else %}
          ''
        {% endif %}
  - condition: template
    value_template: "{{ device_id == trigger_device_id }}"
  - choose:
    - conditions: "{{ button == up_button }}"
      sequence:
      ...

I couldn't find a way to check the triggering device ID against the list of device IDs from the input in the trigger section, so I had to settle for doing it as an variable action, and then checking the result in a condition template.

Upside is it works as expected, downside is any automation from the blueprint will trigger on any Central Scene event. I think this is only really a problem if you have a lot of scene events going off, and care about being able to view a proper trace for a given automation, as it may roll of the stack before it can be viewed.

If you don't feel like copying from comment blocks, I'd take a look at my forked gist with the changes.

@crkochan
Copy link

crkochan commented Jul 8, 2023

Oh, FYI, the input change to multiple: true also means that any existing automation you might have will stop working, because it changes the input from...

inovelli_switch: <DEVICE_ID>

to...

inovelli_switch: 
  - <DEVICE_ID_1>
  - <DEVICE_ID_2>
  ...
  - <DEVICE_ID_N>

To fix them, existing automations can be edited in YAML mode, and the input format updated to a list structure as shown in the example. Once saved in YAML mode, they can then be edited further in UI mode.

Otherwise it might be wiser, especially if you're already got a fair amount of existing automations, to treat this as an entirely new blueprint.

@ThatTallGuy21
Copy link

ThatTallGuy21 commented Jul 27, 2023

Hello,

Thanks for putting this together OP.

Two questions:

  1. Is this the same blueprint as the existing one found here? A quick glance makes it look the same or similar.. - https://community.home-assistant.io/t/inovelli-red-series-on-off-or-dimmer-scenes-for-zwavejs/347023. I just started using the linked version and am wondering if there are any benefits to switching.
  2. Any chance you could update your Inovelli Red blueprint to include holding and multiple presses of the config button like some of the newer Inovelli Blue blueprints I've seen? This would allow people like myself to have both Inovelli Red and Blue switches operating in a very similar fashion. Here's an example of what I mean. https://community.home-assistant.io/t/z2m-inovelli-blue-series-2-in-1-switch-dimmer/484422

@mitchcapper
Copy link
Author

@ThatTallGuy21 it sounds like there should be a link in question #1 and question #2 but it doesn't seem like they came through.

The main goal here was one blueprint for any innovelli with easy to decipher names and messages for events. As for holding or multiple presses of the config button if you want to send a link I can check that otherwise when I get some free time I will test test a unit and see what it generates.

@ThatTallGuy21
Copy link

@ThatTallGuy21 it sounds like there should be a link in question #1 and question #2 but it doesn't seem like they came through.

The main goal here was one blueprint for any innovelli with easy to decipher names and messages for events. As for holding or multiple presses of the config button if you want to send a link I can check that otherwise when I get some free time I will test test a unit and see what it generates.

Woops! Sorry about that. I edited my previous comment to include the links I was referencing. Hope my comments makes more sense now. Let me know what you think once you take a second look.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment