Home Assistant - Blueprint to Change Multiple Switch LED Colors Simultaneously

I have recently created a Home Assistant automation Blueprint to change the LED color of multiple Z-Wave switches that are setup using Z-WaveJS. Hopefully this can help someone else who like me like to change colors often. Any feedback is encourages and appreciated!

Here is the link to the Home Assistant forum post followed by the details.

I have multiple Inovelli Red/Black Series switches that I like to periodically change the color of the LEDs. I got tired of having to go into the Z-Wave configuration of each switch to change them individually and created this automation to change them all at once. This currently supports the following switches:

  • LZW30 - Black On/Off
  • LZW30-SN - Red On/Off
  • LZW31 - Black Dimmer
  • LZW31-SN - Red Dimmer
  • LZW36 - Light/Fan Combo
  • VZW31-SN - Red 2-in-1
  • VZM31-SN - Blue 2-in-1

Disclaimer: I only own the Black On/Off, Red Dimmer and On/Off, and Blue 2-in-1. I have not been able to verify this works with the other switch’s but they are set up the same so there shouldn’t be any issue.
Please let me know if you have one of these switches and can validate they function properly.

Screenshot:

Import:
Open your Home Assistant instance and show the blueprint import dialog with a specific blueprint pre-filled.

Github:
https://github.com/JDIacobbo/Home-Assistant/blob/3ebd3a9c44d53885fe4566878437e4423ff16c57/CONFIG/blueprints/automation/Inovelli_Set_LED_Color_ZWave.yaml

Code:

  name: Inovelli LED Color Change
  description: Create automations for Inovelli dimmers and switches to set their LED color. Specific to Z-Wave devices using Z-Wave JS and Zigbee devices using ZHA.
  domain: automation
  input:
    inovelli_dimmer:
      name: Inovelli Dimmer
      description: List of available Inovelli dimmers.
      default: {}
      selector:
        target:
          device:
            - integration: zwave_js
              manufacturer: Inovelli
              model: LZW31-SN
            - integration: zwave_js
              manufacturer: Inovelli
              model: LZW31
    inovelli_switch:
      name: Inovelli On/Off Switch
      description: List of available Inovelli On/Off switches.
      default: {}
      selector:
        target:
          device:
            - integration: zwave_js
              manufacturer: Inovelli
              model: LZW30-SN
            - integration: zwave_js
              manufacturer: Inovelli
              model: LZW30
    inovelli_fan_light_combo:
      name: Inovelli Fan/Light Combo
      description: List of available Inovelli fan/fight combo switches.
      default: {}
      selector:
        target:
          device:
            integration: zwave_js
            manufacturer: Inovelli
            model: LZW36
    inovelli_red_2_in_1:
      name: Inovelli Red 2-in-1 Switch
      description: List of available Inovelli Red 2-in-1 switches.
      default: {}
      selector:
        target:
          device:
            integration: zwave_js
            manufacturer: Inovelli
            model: VZW31-SN
    inovelli_blue_2_in_1:
      name: Inovelli Blue 2-in-1 Switch
      description: List of available Inovelli Blue 2-in-1 switches.
      default: []
      selector:
        target:
          device:
            integration: zha
            manufacturer: Inovelli
            model: VZM31-SN

    color:
      name: Color
      description: 
        "Select the LED Color - 
        Off: 0 |
        Red: 1 |
        Orange: 21 |
        Yellow: 42 |
        Green: 85 |
        Cyan: 127 |
        Teal: 145 |
        Blue: 170 |
        Purple: 195 |
        Light Pink: 220 |
        Pink: 234 |
        White: 255"
      selector:
          number:
              min: 0
              max: 255

variables:
  color: !input color
  inovelli_dimmer: !input inovelli_dimmer
  inovelli_switch: !input inovelli_switch
  inovelli_fan_light_combo: !input inovelli_fan_light_combo
  inovelli_red_2_in_1: !input inovelli_red_2_in_1
  inovelli_blue_2_in_1: !input inovelli_blue_2_in_1 

trigger: []

