Zooz ZEN34 - Zwave-JS

I have not tested yet as my devices are in the mail, but here is a blueprint for the Zooz ZEN34 remote/switch. I used the ZEN34 documentation from Zooz, here: https://www.support.getzooz.com/kb/article/591-how-to-program-your-zen34-remote-switch-on-home-assistant/

blueprint:
  name: Zooz ZEN34
  description: Zooz ZEN34 Switch using the ZWave-JS integration. 
  domain: automation
  input:
    zwave_device:
      name: Zooz ZEN34
      description: "List of available Zooz ZEN34 switch."
      selector:
          device:
            integration: zwave_js
            manufacturer: Zooz
            model: ZEN34


    KeyReleased_Up:
      name: Up Released
      description: "Action to run, when the button is released."
      default: []
      selector:
        action: {}
    KeyReleased_Down:
      name: Down Released
      description: "Action to run, when the button is released."
      default: []
      selector:
        action: {}

    KeyHeld_Up:
      name: Up Held
      description: "Action to run, when the button is held."
      default: []
      selector:
        action: {}
    KeyHeld_Down:
      name: Down Held
      description: "Action to run, when the button is held."
      default: []
      selector:
        action: {}

    KeyPressed_Up:
      name: Up press 1x
      description: "Action to run, when the button is pressed one time."
      default: []
      selector:
        action: {}
    KeyPressed_Down:
      name: Down press 1x
      description: "Action to run, when the button is pressed one time."
      default: []
      selector:
        action: {}

    KeyPressed2x_Up:
      name: Up press 2x
      description: "Action to run, when the button is pressed two time."
      default: []
      selector:
        action: {}
    KeyPressed2x_Down:
      name: Down press 2x
      description: "Action to run, when the button is pressed two time."
      default: []
      selector:
        action: {}

    KeyPressed3x_Up:
      name: Up press 3x
      description: "Action to run, when the button is pressed three time."
      default: []
      selector:
        action: {}
    KeyPressed3x_Down:
      name: Down press 3x
      description: "Action to run, when the button is pressed three time."
      default: []
      selector:
        action: {}

    KeyPressed4x_Up:
      name: Up press 4x
      description: "Action to run, when the button is pressed four time."
      default: []
      selector:
        action: {}
    KeyPressed4x_Down:
      name: Down press 4x
      description: "Action to run, when the button is pressed four time."
      default: []
      selector:
        action: {}

    KeyPressed5x_Up:
      name: Up press 5x
      description: "Action to run, when the button is pressed five time."
      default: []
      selector:
        action: {}
    KeyPressed5x_Down:
      name: Down press 5x
      description: "Action to run, when the button is pressed five time."
      default: []
      selector:
        action: {}

    KeyHeld_Down:
      name: Down held
      description: "Action to run, when the button is held."
      default: []
      selector:
        action: {}
    KeyHeld_Up:
      name: Up held
      description: "Action to run, when the button is held."
      default: []
      selector:
        action: {}

mode: single
max_exceeded: silent
variables:
  device_id: !input zwave_device
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 == "002" and press_count == "KeyPressed" }}'
      sequence: !input KeyPressed_Down
    - conditions: '{{ button_id == "001" and press_count == "KeyPressed" }}'
      sequence: !input KeyPressed_Up

    - conditions: '{{ button_id == "002" and press_count == "KeyPressed2x" }}'
      sequence: !input KeyPressed2x_Down
    - conditions: '{{ button_id == "001" and press_count == "KeyPressed2x" }}'
      sequence: !input KeyPressed2x_Up

    - conditions: '{{ button_id == "002" and press_count == "KeyPressed3x" }}'
      sequence: !input KeyPressed3x_Down
    - conditions: '{{ button_id == "001" and press_count == "KeyPressed3x" }}'
      sequence: !input KeyPressed3x_Up

    - conditions: '{{ button_id == "002" and press_count == "KeyPressed4x" }}'
      sequence: !input KeyPressed4x_Down
    - conditions: '{{ button_id == "001" and press_count == "KeyPressed4x" }}'
      sequence: !input KeyPressed4x_Up

    - conditions: '{{ button_id == "002" and press_count == "KeyPressed5x" }}'
      sequence: !input KeyPressed5x_Down
    - conditions: '{{ button_id == "001" and press_count == "KeyPressed5x" }}'
      sequence: !input KeyPressed5x_Up

    - conditions: '{{ button_id == "002" and press_count == "KeyHeldDown" }}'
      sequence: !input KeyHeld_Down
    - conditions: '{{ button_id == "001" and press_count == "KeyHeldDown" }}'
      sequence: !input KeyHeld_Up
2 Likes

I’m trying to get it to work, so far it’s not working.

