So I am still learning the ins and outs of automation scripting and jninja2 code and I am hoping that someone can help with what I’m trying to do.
I have a bunch of zwave dimmer switches that support a “double tap” action. I have an entity group that contains these dimmers, and I want to make an automation that does the following:
- triggers on the
zwave_js_value_notification
for a device in that entity group that matches {{ button_id == "001" and press_count == "KeyPressed2x" }}
- sets the brightness to 100% with the light.turn_on service for the entity that triggered the automation
I know I can get the zwave device id from the value_notification event via trigger.event.data.device_id
but I’m struggling to understand how to iterate through the entities in the entity group and how to associate the zwave device id with the entity it relates to.
I’m guessing there is something obvious I’m missing, hope someone can enlighten me.
You can easily accomplish this by using the EVENT trigger in your automation. The property key is unique to each button and this is how you can tell which button generated the event. The value raw key is unique to each event generated by the button. This is how you can tell what actions were performed on the button. On my device a double press has a value of 3 and a single press has a value of 0.
platform: event
event_type: zwave_js_value_notification
event_data:
node_id: 12
home_id: 3846008132
command_class: 91
property_key: "004"
value_raw: 3
Thanks! I noticed that blueprint inputs have the ability to filter based on manufacturer and model. Is it possible to get these values for a given device_id in an automation?
I don’t think so. The only information displayed in the event viewer is the following.
event_type: zwave_js_value_notification
data:
domain: zwave_js
node_id: 12
home_id: 3846008132
endpoint: 0
device_id: 08b20e6e1719d10de047a6d0b7d3707f
command_class: 91
command_class_name: Central Scene
label: Scene 004
property: scene
property_name: scene
property_key: "004"
property_key_name: "004"
value: KeyPressed
value_raw: 0
origin: LOCAL
time_fired: "2023-04-30T20:10:05.709123+00:00"
context:
id: 01GZ9WJV0DKGQ8XQB42PC54B35
parent_id: null
user_id: null
1 Like
For anyone curious, I was able to figure this out with a tidy bit of blueprint code. With this blueprint I can select a list of light switch dimmer devices, and then if any of them have their “on” button/paddle pressed one time, it will turn that light on at 100% rather than what ever dim level it had previously been at. Works perfectly with HomeSeer dimmers, but other brands will likely need modification to the event-data variables (for example, Inovelli appears to use property_key “002” for up button instead of “001”…).
Here is the blueprint code:
blueprint:
name: Lights to full brightness on single tap
domain: automation
input:
zwave_dimmers:
name: Set of ZWave Dimmers
description: Select the Dimmer Switches to use
selector:
device:
filter:
- integration: zwave_js
manufacturer: HomeSeer Technologies
multiple: true
variables:
device_ids: !input zwave_dimmers
trigger:
#
# Trigger on "on" button pressed zwave scene event from dimmer
#
- platform: event
event_type: zwave_js_value_notification
event_data:
property: scene
property_key: "001"
value: KeyPressed
id: up_button_pressed
#
# If the device that triggered the event is on the list, then set brightness to 100%
#
condition: "{{ trigger.event.data.device_id in device_ids }}"
action:
- service: light.turn_on
data:
brightness_pct: 100
target:
device_id: "{{ trigger.event.data.device_id }}"