action:
- choose:
  - conditions:
    - condition: template
      value_template: 'True'
    sequence:
      repeat:
        for_each:
          - inovelli_switch
          - inovelli_dimmer
          - inovelli_fan_light_combo
          - inovelli_red_2_in_1
          - inovelli_blue_2_in_1
        sequence:
          choose:
            - conditions: "{{ inovelli_dimmer|length > 0 and repeat.item == 'inovelli_dimmer' }}"
              sequence:
              # Set color for dimmers
              - service: zwave_js.multicast_set_value
                data:
                  command_class: '112'
                  property: '13'
                  value: "{{ color }}"
                target: !input inovelli_dimmer

            - conditions: "{{ inovelli_switch|length > 0 and repeat.item == 'inovelli_switch' }}"
              sequence:
              # Set color for switches
              - service: zwave_js.multicast_set_value
                data:
                  command_class: '112'
                  property: '5'
                  value: "{{ color }}"
                target: !input inovelli_switch

            - conditions: "{{ inovelli_fan_light_combo|length > 0 and repeat.item == 'inovelli_fan_light_combo' }}"
              sequence:
              # Set color for Fan/Light combo light
              - service: zwave_js.multicast_set_value
                data:
                  command_class: '112'
                  property: '18'
                  value: "{{ color }}"
                target: !input inovelli_fan_light_combo

            - conditions: "{{ inovelli_fan_light_combo|length > 0 and repeat.item == 'inovelli_fan_light_combo' }}"
              sequence:
              # Set color for Fan/Light combo fan
              - service: zwave_js.multicast_set_value
                data:
                  command_class: '112'
                  property: '20'
                  value: "{{ color }}"
                target: !input inovelli_fan_light_combo

            - conditions: "{{ inovelli_red_2_in_1|length > 0  and repeat.item == 'inovelli_red_2_in_1' }}"
              sequence:
              # Set color for Red 2-in-1 on
              - service: zwave_js.multicast_set_value
                data:
                  command_class: '112'
                  property: '95'
                  value: "{{ color }}"
                target: !input inovelli_red_2_in_1
              # Set color for Red 2-in-1 off
              - service: zwave_js.multicast_set_value
                data:
                  command_class: '112'
                  property: '96'
                  value: "{{ color }}"
                target: !input inovelli_red_2_in_1

            - conditions: "{{ inovelli_blue_2_in_1|length > 0  and repeat.item == 'inovelli_blue_2_in_1' }}"
              sequence:
                - repeat:
                    for_each: "{{ inovelli_blue_2_in_1.device_id }}"
                    sequence:
                      # Set color for Blue 2-in-1 off
                      - service: zha.set_zigbee_cluster_attribute
                        data:
                          cluster_type: in
                          endpoint_id: 1
                          cluster_id: 64561
                          attribute: 96
                          manufacturer: "4655"
                          ieee: >
                            {{ (device_attr(repeat.item, "identifiers")|list).0.1 }}
                          value: "{{ color }}"
                      # Set color for Blue 2-in-1 on
                      - service: zha.set_zigbee_cluster_attribute
                        data:
                          cluster_type: in
                          endpoint_id: 1
                          cluster_id: 64561
                          attribute: 95
                          manufacturer: "4655"
                          ieee: >
                            {{ (device_attr(repeat.item, "identifiers")|list).0.1 }}
                          value: "{{ color }}"

EDIT

I’ve added support for the Blue 2-in-1 Switches using ZHA and fixed the Red’s not updating the ON state. I’ve preserved the ZWaveJS blueprint and uploaded a new blueprint containing both ZWaveJS and ZHA which is linked here. Both files are located on my github.

3 Likes

Neat! Is it possible to do something like this to change multiple configuration parameters at once on multiple switches? I would love some way to not have to manually make changes on every switch.

It absolutely is. The LED colors are set using various Z-Wave Configuration items depending on the switch. This could easily be modified to set a different configuration value.

One suggestion for improvement, use |multicast](Instant Notifications All Switches Using Multicast on HA) to command each of the switches of each group at once. This will reduce the amount of zwave traffic.

1 Like