Minor fix, the button_id variable should be property_key_name: https://gist.github.com/philk/5b7c39afcd64d354f04b94fb0217abe1

Working great now, thanks for doing most of the work :grin:

1 Like

Awesome, thanks. Fixed the OP

can’t seem to get it to work – even tried to tap up 7 times to wake it up.

Hey, this is fantastic! Thanks for the hard work. I think you missed the conditions for the long key presses. This should fix it up.

    - conditions: '{{ button_id == "002" and press_count == "KeyHeldDown" }}'
      sequence: !input KeyHeld_Down
    - conditions: '{{ button_id == "001" and press_count == "KeyHeldDown" }}'
      sequence: !input KeyHeld_Up
1 Like

Great feedback. Modified the OP to include.

Has this blueprint been updated for the change in zwave js?

Yes. it has.

anyone get terrible range on their zen34? I have an aeotec stick plugged into USB2 port on a Pi4 and only get like 20 feet of range…

My Zen34 has okay range, but zwjs/my controller seem to forget it exists about once a week.

I had just converted this for myself before finding this post. OP did not work for me but the below is functioning.

blueprint:
  name: Zooz ZEN34 Remote scene control
  description: |
    Use the Zooz ZEN34 remote to trigger Scenes and control devices based on varying scenes. 

    This Blueprint is currently configured for the zwaveJS platform.
    
  domain: automation

  input:
    zwave_device:
      name: Zooz Zen34
      description: "List of available Zooz ZEN34 switch."
      selector:
         device:
            integration: zwave_js
            manufacturer: Zooz
            model: ZEN34


    1x_tap_up:
      name: Tap up 1x
      selector:
        action:
      default: []
    1x_tap_down:
      name: Tap down 1x
      selector:
        action:
      default: []
    2x_tap_up:
      name: Tap up 2x
      selector:
        action:
      default: []
    2x_tap_down:
      name: Tap down 2x
      selector:
        action:
      default: []
    3x_tap_up:
      name: Tap up 3x
      selector:
        action:
      default: []
    3x_tap_down:
      name: Tap down 3x
      selector:
        action:
      default: []
    4x_tap_up:
      name: Tap up 4x
      selector:
        action:
      default: []
    4x_tap_down:
      name: Tap down 4x
      selector:
        action:
      default: []
    5x_tap_up:
      name: Tap up 5x
      selector:
        action:
      default: []
    5x_tap_down:
      name: Tap down 5x
      selector:
        action:
      default: []
    hold_up:
      name: Hold up
      selector:
        action:
      default: []
    hold_down:
      name: Hold down
      selector:
        action:
      default: []

mode: single


variables:
  logger: blueprint.zwave_scene_activation
  device_id: !input zwave_device

trigger:
  - platform: event
    event_type: zwave_js_value_notification

action:
  - choose:
   # IF triggered node_id is zwave_nodeid
      - conditions:
          - condition: template
            value_template: "{{ trigger.event.data.device_id == device_id }}"
        sequence:
          - choose:
            # IF 1x tap up
              - conditions:
                  - condition: template
                    value_template: "{{ trigger.event.data.label == Scene 001 and trigger.event.data.value == KeyPressed }}"
                sequence: !input 1x_tap_up
            # IF 1x tap down
              - conditions:
                  - condition: template
                    value_template: "{{ trigger.event.data.label == Scene 002 and trigger.event.data.value == KeyPressed }}"
                sequence: !input 1x_tap_down
            # IF 2x tap up
              - conditions:
                  - condition: template
                    value_template: "{{ trigger.event.data.label == Scene 001 and trigger.event.data.value ==  KeyPressed2x }}"
                sequence: !input 2x_tap_up
            # IF 2x tap down
              - conditions:
                  - condition: template
                    value_template: "{{ trigger.event.data.label == Scene 002 and trigger.event.data.value ==  KeyPressed2x }}"
                sequence: !input 2x_tap_down
            # IF 3x tap up
              - conditions:
                  - condition: template
                    value_template: "{{ trigger.event.data.label == Scene 001 and trigger.event.data.value == KeyPressed3x }}"
                sequence: !input 3x_tap_up
            # IF 3x tap down
              - conditions:
                  - condition: template
                    value_template: "{{ trigger.event.data.label == Scene 002 and trigger.event.data.value == KeyPressed3x }}"
                sequence: !input 3x_tap_down
            # IF 4x tap up
              - conditions:
                  - condition: template
                    value_template: "{{ trigger.event.data.scene_id == Scene 001 and trigger.event.data.value == KeyPressed4x }}"
                sequence: !input 4x_tap_up
            # IF 4x tap down
              - conditions:
                  - condition: template
                    value_template: "{{ trigger.event.data.label == Scene 002 and trigger.event.data.value == KeyPressed4x }}"
                sequence: !input 4x_tap_down
            # IF 5x tap up
              - conditions:
                  - condition: template
                    value_template: "{{ trigger.event.data.label == Scene 001 and trigger.event.data.value == KeyPressed5x }}"
                sequence: !input 5x_tap_up
            # IF 5x tap down
              - conditions:
                  - condition: template
                    value_template: "{{ trigger.event.data.label == Scene 002 and trigger.event.data.value == KeyPressed5x }}"
                sequence: !input 5x_tap_down
            # IF hold up
              - conditions:
                  - condition: template
                    value_template: "{{ trigger.event.data.label == Scene 001 and trigger.event.data.value == KeyHeld }}"
                sequence: !input hold_up
            # IF hold down
              - conditions:
                  - condition: template
                    value_template: "{{ trigger.event.data.label == Scene 002 and trigger.event.data.value == KeyHeld }}"
                sequence: !input hold_down
            # ELSE: unhandled label/value
            default:
              - service: system_log.write
                data:
                  level: debug
                  logger: "{{ logger }}"
                  message: "Activated scene '{{ trigger.event.data.scene_label }}' ({{ trigger.event.data.label }}) with value '{{ trigger.event.data.scene_value_label }}' ({{ trigger.event.data.value }}) for node '{{ zwave_nodeid }}' ({{ trigger.event.data.node_id }})"
    # ELSE: unhandled zwave event
    default: []

