Setting parameters causing home assistant to think switch is on ZEN32

Not sure how to diagnose this problem as I’m pretty sure my YAML is correct. I’m using a ZEN32 and trying to toggle the LED on the relay button (big button). I think when setting this parameter the switch thinks that it is turned on. Home Assistant (Zwave JS) says the light is on, but light is not. Is this a Zwave JS issue or possibly the firmware on the switch? Does anyone know how to figure that out?

- alias: Kitchen Relay LED
  trigger:
  - platform: state
    entity_id: switch.kitchen_lights
  action:    
  - choose:
    - conditions:  
      - condition: state
        entity_id: switch.kitchen_lights
        state: 'on'
      sequence:
      - service: zwave_js.set_config_parameter
        data:
          parameter: '1'
          value: '3'
        target:
          device_id: 4e85794c572a4b2830797ea01739e0c8
    - conditions:  
      - condition: state
        entity_id: switch.kitchen_lights
        state: 'off'
      sequence:
      - service: zwave_js.set_config_parameter
        data:
          parameter: '1'
          value: '2'
        target:
          device_id: 4e85794c572a4b2830797ea01739e0c8

Do you get the same behavior when setting the config parameter from the zwavejs ui?

wouldn’t you want to use 3 for always on, not 1 which means only when the load is on?

You are correct! I made a mistake. Just retried and the issue is still happening. Edited the original post

I do not get the same behavior, I toggle back and forth and nothing changes on the switch itself. Is it possible that there is an issue with set bulk parameters?

That is interesting. It may be a timing issue. Try adding a couple second delay into your script see if that changes the behavior. You could also try the non bulk service call.

Here’s an example template I use for turning config parameters into numbers, and the use scripts to create the HASS config by replacing the parameters.

# ENTITY_ID
# PROPERTY
# PROPERTY_NAME
# MIN
# MAX
# STEP

template:
  - trigger:
      - platform: zwave_js.value_updated
        entity_id:
          - ENTITY_ID
        command_class: 112
        property: PROPERTY
    sensor:
      - name: "MYNAME_PROPERTY_NAME"
        state: "{{ trigger.current_value }} "

  - number:
      - name: "MYNAME_idle_brightness"
        state: '{{ states("sensor.MYNAME_PROPERTY_NAME") }}'
        step: STEP
        min: MIN
        max: MAX
        set_value:
          service: zwave_js.set_config_parameter
          data_template:
            entity_id: ENTITY_ID
            parameter: PROPERTY
            value: "{{ value }}"

I tried the delay for 1 second and try the non bulk service call and it is still happening. Great ideas though! What is really strange is that this issue only happens for the relay button which leads me to believe it could be the device itself.

Do you have a zen32?

Thank you for the code snippet.

I’ll be getting one shortly (next few days), I happened to need one in my living room. But tbh, this device isn’t meant to act as a switch, I’d wager that’s your main problem. This is simply a scene controller. They are meant to activate Zwave scenes and produce tap events.

It’s a great device. I would agree with that statement except that that everything works fine on the other buttons except the relay button.

Is that the big button?

Well, either way, I’m sure I’ll look into doing something similar.

Yup, let me know. I have a blueprint for scenes and one for the LEDs.

I reached out to Zooz and we’ll see what they say. Not sure there is away to create a bug for zwavejs?

Ok, I just got the device, so when you say relay, are you referring to the main switch? As I see it right now, by default single tap “acts” as a switch for all 5 buttons, however the main button’s state is tied to the load/traveler lines. When the main line has load → on, when it doesn’t → off. I.e. the main button is a toggle switch and it’s behavior cannot be altered.

If you go into the Zwave JS configuration parameters you can disable the control of the relay button. Parameter 19. “Disable local control”.

Ok, so you’re disabling local control and you’re trying to override the behavior of the LED?

Correct! Which is why I feel there is a bug. I opened a ticket with Zooz. Will keep people posted.

Aight, So I’ll be looking into this soon to confirm your findings as I’m probably going to be going this route as well. I disabled the relay because my switch is running bulbs and I’ll most likely try to sync the light with the state of the lights. I’ll keep you posted on my process when I get around to doing it. I have a ton of parties this weekend so it might be a few weeks. However, if you get any update from zooz, I’d like to hear the outcome. So far, this device is very sleek looking and it has nice features. I can live without the LED status if nothing comes out of it.

So I just made an automation and it works perfectly fine for all 5 buttons. I did turn off the relay mode on the main switch. So all 5 buttons are now just scene controllers and the load to my lights is always on.

If you’re interested in using it, it sets the state and the led color (if you want). Here’s an example automation, only add via YAML. Oh, it’s an all in 1 automation, does all lights attached to the zen32.