I appreciate the suggestion. I may look into that route in the future but at this moment I think having to jump through the extra hoops of getting the multicast parameter added to the devices and the additional configuration that is involved complicates this a it too much. The purpose of this was to make bulk changing the LED colors as easy as possible.

But thank you for providing that link. I found the information very informative and it’s definitely planted some seeds for future projects! I can see it being very useful for more frequent calls that what this project is intended for.

I don’t think you actually need to change too much (certainly not adding any of the parameters to the devices anymore). Roughly speaking (I’ve not tested this, but copied from my notes), you should be able to convert each of your service calls like this:

Original:

              - service: zwave_js.set_config_parameter
                data:
                  parameter: '95'
                  value: "{{ color }}"
                target: !input inovelli_2_in_1

Multicast:

              - service: zwave_js.multicast_set_value
                data:
                  command_class: '95'
                  property: targetValue
                  value: "{{ color }}"
                target: !input inovelli_2_in_1

You’ll also want to update it to pass in the list of entities/devices directly rather than iterating through them. Totally doesn’t make sense for a one off bulk update, but adding the example here since it may help someone else in the future.

The reason I needed to iterate through them is because if a variable was blank the automation would stop at that line and wouldn’t proceed to the next group. So for example if you only have 2-in1 switches when it went to update the first set of switches in the code, the dimmers, it would stop because inovelli_dimmer was blank.

I admittedly didn’t finish reading the entire thread and wasn’t aware you didn’t need parameter 16 that was mentioned and used earlier on. I’ll test this out and see if I can get it to work. Thanks!

Just tried the following code and it didn’t work. I don’t see any entries in my z-wave logs and none of the LEDs changed.

blueprint:
  name: Inovelli LED Color Change - Z-Wave - Multicast
  description: Create automations for Inovelli Red dimmers and switches to set their LED color. Specific to Z-Wave devices.
  domain: automation
  input:
    inovelli_dimmer:
      name: Inovelli Dimmer
      description: List of available Inovelli dimmers.
      default: {}
      selector:
        target:
          device:
            - integration: zwave_js
              manufacturer: Inovelli
              model: LZW31-SN
            - integration: zwave_js
              manufacturer: Inovelli
              model: LZW31
    inovelli_switch:
      name: Inovelli On/Off Switch
      description: List of available Inovelli On/Off switches.
      default: {}
      selector:
        target:
          device:
            - integration: zwave_js
              manufacturer: Inovelli
              model: LZW30-SN
            - integration: zwave_js
              manufacturer: Inovelli
              model: LZW30
    inovelli_fan_light_combo:
      name: Inovelli Fan/Light Combo
      description: List of available Inovelli fan/fight combo switches.
      default: {}
      selector:
        target:
          device:
            integration: zwave_js
            manufacturer: Inovelli
            model: LZW36
    inovelli_2_in_1:
      name: Inovelli 2-in-1 Switch
      description: List of available Inovelli 2-in-1 switches.
      default: {}
      selector:
        target:
          device:
            integration: zwave_js
            manufacturer: Inovelli
            model: VZW31-SN

    color:
      name: Color
      description: 
        "Select the LED Color - 
        Off: 0 |
        Red: 1 |
        Orange: 21 |
        Yellow: 42 |
        Green: 85 |
        Cyan: 127 |
        Teal: 145 |
        Blue: 170 |
        Purple: 195 |
        Light Pink: 220 |
        Pink: 234 |
        White: 255"
      selector:
          number:
              min: 0
              max: 255

variables:
  color: !input color
  inovelli_dimmer: !input inovelli_dimmer
  inovelli_switch: !input inovelli_switch
  inovelli_fan_light_combo: !input inovelli_fan_light_combo
  inovelli_2_in_1: !input inovelli_2_in_1

trigger: []

