Set Zwave JS Parameters via a Scene?

I have a few ZEN32 scene controllers. These little guys have 5 buttons, each with an LED. The LED can be 4 different colors and have 3 different brightnesses. I would like to control the color and brightness of these LEDs on the devices just like I would control a device in a scene. Currently I am using an automation to loop through all devices of this type and set colors, etc. It’s relatively complicated code (for this newbie) with templates, and it seems to me there is probably a better way to abstract this.

An example of how I will use this: when the house is armed-stay. All the LEDs on the pads will turn red. When the house is unarmed in the AM, they will turn green. I’m doing this now with automations that trigger off the alarm state, then running the actions of another automation that change the LED colors. Since I plan to use the LED color for other states, or errors, etc - it’s easier to abstract setting these parameters into groups.

I’m just beginning to learn this new world of automations, scenes, scripts, blueprints, and YAML editing. So thought I’d ask a more meta question about the best way to model and implement something like this. Since there are so many special features enabled on via parameters seems like there may be a better way? TIA

Nope the lamps ina zen32 will be ZWaveJS service calls. And not enev set partial parameters calls. (which IMHO the device needs to be redone to support partial params - the led set calls are very cumbersome)

If you’re successfully setting your Led color you’re already ahead of the curve

If it’s helpful to anyone, here is how I did that. I used some directions from another post on nested device discovery as a template. This seems to work well, but not when there is a lot of wave traffic, which is likely because I am migrating from an ISY to HA and have two systems running in parallel. The server is whatever came with the latest Zwave JS UI add-on. It was a devil to get the ZEN32s to even complete interrogation in S2 mode. One still is not secure. But I was able to get the firmware updated through the UI. Also running a Zooz 800 series stick for zwave.

id: '1673059573740'
  alias: SetPadsWhite
  description: Set Scene Pads to White
  trigger: []
  condition: []
  action:
  - service: zwave_js.set_config_parameter
    data:
      parameter: 6
      value: 0
      device_id: '{% set ns = namespace(devices=[]) %} {% for id in integration_entities("zwave_js")
        %} {% if device_attr(id, "model") == "ZEN32" %} {% set ns.devices = ns.devices
        + [device_id(id)] %} {% endif %} {% endfor %} {{ ns.devices | unique | list
        }}

        '
  - service: zwave_js.set_config_parameter
    data:
      parameter: 7
      value: 0
      device_id: '{% set ns = namespace(devices=[]) %} {% for id in integration_entities("zwave_js")
        %} {% if device_attr(id, "model") == "ZEN32" %} {% set ns.devices = ns.devices
        + [device_id(id)] %} {% endif %} {% endfor %} {{ ns.devices | unique | list
        }}

        '
  - service: zwave_js.set_config_parameter
    data:
      parameter: 8
      value: 0
      device_id: '{% set ns = namespace(devices=[]) %} {% for id in integration_entities("zwave_js")
        %} {% if device_attr(id, "model") == "ZEN32" %} {% set ns.devices = ns.devices
        + [device_id(id)] %} {% endif %} {% endfor %} {{ ns.devices | unique | list
        }}

        '
  - service: zwave_js.set_config_parameter
    data:
      parameter: 9
      value: 0
      device_id: '{% set ns = namespace(devices=[]) %} {% for id in integration_entities("zwave_js")
        %} {% if device_attr(id, "model") == "ZEN32" %} {% set ns.devices = ns.devices
        + [device_id(id)] %} {% endif %} {% endfor %} {{ ns.devices | unique | list
        }}

        '
  - service: zwave_js.set_config_parameter
    data:
      parameter: 10
      value: 0
      device_id: '{% set ns = namespace(devices=[]) %} {% for id in integration_entities("zwave_js")
        %} {% if device_attr(id, "model") == "ZEN32" %} {% set ns.devices = ns.devices
        + [device_id(id)] %} {% endif %} {% endfor %} {{ ns.devices | unique | list
        }}

        '

See if using the bulk set method has any improvement in performance.

id: '1673059573740'
  alias: SetPadsWhite
  description: Set Scene Pads to White
  trigger: []
  condition: []
  action:
  - service: zwave_js.invoke_cc_api
    data:
      command_class: "112"
      method_name: setBulk
      parameters:
        - parameter: 6
          value: 0
        - parameter: 7
          value: 0
        - parameter: 8
          value: 0
        - parameter: 9
          value: 0
        - parameter: 10
          value: 0
      device_id: '{% set ns = namespace(devices=[]) %} {% for id in integration_entities("zwave_js")
        %} {% if device_attr(id, "model") == "ZEN32" %} {% set ns.devices = ns.devices
        + [device_id(id)] %} {% endif %} {% endfor %} {{ ns.devices | unique | list
        }}

        '

In special cases, such as this, the driver can send all parameters in single Z-Wave command. If it doesn’t satisfy the requirements, at worst it just turns into multiple single commands. In that case, it’s the same behavior as your action, but it does simplify the YAML code.

2 Likes

Cool, I will try that.

I create number or select entities for these things and then use those in automations or Lovelace. Here’s an example:


template:
  - trigger:
      - platform: zwave_js.value_updated
        entity_id:
          - climate.bedroom_thermostat
        command_class: 112
        property: 39
    sensor:
      - name: "bedroom_thermostat_idle_brightness"
        state: "{{ trigger.current_value }} "

  - number:
      - name: "bedroom_thermostat_idle_brightness"
        state: '{{ states("sensor.bedroom_thermostat_idle_brightness") }}'
        step: 1
        min: 0
        max: 5
        set_value:
          service: zwave_js.set_config_parameter
          data_template:
            entity_id: climate.bedroom_thermostat
            parameter: 39
            value: "{{ value }}"

Woah, how would you use that - from an automation?

You would call the number.set_value service.

  action:
    - service: number.set_value
      data:
        value: "1"
      target:
        entity_id: number.bedroom_thermostat_idle_brightness

The nice thing about the number entity is it also reflects the current configuration value on the device.