It looks like the OP blueprint doesn’t work with zwavejs. I’d like to add yours. How do I add it since it’s not hosted on GitHub?

I haven’t had any luck with kylerw or griffioenjake blueprint in HA using Zwave JS. Definitely could be an issue with my setup just posting in case anyone else is having issues thanks for the work and posting for others to use.

[griffioenjake] blueprint creates the automation but it never shows up in the gui under automation. I can see the autiomation is created under the automations.yaml.

[kylerw] blueprint gives an Error: listed below
UndefinedError: ‘dict object’ has no attribute ‘event’
Triggered manually at May 7, 2021, 8:25:41 AM
Define variables button_id, press_count
Stopped because an error was encountered at May 7, 2021, 8:25:41 AM (runtime: 0.00 seconds)
UndefinedError: ‘dict object’ has no attribute ‘event’

Below is what I setup in automations to get my self up and running for now. Maybe it can help someone get the button working that is having issues.

alias: Zooz Zen34 Button
description: 'Zooz Zen 34 Button automation'
trigger:
  - platform: event
    event_type: zwave_js_value_notification
    event_data:
      node_id: 22
      label: Scene 001
      value: KeyPressed
condition: []
action:
  - type: toggle
    device_id: 8675309
    entity_id: light.desklamp
    domain: light
mode: single



'Above a upper button press action automation to turn on light example'
'node_id: is the node id number can find under device info'
'label: Scene 001 for upper Scene 002 lower paddle'  
'value: KeyPressed [KeyPressed = 1 x tap, KeyReleased = released, KeyHeld = held, KeyPressed2x = 2 x tap, KeyPressed3x = 3 x tap, KeyPressed4x = 4 x tap, KeyPressed5x = 5 x tap]'

I’ve tried a few more things to make this blueprint work. I was incorrect earlier. It does seem like the OP had updated his blueprint to use Z-Wave JS. I am, however, experiencing the following as well:

I have no idea what would cause this behavior—automation is created in automation.yaml BUT NOT in the gui. Happy to help troubleshoot more if anyone has any suggestions.

I am not experiencing the following:

With a few tweaks to your code, it finally works for me! I had to escape the string names in the templates and fix one bug in the 4x_tap_up case.


blueprint:
  name: Zooz ZEN34 Remote scene control
  description: |
    Use the Zooz ZEN34 remote to trigger Scenes and control devices based on varying scenes. 

    This Blueprint is currently configured for the zwaveJS platform.

  domain: automation

  input:
    zwave_device:
      name: Zooz Zen34
      description: "List of available Zooz ZEN34 switch."
      selector:
        device:
          integration: zwave_js
          manufacturer: Zooz
          model: ZEN34

    1x_tap_up:
      name: Tap up 1x
      selector:
        action:
      default: []
    1x_tap_down:
      name: Tap down 1x
      selector:
        action:
      default: []
    2x_tap_up:
      name: Tap up 2x
      selector:
        action:
      default: []
    2x_tap_down:
      name: Tap down 2x
      selector:
        action:
      default: []
    3x_tap_up:
      name: Tap up 3x
      selector:
        action:
      default: []
    3x_tap_down:
      name: Tap down 3x
      selector:
        action:
      default: []
    4x_tap_up:
      name: Tap up 4x
      selector:
        action:
      default: []
    4x_tap_down:
      name: Tap down 4x
      selector:
        action:
      default: []
    5x_tap_up:
      name: Tap up 5x
      selector:
        action:
      default: []
    5x_tap_down:
      name: Tap down 5x
      selector:
        action:
      default: []
    hold_up:
      name: Hold up
      selector:
        action:
      default: []
    hold_down:
      name: Hold down
      selector:
        action:
      default: []

