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.
In fact, you could probably use the blueprint above for the Zen34 switch without any issues (you’ll have to toggle the scene mode to switch up/down controls), but I modified the script here anyhow to the following:
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: []
is_loop_for_hold_up:
name: Key Up/On held loop?
description: Asserts whether you want to loop the held action until the button is released which could simulate the impact of a dimmer switch
default: false
selector:
boolean:
hold_down:
name: Hold down
selector:
action:
default: []
is_loop_for_hold_down:
name: Key Down/On held loop?
description: Asserts whether you want to loop the held action until the button is released which could simulate the impact of a dimmer switch
default: false
selector:
boolean:
key_up_released:
name: Key Up/On released
description: Action to run, when the up button is released.
default: []
selector:
action:
key_down_released:
name: Key Down/Off released
description: Action to run, when the down button is released.
default: []
selector:
action:
mode: restart
max_exceeded: silent
variables:
logger: blueprint.zwave_scene_activation
device_id: !input zwave_device
key_up_scene_id: "Scene 001"
key_down_scene_id: "Scene 002"
is_loop_for_hold_up: !input "is_loop_for_hold_up"
is_loop_for_hold_down: !input "is_loop_for_hold_down"
trigger:
- platform: event
event_type: zwave_js_value_notification
action:
- variables:
scene_id: "{{trigger.event.data.label}}"
key_pressed: "{{trigger.event.data.value}}"
- 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: "{{ scene_id == key_up_scene_id and key_pressed == 'KeyPressed' }}"
sequence: !input 1x_tap_up
# IF 1x tap down
- conditions:
- condition: template
value_template: "{{ scene_id == key_down_scene_id and key_pressed == 'KeyPressed' }}"
sequence: !input 1x_tap_down
# IF 2x tap up
- conditions:
- condition: template
value_template: "{{ scene_id == key_up_scene_id and key_pressed == 'KeyPressed2x' }}"
sequence: !input 2x_tap_up
# IF 2x tap down
- conditions:
- condition: template
value_template: "{{ scene_id == key_down_scene_id and key_pressed == 'KeyPressed2x' }}"
sequence: !input 2x_tap_down
# IF 3x tap up
- conditions:
- condition: template
value_template: "{{ scene_id == key_up_scene_id and key_pressed== 'KeyPressed3x' }}"
sequence: !input 3x_tap_up
# IF 3x tap down
- conditions:
- condition: template
value_template: "{{ scene_id == key_down_scene_id and key_pressed == 'KeyPressed3x' }}"
sequence: !input 3x_tap_down
# IF 4x tap up
- conditions:
- condition: template
value_template: "{{ scene_id == key_up_scene_id and key_pressed== 'KeyPressed4x' }}"
sequence: !input 4x_tap_up
# IF 4x tap down
- conditions:
- condition: template
value_template: "{{ scene_id == key_down_scene_id and key_pressed == 'KeyPressed4x' }}"
sequence: !input 4x_tap_down
# IF 5x tap up
- conditions:
- condition: template
value_template: "{{ scene_id == key_up_scene_id and key_pressed == 'KeyPressed5x' }}"
sequence: !input 5x_tap_up
# IF 5x tap down
- conditions:
- condition: template
value_template: "{{ scene_id == key_down_scene_id and key_pressed == 'KeyPressed5x' }}"
sequence: !input 5x_tap_down
- conditions:
- condition: template
value_template: '{{ scene_id == key_up_scene_id and key_pressed == "KeyReleased" }}'
sequence: !input "key_up_released"
- conditions:
- condition: template
value_template: '{{ scene_id == key_down_scene_id and key_pressed == "KeyReleased" }}'
sequence: !input "key_down_released"
- conditions:
- condition: template
value_template: '{{ scene_id == key_up_scene_id and key_pressed == "KeyHeldDown" }}'
sequence:
# if looping is enabled, loop the action indefinitely
# repeat until the automation is restarted ie. when the corresponding release message is received
- repeat:
sequence: !input "hold_up"
until: "{{ not is_loop_for_hold_up }}"
- conditions:
- condition: template
value_template: '{{ scene_id == key_down_scene_id and key_pressed == "KeyHeldDown" }}'
sequence:
# if looping is enabled, loop the action indefinitely
# repeat until the automation is restarted ie. when the corresponding release message is received
- repeat:
sequence: !input "hold_down"
until: "{{ not is_loop_for_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: []
You’re right! I designed Yet another dimmer/scene blueprint for compatibility among my ZEN34 and Inovelli switches after I noticed how similar they were
Hey Alex - I like this blueprint, thanks. I just picked up a Zen34 and have a simple version running in basic automations, but wow… nice blueprint. Only problem is… How this new firmware is coming in in zwave_JS
key_pressed isn’t a thing. It’s the “value”: 0 which comes in as
0 for one press
2 for hold
3 for double
4 for triple
5 for quadruple
6 for five taps
It’s firmware 1.30, there’s a 1.4 that just came out this month, and zwave.js is all up to date as of posting (May 29, 2022)
Driver Version: 9.3.0
Server Version: 1.17.0
Am I missing something? Obviously, it’s not working.
Thank you for posting
I had a similar issue with the scene controller from Zooz (Zen32). I had two of them and one had events coming in with the correct string and one that came in with the value and value_raw as the same integer. I contacted Zooz about it and they basically told me to use value_raw as that will be consistent across all devices. I ended up having to rewrite my scene controller to do just that, so you can maybe use the same logic that @jayvarner is using, BUT a safer way that works across multiple devices with potentially different reporting schemes utilizes both value and value_raw:
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: []
is_loop_for_hold_up:
name: Key Up/On held loop?
description: Asserts whether you want to loop the held action until the button is released which could simulate the impact of a dimmer switch
selector:
boolean:
default: []
hold_down:
name: Hold down
selector:
action:
default: []
is_loop_for_hold_down:
name: Key Down/On held loop?
description: Asserts whether you want to loop the held action until the button is released which could simulate the impact of a dimmer switch
selector:
boolean:
default: []
key_up_released:
name: Key Up/On released
description: Action to run, when the up button is released.
default: []
selector:
action:
key_down_released:
name: Key Down/Off released
description: Action to run, when the down button is released.
default: []
selector:
action:
mode: restart
max_exceeded: silent
variables:
logger: blueprint.zwave_scene_activation
device_id: !input zwave_device
key_up_scene_id: "Scene 001"
key_down_scene_id: "Scene 002"
is_loop_for_hold_up: !input "is_loop_for_hold_up"
is_loop_for_hold_down: !input "is_loop_for_hold_down"
trigger:
- platform: event
event_type: zwave_js_value_notification
condition: "{{ trigger.event.data.device_id == device_id }}"
action:
- variables:
scene_id: "{{trigger.event.data.label}}"
key_pressed: "{{trigger.event.data.value}}"
value_raw: "{{trigger.event.data.value_raw}}"
- 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: "{{ scene_id == key_up_scene_id and (key_pressed == 'KeyPressed' or value_raw == 0) }}"
sequence: !input 1x_tap_up
# IF 1x tap down
- conditions:
- condition: template
value_template: "{{ scene_id == key_down_scene_id and (key_pressed == 'KeyPressed' or value_raw == 0) }}"
sequence: !input 1x_tap_down
# IF 2x tap up
- conditions:
- condition: template
value_template: "{{ scene_id == key_up_scene_id and (key_pressed == 'KeyPressed2x' or value_raw == 3) }}"
sequence: !input 2x_tap_up
# IF 2x tap down
- conditions:
- condition: template
value_template: "{{ scene_id == key_down_scene_id and (key_pressed == 'KeyPressed2x' or value_raw == 3) }}"
sequence: !input 2x_tap_down
# IF 3x tap up
- conditions:
- condition: template
value_template: "{{ scene_id == key_up_scene_id and (key_pressed== 'KeyPressed3x' or value_raw == 4) }}"
sequence: !input 3x_tap_up
# IF 3x tap down
- conditions:
- condition: template
value_template: "{{ scene_id == key_down_scene_id and (key_pressed == 'KeyPressed3x' or value_raw == 4) }}"
sequence: !input 3x_tap_down
# IF 4x tap up
- conditions:
- condition: template
value_template: "{{ scene_id == key_up_scene_id and (key_pressed== 'KeyPressed4x' or value_raw == 5) }}"
sequence: !input 4x_tap_up
# IF 4x tap down
- conditions:
- condition: template
value_template: "{{ scene_id == key_down_scene_id and (key_pressed == 'KeyPressed4x' or value_raw == 5) }}"
sequence: !input 4x_tap_down
# IF 5x tap up
- conditions:
- condition: template
value_template: "{{ scene_id == key_up_scene_id and (key_pressed == 'KeyPressed5x' or value_raw == 6) }}"
sequence: !input 5x_tap_up
# IF 5x tap down
- conditions:
- condition: template
value_template: "{{ scene_id == key_down_scene_id and (key_pressed == 'KeyPressed5x' or value_raw == 6) }}"
sequence: !input 5x_tap_down
- conditions:
- condition: template
value_template: '{{ scene_id == key_up_scene_id and (key_pressed == "KeyReleased" or value_raw == 1 ) }}'
sequence: !input "key_up_released"
- conditions:
- condition: template
value_template: '{{ scene_id == key_down_scene_id and (key_pressed == "KeyReleased" or value_raw == 1 ) }}'
sequence: !input "key_down_released"
- conditions:
- condition: template
value_template: '{{ scene_id == key_up_scene_id and (key_pressed == "KeyHeldDown" or value_raw == 2) }}'
sequence:
# if looping is enabled, loop the action indefinitely
# repeat until the automation is restarted ie. when the corresponding release message is received
- repeat:
sequence:
!input "hold_up"
until: "{{ not is_loop_for_hold_up }}"
- conditions:
- condition: template
value_template: '{{ scene_id == key_down_scene_id and (key_pressed == "KeyHeldDown" or value_raw == 2)}}'
sequence:
# if looping is enabled, loop the action indefinitely
# repeat until the automation is restarted ie. when the corresponding release message is received
- repeat:
sequence:
!input "hold_down"
until: "{{ not is_loop_for_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: []
Oh I forgot I did that - it was something I was playing around with. You can set a delay as one of your actions when you are setting up your automation if you need it; no need to hardcode it into the template/blueprint.
This may seem strange, and perhaps it’s a coincidence, but when I uncommented the delays in the bluebring, any automations I created wouldn’t show up in the GUI or operate at all. I had to manually prune them out of automations.yaml and get rid of the delays to make it operate normally again. Odd, and I’m not sure that’s the reason, but its what I experienced right now.
By the way, I also notice that when I turn off the loop function, in the automation, the little ‘switch’ icon will turn back to “on” after several seconds.
On the other hand, it doesn’t actually seem to loop. Any suggestions on how I could troubleshoot this? For example, the path exists in the trace, but never shows it activating.
I updated this script to allow the option for multiple device selection.
Use Case, I have two of these switches in either side of our bed and want them to do the same.
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_devices:
name: Zooz Zen34
description: "List of available Zooz ZEN34 switch."
selector:
device:
integration: zwave_js
manufacturer: Zooz
model: ZEN34
multiple: true
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: []
is_loop_for_hold_up:
name: Key Up/On held loop?
description: Asserts whether you want to loop the held action until the button is released which could simulate the impact of a dimmer switch
selector:
boolean:
default: []
hold_down:
name: Hold down
selector:
action:
default: []
is_loop_for_hold_down:
name: Key Down/On held loop?
description: Asserts whether you want to loop the held action until the button is released which could simulate the impact of a dimmer switch
selector:
boolean:
default: []
key_up_released:
name: Key Up/On released
description: Action to run, when the up button is released.
default: []
selector:
action:
key_down_released:
name: Key Down/Off released
description: Action to run, when the down button is released.
default: []
selector:
action:
mode: restart
max_exceeded: silent
variables:
logger: blueprint.zwave_scene_activation
device_ids: !input zwave_devices
key_up_scene_id: "Scene 001"
key_down_scene_id: "Scene 002"
is_loop_for_hold_up: !input "is_loop_for_hold_up"
is_loop_for_hold_down: !input "is_loop_for_hold_down"
trigger:
- platform: event
event_type: zwave_js_value_notification
condition: "{{ trigger.event.data.device_id in device_ids }}"
action:
- variables:
scene_id: "{{trigger.event.data.label}}"
key_pressed: "{{trigger.event.data.value}}"
value_raw: "{{trigger.event.data.value_raw}}"
- choose:
# IF triggered node_id is zwave_nodeid
- conditions:
- condition: template
value_template: "{{ trigger.event.data.device_id in device_ids }}"
sequence:
- choose:
# IF 1x tap up
- conditions:
- condition: template
value_template: "{{ scene_id == key_up_scene_id and (key_pressed == 'KeyPressed' or value_raw == 0) }}"
sequence: !input 1x_tap_up
# IF 1x tap down
- conditions:
- condition: template
value_template: "{{ scene_id == key_down_scene_id and (key_pressed == 'KeyPressed' or value_raw == 0) }}"
sequence: !input 1x_tap_down
# IF 2x tap up
- conditions:
- condition: template
value_template: "{{ scene_id == key_up_scene_id and (key_pressed == 'KeyPressed2x' or value_raw == 3) }}"
sequence: !input 2x_tap_up
# IF 2x tap down
- conditions:
- condition: template
value_template: "{{ scene_id == key_down_scene_id and (key_pressed == 'KeyPressed2x' or value_raw == 3) }}"
sequence: !input 2x_tap_down
# IF 3x tap up
- conditions:
- condition: template
value_template: "{{ scene_id == key_up_scene_id and (key_pressed== 'KeyPressed3x' or value_raw == 4) }}"
sequence: !input 3x_tap_up
# IF 3x tap down
- conditions:
- condition: template
value_template: "{{ scene_id == key_down_scene_id and (key_pressed == 'KeyPressed3x' or value_raw == 4) }}"
sequence: !input 3x_tap_down
# IF 4x tap up
- conditions:
- condition: template
value_template: "{{ scene_id == key_up_scene_id and (key_pressed== 'KeyPressed4x' or value_raw == 5) }}"
sequence: !input 4x_tap_up
# IF 4x tap down
- conditions:
- condition: template
value_template: "{{ scene_id == key_down_scene_id and (key_pressed == 'KeyPressed4x' or value_raw == 5) }}"
sequence: !input 4x_tap_down
# IF 5x tap up
- conditions:
- condition: template
value_template: "{{ scene_id == key_up_scene_id and (key_pressed == 'KeyPressed5x' or value_raw == 6) }}"
sequence: !input 5x_tap_up
# IF 5x tap down
- conditions:
- condition: template
value_template: "{{ scene_id == key_down_scene_id and (key_pressed == 'KeyPressed5x' or value_raw == 6) }}"
sequence: !input 5x_tap_down
- conditions:
- condition: template
value_template: '{{ scene_id == key_up_scene_id and (key_pressed == "KeyReleased" or value_raw == 1 ) }}'
sequence: !input "key_up_released"
- conditions:
- condition: template
value_template: '{{ scene_id == key_down_scene_id and (key_pressed == "KeyReleased" or value_raw == 1 ) }}'
sequence: !input "key_down_released"
- conditions:
- condition: template
value_template: '{{ scene_id == key_up_scene_id and (key_pressed == "KeyHeldDown" or value_raw == 2) }}'
sequence:
# if looping is enabled, loop the action indefinitely
# repeat until the automation is restarted ie. when the corresponding release message is received
- repeat:
sequence:
!input "hold_up"
until: "{{ not is_loop_for_hold_up }}"
- conditions:
- condition: template
value_template: '{{ scene_id == key_down_scene_id and (key_pressed == "KeyHeldDown" or value_raw == 2)}}'
sequence:
# if looping is enabled, loop the action indefinitely
# repeat until the automation is restarted ie. when the corresponding release message is received
- repeat:
sequence:
!input "hold_down"
until: "{{ not is_loop_for_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: []
Hey folks, reading through this thread, I have everything working except holding the switch up/down. It looks like in the actual Blueprint the call is “KeyHeld” and someone makes the reference to “KeyHeldDown.” I have used the blueprint as it stands and also have edited the Blueprint to use KeyHeldDown and cannot get the device to call the scene either way. Like I said, no problems with tap at all (even with the scene I want to call). Thoughts?
I have this working great! One problem though, on my Zen34 device page it doesn’t show any automations. Anyone know how I can get my automation to show up there?