Trigger for zwave_js.value_notification

I’m trying to get a scene notification from an Inovelli Red light switch. In my home-assistant.log I see:

2021-03-07 08:50:13 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event zwave_js_event[L]: type=value_notification, domain=zwave_js, node_id=8, home_id=3942958689, endpoint=0, device_id=d48f61fabd3ca41dd39c4628aed6fcdb, command_class=91, command_class_name=Central Scene, label=Scene 002, property=scene, property_name=scene, property_key=002, property_key_name=002, value=KeyPressed2x, value_raw=3>

I don’t know how to create a trigger to handle this event. In the Developer Tools I tried listening for “zwave_js.value_notification” but that did not hear the above event.

In my automations.yaml I added:

- alias: "Garage Light Double Up"
  trigger:
    - platform: event
      event_type: zwave_js.value_notification
  action:
    - service: light.turn_off
      entity_id: light.garage_light_current_value

That also didn’t trigger. And I tried both the above tricks with s/zwave_js/zwave_js_event/, also didn’t work.

How do I implement a trigger for a zwave_js event?

This is HassIO core-2021.3.2 and supervisor-2021.03.4.

I think I got it. For others,

- alias: "Garage Light Double Up"
  trigger:
    - platform: event
      event_type: zwave_js_event
      event_data:
        type: value_notification
        property_key: "002"  # Click up
        value: "KeyPressed2x"
        node_id: 8
  action:
    - service: light.turn_off
      entity_id: light.garage_light_current_value

node_id: 8 is not a great way to indicate it’s my garage light switch. I think this will be fixed by this post so please upvote that one.

The example above didn’t work for me… I don’t know if there’s been a change in the Zwave JS module, but here’s what worked for me:

  - alias: Turn off all upstairs lights
    trigger:
      # x2 down click on light switch 
      - platform: event
        event_type: zwave_js_value_notification
        event_data:
          property_key: "001"  # Click down
          value: "KeyPressed2x"
          node_id: 55 #FIXME light.living_room_overhead_light
    action:
         ...
1 Like

I’m working on consolidating some automations and these examples were really helpful, so thank you!

@kmwoley I know I’m asking months later, but I notice on node_id line, you’ve left a comment to fix. Was the thought being able to somehow look this up?

No, I haven’t! I’d love to know if someone had a solution for this. Here’s how I used to do it prior to moving over to Zwavejs2Mqtt. As far as I can tell, there’s not a way to use the data_template or similar with the event_data.

  - alias: Set light defaults at startup
    trigger:
      - platform: state
        entity_id: zwave.master_bathroom_overhead_light
        to: 'ready'
    action:
      - delay:
          minutes: 5
      - service: zwave.set_config_parameter
        data_template:
          node_id: "{{ states.zwave.master_bathroom_overhead_light.attributes.node_id }}"
          parameter: 9
          value: '{% if ((5 < now().hour) and (now().hour < 22)) %}99{% else %}1{% endif %}'
          size: 1

Thanks for replying/sharing! That’s exactly what I’d like to do too in some capacity, but I couldn’t figure it out. The only alternative I have come up with is to use helpers for storing node values, but I haven’t played with doing that yet and could end up being more of a hassle than it’s worth.