mode: single

variables:
  logger: blueprint.zwave_scene_activation
  device_id: !input zwave_device

trigger:
  - platform: event
    event_type: zwave_js_value_notification

action:
  - choose:
      # IF triggered node_id is zwave_nodeid
      - conditions:
          - condition: template
            value_template: "{{ trigger.event.data.device_id == device_id }}"
        sequence:
          - choose:
              # IF 1x tap up
              - conditions:
                  - condition: template
                    value_template: "{{ trigger.event.data.label == 'Scene 001' and trigger.event.data.value == 'KeyPressed' }}"
                sequence: !input 1x_tap_up
              # IF 1x tap down
              - conditions:
                  - condition: template
                    value_template: "{{ trigger.event.data.label == 'Scene 002' and trigger.event.data.value == 'KeyPressed' }}"
                sequence: !input 1x_tap_down
              # IF 2x tap up
              - conditions:
                  - condition: template
                    value_template: "{{ trigger.event.data.label == 'Scene 001' and trigger.event.data.value == 'KeyPressed2x' }}"
                sequence: !input 2x_tap_up
              # IF 2x tap down
              - conditions:
                  - condition: template
                    value_template: "{{ trigger.event.data.label == 'Scene 002' and trigger.event.data.value == 'KeyPressed2x' }}"
                sequence: !input 2x_tap_down
              # IF 3x tap up
              - conditions:
                  - condition: template
                    value_template: "{{ trigger.event.data.label == 'Scene 001' and trigger.event.data.value == 'KeyPressed3x' }}"
                sequence: !input 3x_tap_up
              # IF 3x tap down
              - conditions:
                  - condition: template
                    value_template: "{{ trigger.event.data.label == 'Scene 002' and trigger.event.data.value == 'KeyPressed3x' }}"
                sequence: !input 3x_tap_down
              # IF 4x tap up
              - conditions:
                  - condition: template
                    value_template: "{{ trigger.event.data.label == 'Scene 001' and trigger.event.data.value == 'KeyPressed4x' }}"
                sequence: !input 4x_tap_up
              # IF 4x tap down
              - conditions:
                  - condition: template
                    value_template: "{{ trigger.event.data.label == 'Scene 002' and trigger.event.data.value == 'KeyPressed4x' }}"
                sequence: !input 4x_tap_down
              # IF 5x tap up
              - conditions:
                  - condition: template
                    value_template: "{{ trigger.event.data.label == 'Scene 001' and trigger.event.data.value == 'KeyPressed5x' }}"
                sequence: !input 5x_tap_up
              # IF 5x tap down
              - conditions:
                  - condition: template
                    value_template: "{{ trigger.event.data.label == 'Scene 002' and trigger.event.data.value == 'KeyPressed5x' }}"
                sequence: !input 5x_tap_down
              # IF hold up
              - conditions:
                  - condition: template
                    value_template: "{{ trigger.event.data.label == 'Scene 001' and trigger.event.data.value == 'KeyHeld' }}"
                sequence: !input hold_up
              # IF hold down
              - conditions:
                  - condition: template
                    value_template: "{{ trigger.event.data.label == 'Scene 002' and trigger.event.data.value == 'KeyHeld' }}"
                sequence: !input hold_down
            # ELSE: unhandled label/value
            default:
              - service: system_log.write
                data:
                  level: debug
                  logger: "{{ logger }}"
                  message: "Activated scene '{{ trigger.event.data.scene_label }}' ({{ trigger.event.data.label }}) with value '{{ trigger.event.data.scene_value_label }}' ({{ trigger.event.data.value }}) for node '{{ zwave_nodeid }}' ({{ trigger.event.data.node_id }})"
    # ELSE: unhandled zwave event
    default: []
2 Likes

Thanks hahahilarious

This worked great for me!

This is brilliant - thanks!!! Any option to have multiple switches rather than just one - I have 3 entrances to my Lodge, and want the same action for each switch for button press, 2x and 3x button press.

I’m using the blue print shared by @hahahilarious on May 17 and I cannot get the hold down and hold up to work to increase and decrease the brightness of my lights. I’m new to this so any suggestions on how to debug this problem would be much appreciated. Thanks!

The hold down and up events are coming in as KeyHeldDown and not KeyHeld. If you update the blueprint in those two locations it’ll work…sort of. It’ll only send one hold down or up event, so you have to release the button and hold it down again to perform the action.