Triggering on zwave.scene_activated

I’m having trouble triggering an automation based on a “zwave.scene_activated” event.

I’m running core-2021.8.8, supervisor-2021.10.8, on Home Assistant OS 6.2 with the “Z-Wave (import from configuration.yaml)” integration.

My end goal is to simply trigger some automations using the buttons on a GoControl WA00Z-1 switch. I wrote a script that I thought would work, but no go.

In HA Developer Tools, under Events, I can listen to zwave.scene_activated, and I see an event occur when I click the top button (for example):

Event 0 fired 5:40 PM:
{
    "event_type": "zwave.scene_activated",
    "data": {
        "entity_id": "zwave.linear_nortek_security_control_llc_wa00z_1_scene_switch",
        "node_id": 16,
        "scene_id": 1,
        "scene_data": 0
    },
    "origin": "LOCAL",
    "time_fired": "2021-11-18T23:40:08.034852+00:00",
    "context": {
        "id": "43c4fabe44516821a1b09024e998285c",
        "parent_id": null,
        "user_id": null
    }
}

So I believe that the switch is properly set up in zwave, and that my zwcfg_*.xml file is set up correctly.

After trying various permutations of triggers with and without data
entity_id, node_id, scene_id, scene_data; all with no luck. So now
I’ve stripped my automation down to:

- id: ps_top_single_click
  alias: Light up the house
  trigger:
    - platform: event
      event_type: zwave.scene_activated
  action:
    service: switch.turn_on
    entity_id: switch.roaming_switch_one

I can trigger this automation under HA Configuration - Automations - Run Actions; my test light comes on as expected - so I believe that the action: portion of the automation is OK.

And if I fire a zwave.scene_activated event artificially, using Developer Tools, I again see a reasonable result in the Listener window:

Event 0 fired 5:34 PM:
{
    "event_type": "zwave.scene_activated",
    "data": {},
    "origin": "REMOTE",
    "time_fired": "2021-11-18T23:34:16.669754+00:00",
    "context": {
        "id": "aba21f4c2c468cc54dc2873390d673ae",
        "parent_id": null,
        "user_id": "09e2e52dbcc74d5898a9aa8b55a3781e"
    }

But still, the automation will not trigger.

I’ve scoured the web, and can’t find a solution. I don’t understand why the Listener can “hear” the event, whether generated by the Developer Tools or by my switch, but the automation can’t. Any ideas?

Thanks!

Here is an automation I used prior to switching to zwavejs that used a long press on the top button to toggle a light:

  - alias: LC MBR Lamp Toggle with Scene Switch
    trigger:
      - platform: event
        event_type: zwave.scene_activated
        event_data:
          entity_id: zwave.mbr_scene_switch
          node_id: 35
          scene_id: 1
          scene_data: 2
    action:
      - service: script.turn_on
        data:
          entity_id: >
            {% if is_state('light.mbr_lamp', 'on') %}
              script.lc_mbr_lamp_control_off
            {% else %}
              script.lc_mbr_lamp_control_on
            {% endif %}

and another using a short press of the top button to cycle thru fan speeds.

  - alias: Turn MBR Fan On With Scene Switch
    trigger:
      - platform: event
        event_type: zwave.scene_activated
        event_data:
          entity_id: zwave.mbr_scene_switch
          node_id: 35
          scene_id: 1
          scene_data: 0
    action:
      - service: fan.set_percentage #fan.set_speed
        data:
          entity_id: fan.master_bedroom_fan
          percentage: >-
            {% if states('fan.master_bedroom_fan') == 'off' %}
              33
            {% elif states('fan.master_bedroom_fan') == 'on' and state_attr('fan.master_bedroom_fan', 'percentage') == 33 %}
              66
            {% elif states('fan.master_bedroom_fan') == 'on' and state_attr('fan.master_bedroom_fan', 'percentage') == 66 %}
              100
            {% elif states('fan.master_bedroom_fan') == 'on' and state_attr('fan.master_bedroom_fan', 'percentage') == 100 %}
              33
            {% endif %}

Thanks for the information; I tried the equivalent of the top button short press action:

  trigger:
    - platform: event
      event_type: zwave.scene_activated
      event_data:
        entity_id: zwave.linear_nortek_security_control_llc_wa00z_1_scene_switch
        node_id: 16
        scene_id: 1
        scene_data: 0

With no luck. The Listener still shows the event occurring in response to the button:

Event 0 fired 9:19 AM:
{
    "event_type": "zwave.scene_activated",
    "data": {
        "entity_id": "zwave.linear_nortek_security_control_llc_wa00z_1_scene_switch",
        "node_id": 16,
        "scene_id": 1,
        "scene_data": 0
    },
    "origin": "LOCAL",
    "time_fired": "2021-11-19T15:19:57.189786+00:00",
    "context": {
        "id": "15e9673020443c45648113f81618d72a",
        "parent_id": null,
        "user_id": null
    }
}

but the automation does not trigger.

Maybe a silly question, but is the automation enabled?

And have you also checked the HA log for any errors at the time the automation should trigger?

OMG. Just proves there are no silly questions, only silly engineers that think they’ve checked every possibility: the automation was disabled somehow. When I enabled it, and used the trigger code suggested by finity, it worked!
I am very embarrassed. That’s worse than RTFM; it’s right up there with “Did you check the fuse?”.
Thank you, freshcoast!

1 Like

Do you have updated code for Zwavejs or a blueprint?

  - alias: LC MBR Lamp Toggle with Scene Switch
    trigger:
      - platform: event
        event_type: zwave_js_value_notification
        event_data:
          node_id: 35
          label: Scene 001
          value: KeyHeldDown
    action:
      - service: script.turn_on
        data:
          entity_id: >
            {% if is_state('light.mbr_lamp', 'on') %}
              script.lc_mbr_lamp_control_off
            {% else %}
              script.lc_mbr_lamp_control_on
            {% endif %}
  - alias: Turn MBR Fan On With Scene Switch
    trigger:
      - platform: event
        event_type: zwave_js_value_notification
        event_data:
          node_id: 35
          label: Scene 001
          value: KeyPressed
    action:
      - service: fan.set_speed
        data:
          entity_id: fan.master_bedroom_fan
          speed: >-
            {% if states('fan.master_bedroom_fan') == 'off' %}
              low
            {% elif states('fan.master_bedroom_fan') == 'on' and state_attr('fan.master_bedroom_fan', 'speed') == 'low' %}
              medium
            {% elif states('fan.master_bedroom_fan') == 'on' and state_attr('fan.master_bedroom_fan', 'speed') == 'medium' %}
              high
            {% elif states('fan.master_bedroom_fan') == 'on' and state_attr('fan.master_bedroom_fan', 'speed') == 'high' %}
              low
            {% endif %}
1 Like

Thank you!

1 Like