action:
- choose:
  - conditions:
    - condition: template
      value_template: 'True'
    sequence:
      repeat:
        for_each:
          - inovelli_switch
          - inovelli_dimmer
          - inovelli_fan_light_combo
          - inovelli_2_in_1
        sequence:
          choose:
            - conditions: "{{ inovelli_dimmer|length > 0 and repeat.item == 'inovelli_dimmer' }}"
              sequence:
              # Set color for dimmers
              - service: zwave_js.multicast_set_value
                data:
                  command_class: '13'
                  property: targetValue
                  value: "{{ color }}"
                target: !input inovelli_dimmer

            - conditions: "{{ inovelli_switch|length > 0 and repeat.item == 'inovelli_switch' }}"
              sequence:
              # Set color for switches
              - service: zwave_js.multicast_set_value
                data:
                  command_class: '5'
                  property: targetValue
                  value: "{{ color }}"
                target: !input inovelli_switch

            - conditions: "{{ inovelli_fan_light_combo|length > 0 and repeat.item == 'inovelli_fan_light_combo' }}"
              sequence:
              # Set color for Fan/Light combo light
              - service: zwave_js.multicast_set_value
                data:
                  command_class: '18'
                  property: targetValue
                  value: "{{ color }}"
                target: !input inovelli_fan_light_combo

            - conditions: "{{ inovelli_fan_light_combo|length > 0 and repeat.item == 'inovelli_fan_light_combo' }}"
              sequence:
              # Set color for Fan/Light combo fan
              - service: zwave_js.multicast_set_value
                data:
                  command_class: '20'
                  property: targetValue
                  value: "{{ color }}"
                target: !input inovelli_fan_light_combo

            - conditions: "{{ inovelli_2_in_1|length > 0  and repeat.item == 'inovelli_2_in_1' }}"
              sequence:
              # Set color for 2-in-1 on
              - service: zwave_js.multicast_set_value
                data:
                  command_class: '95'
                  property: targetValue
                  value: "{{ color }}"
                target: !input inovelli_2_in_1

            - conditions: "{{ inovelli_2_in_1|length > 0  and repeat.item == 'inovelli_2_in_1' }}"
              sequence:
              # Set color for 2-in-1 off
              - service: zwave_js.multicast_set_value
                data:
                  command_class: '96'
                  property: targetValue
                  value: "{{ color }}"
                target: !input inovelli_2_in_1

Oops sorry, I copy and pasted incorrectly. This time I actually tested my work :slight_smile: and added some comments.

service: zwave_js.multicast_set_value
data:
  command_class: "112" // tells it that you are changing a configuration property
  property: "13" // configuration property id number
  value: 170 // color to set the property to
target:
  entity_id: light.office_lights // list of entities goes here
2 Likes

Is the command class a universal item value? Meaning its the same value between different devices? As opposed to the config property that is a different value depending on the device.

Yes, that’s part of the Z-Wave specifications.

Thanks, I just tested it and it works. I’ll update the code on GitHub. Thanks for the recommendation and the guidance!

1 Like

Happy to help! Thanks for putting together this blueprint, it’ll speed up some initial setup for me.

I will second the suggestion for using multicast, it makes a MASSIVE difference in speed.

One other suggestion I would make is to make this a script blueprint instead of an automation blueprint. All the other blueprints for Inovelli LED’s are scripts. And with many people having blues along side their reds, it would be much easier to create an automation with whatever trigger wanted, and then call this script + blue script to change all of them at once.

I have a script for this and I use a single device selector and then filter out each model.

sequence:
  - variables:
      lzw30_devices: "{{ targets | select('is_device_attr', 'model', 'LZW30') | list }}"
      lzw31_sn_devices: "{{ targets | select('is_device_attr', 'model', 'LZW31-SN') | list }}"
      lzw36_devices: "{{ targets | select('is_device_attr', 'model', 'LZW36') | list }}"
      vzw31_sn_devices: "{{ targets | select('is_device_attr', 'model', 'VZW31-SN') | list }}"
    alias: Filter targets by model
1 Like

Mind sharing your full script?

alias: Change Switch Color
variables:
  color: "{{ states('input_select.inovelli_indicator_color') }}"