- alias: Button - Living Room Scene Controller LEDs
  id: button_living_room_scene_controller_leds
  mode: parallel
  trigger:
  - platform: state
    entity_id:
    - light.lamp1
    - light.lamp2
    - light.lamp3
    - switch.hyperion_usb_capture
    - switch.hyperion_cinema
    - switch.hyperion_rainbow_swirl_fast
    - light.living_room
    - light.all_living_room
  variables:
    values:
      'on': 2
      'off': 3
      'unavailable': 3
      'unknown': 3
    colors:
      white: 0
      blue: 1
      green: 2
      red: 3
    config:
      light.lamp1:
        parameter: 2
      light.lamp2: 
        parameter: 3
      light.lamp3:
        parameter: 4
      switch.hyperion_usb_capture: 
        parameter: 5
      switch.hyperion_cinema: 
        parameter: 5
      switch.hyperion_rainbow_swirl_fast: 
        parameter: 5
      light.living_room:
        parameter: 1
      light.all_living_room:
        parameter: 1
    value: >
      {{ values.get(trigger.to_state.state) }}
    state_parameter: >
      {{ config.get(trigger.entity_id, {}).get('parameter') }}
    color_parameter: >
      {{ state_parameter + 5 if state_parameter is not none else none }}
    state_good: >
      {{ trigger.to_state.state in ['on', 'off'] }}
    state_bad: >
      {{ trigger.to_state.state in ['unavailable', 'unknown'] }}
    state_off: >
      {{ trigger.to_state.state == 'off' }}
    color: >
      {% if state_good and state_off %}
        {{ colors.get('white') }}
      {% elif state_bad %}
        {{ colors.get('red') }}
      {% else %}
        None
      {% endif %}
  condition:
  - condition: template
    value_template: "{{ value is not none and state_parameter is not none }}"
  action:
  - <<: &target
      service: zwave_js.bulk_set_partial_config_parameters
      target:
        device_id: f7a1fe2db74bf6a3b652301589f7cebc
    data:
      parameter: "{{ state_parameter }}"
      value: "{{ value }}"

  # Only set the color if we are 'off', 'unavailable', or 'unknown'

  - condition: template
    value_template: "{{ color is not none and (state_bad or state_off) }}"

  - <<: *target
    data:
      parameter: "{{ color_parameter }}"
      value: "{{ color }}"


Edit: there’s issues with the color. Don’t use this yet. I have to work out the kinks but im going for a run with friends in 15 minutes so I wont get back to it for a few hours.

Edit: Just got back from my run, everything is working as expected after making updates.

This turns the LEDs on when the lights are off. And changes the color to red when the light/switch that it controls is unavailable. You’re welcome to use it.

I had to set parameter 19 to 0. That turns off local control for the switch. This makes it so the device always supplies power to the load, and only sends out central scene notifications.

Hope this helps.

Also, this automation runs the lights if you want it. So basically 2 automations to run all the functionality for the Zen32. Just keep in mind that these should be used in yaml as they heavily rely on templates. I typically do that to minimize the amount of yaml that I have to write and it keeps the traces simple.

- alias: Button - Living Room Scene Controller
  id: button_living_room_scene_controller
  mode: parallel
  trigger:
  - platform: event
    event_type: zwave_js_value_notification
  variables:
    device: >
      {{ trigger.event.data.device_id }}
    value: >
      {{ trigger.event.data.value }}
    label: >
      {{ trigger.event.data.label }} 
    config:
      f7a1fe2db74bf6a3b652301589f7cebc:

        # Top Left Button
        'Scene 001': 
          KeyPressed:
            service: light.toggle
            data:
              entity_id: light.lamp1
          # KeyPressed2x:
          # KeyPressed3x:
          # KeyPressed4x:
          # KeyPressed5x:

        # Top Right Button
        'Scene 002':
          KeyPressed:
            service: light.toggle
            data:
              entity_id: light.lamp2

        # Bottom Left Button
        'Scene 003':
          KeyPressed:
            service: light.toggle
            data:
              entity_id: light.lamp3

        # Bottom Right Button
        'Scene 004':
          KeyPressed:
            service: switch.toggle
            data:
              entity_id: switch.hyperion_usb_capture
          KeyPressed2x:
            service: switch.toggle
            data:
              entity_id: switch.hyperion_cinema
          KeyPressed3x:
            service: switch.toggle
            data:
              entity_id: switch.hyperion_rainbow_swirl_fast
          # KeyPressed4x:
          # KeyPressed5x:

        # Top button
        'Scene 005':
          KeyPressed:
            service: light.toggle
            data:
              entity_id: light.living_room
          KeyPressed2x: 
            service: light.toggle
            data:
              entity_id: light.all_living_room
    service: >
      {{ config.get(device, {}).get(label, {}).get(value, {}).get('service') }}
    data: >
      {{ config.get(device, {}).get(label, {}).get(value, {}).get('data') }}
  condition:
  - condition: template
    value_template: "{{ service is not none and data is not none }}"
  action:
  - service: "{{ service }}"
    data: "{{ data }}"

Thanks for sharing. Do you notice if the relay is reporting the light is on? I have automations which is why it doesn’t work for me. I was always able to get the LEDs working.

The relay naturally reported when the light was on when I had parameter 19 set to 1. All other relays did an ‘assumed state’, meaning they could get out of sync.

So I just built an automation to handle it for me because I do not like them getting out of sync.

But the main relay always synced with the load when parameter 19 is set to 1.

I think you might be getting confused with parameter 1 through 5’s meaning for 0 and 1? buttons 1 through 4 are not connected to a physical load. I.e. they are just scene controllers, they do not turn on or off electricity from the switch itself. That means 0 or 1 on parameters 2-5 is going to use an “assumed” state, where it guesses that it’s turning your lights on when it actually doesn’t know. Parameter 1’s 0 and 1 setting are going to behave differently because it’s connected directly to a load. If you turn parameter 19 to 0 to make it a scene controller, the load is always on, so the light will never change with button presses.