fields:
  targets:
    name: Targets
    description: Devices to change LED Strip color.
    required: true
    selector:
      device:
        filter:
          - manufacturer: Inovelli
            model: LZW30
          - manufacturer: Inovelli
            model: LZW31-SN
          - manufacturer: Inovelli
            model: LZW36
          - manufacturer: Inovelli
            model: VZW31-SN
        multiple: true
  color:
    name: Color
    description: LED color.
    required: true
    default: "170"
    selector:
      select:
        options:
          - label: Red
            value: "0"
          - label: Orange
            value: "5"
          - label: Yellow
            value: "42"
          - label: Green
            value: "85"
          - label: Cyan
            value: "127"
          - label: Blue
            value: "170"
          - label: Violet
            value: "190"
          - label: Magenta
            value: "212"
          - label: Pink
            value: "234"
          - label: White
            value: "255"
  fan_color:
    name: Fan Color (LZW36 Only)
    description: LED color for fan switch (default
    required: false
    selector:
      select:
        options:
          - label: Red
            value: "0"
          - label: Orange
            value: "5"
          - label: Yellow
            value: "42"
          - label: Green
            value: "85"
          - label: Cyan
            value: "127"
          - label: Blue
            value: "170"
          - label: Violet
            value: "190"
          - label: Magenta
            value: "212"
          - label: Pink
            value: "234"
          - label: White
            value: "255"
  on_color:
    name: On Color (VZW31-SN Only)
    description: LED color when load is on.
    required: false
    selector:
      select:
        options:
          - label: Red
            value: "0"
          - label: Orange
            value: "5"
          - label: Yellow
            value: "42"
          - label: Green
            value: "85"
          - label: Cyan
            value: "127"
          - label: Blue
            value: "170"
          - label: Violet
            value: "190"
          - label: Magenta
            value: "212"
          - label: Pink
            value: "234"
          - label: White
            value: "255"
sequence:
  - variables:
      lzw30_devices: "{{ targets | select('is_device_attr', 'model', 'LZW30') | list }}"
      lzw31_sn_devices: "{{ targets | select('is_device_attr', 'model', 'LZW31-SN') | list }}"
      lzw36_devices: "{{ targets | select('is_device_attr', 'model', 'LZW36') | list }}"
      vzw31_sn_devices: "{{ targets | select('is_device_attr', 'model', 'VZW31-SN') | list }}"
    alias: Filter targets by model
  - if:
      - condition: template
        value_template: "{{ lzw30_devices | length > 0 }}"
    then:
      - service: zwave_js.set_value
        target: "{{{ 'device_id': lzw30_devices }}}"
        data:
          command_class: "112"
          property: "5"
          value: "{{ color }}"
        alias: Set LED color
    alias: Set LED color for LZW30 devices if targeted
  - if:
      - condition: template
        value_template: "{{ lzw31_sn_devices | length > 0 }}"
    then:
      - service: zwave_js.multicast_set_value
        target: "{{{ 'device_id': lzw31_sn_devices }}}"
        data:
          command_class: "112"
          property: "13"
          value: "{{ color }}"
    enabled: true
    alias: Set LED color for LZW31-SN devices if targeted
  - if:
      - condition: template
        value_template: "{{ lzw36_devices | length > 0 }}"
    then:
      - service: zwave_js.multicast_set_value
        target: "{{{ 'device_id': lzw36_devices }}}"
        data:
          command_class: "112"
          property: "18"
          value: "{{ color }}"
      - service: zwave_js.multicast_set_value
        target: "{{{ 'device_id': lzw36_devices }}}"
        data:
          command_class: "112"
          property: "20"
          value: "{{ iif(fan_color, fan_color, color) }}"
    enabled: true
    alias: Set LED color for LZW36 devices if targeted
  - if:
      - condition: template
        value_template: "{{ vzw31_sn_devices | length > 0 }}"
    then:
      - service: zwave_js.multicast_set_value
        target: "{{{ 'device_id': vzw31_sn_devices }}}"
        data:
          command_class: "112"
          property: "96"
          value: "{{ color }}"
      - service: zwave_js.multicast_set_value
        target: "{{{ 'device_id': vzw31_sn_devices }}}"
        data:
          command_class: "112"
          property: "95"
          value: "{{ iif(on_color, on_color, color) }}"
    enabled: true
    alias: Set LED color for VZW31-SN devices if targeted
mode: single
icon: mdi:palette

I’ve added in Blue 2-in-1 support. Any feedback is appreciated.