Cannot trigger automation with Zen32 scene controller using entities

I am using a Zooz Zen32 scene controller and I cannot seem to be able to trigger automations using entities. I am able to make it work by setting up the trigger by device. below are the yaml for both automations. The only way I am able to make the entity method work is changing the event type to KeyHeldDown. The keypressed and keypressedx2-5 event types do not trigger. I am only guessing that the entity method needs the keypressed event type to be persistent, since the state of the entity only changes to keypressed for a split second when pressing the physical button on the switch. For KeyHeldDown, it stays in that state for the duration that I hold the button down. I think I would have to build all the automation triggers by device, but I understand using entities is best practice. Hopefully, someone can point me in the right direction.

alias: Test device automation (working)
description: ""
triggers:
  - device_id: 2ac8ce2g0296ac7bd56d3dcf7cc781a3
    domain: zwave_js
    type: event.value_notification.central_scene
    property: scene
    property_key: "001"
    endpoint: 0
    command_class: 91
    subtype: Endpoint 0 Scene 001
    trigger: device
    value: 0
    id: shade_up
  - device_id: 2ac8ce2g0296ac7bd56d3dcf7cc781a3
    domain: zwave_js
    type: event.value_notification.central_scene
    property: scene
    property_key: "003"
    endpoint: 0
    command_class: 91
    subtype: Endpoint 0 Scene 003
    trigger: device
    value: 0
    id: shade_down
conditions: []
actions:
  - choose:
      - conditions:
          - condition: trigger
            id:
              - shade_up
        sequence:
          - action: switch.turn_on
            metadata: {}
            data: {}
            target:
              entity_id: switch.window_server_front_relay_bo_1
      - conditions:
          - condition: trigger
            id:
              - shade_down
        sequence:
          - action: switch.turn_on
            metadata: {}
            data: {}
            target:
              entity_id: switch.window_server_front_relay_bo_2
mode: single
alias: Test entity automation (not working)
description: ""
triggers:
  - trigger: state
    entity_id:
      - event.window_server_front_switch_scene_001
    attribute: event_type
    to: KeyPressed
    id: shade_up
  - trigger: state
    entity_id:
      - event.window_server_front_switch_scene_003
    attribute: event_type
    to: KeyPressed
    id: shade_down
conditions: []
actions:
  - choose:
      - conditions:
          - condition: trigger
            id:
              - shade_up
        sequence:
          - action: switch.turn_on
            metadata: {}
            data: {}
            target:
              entity_id: switch.window_server_front_relay_bo_1
      - conditions:
          - condition: trigger
            id:
              - shade_down
        sequence:
          - action: switch.turn_on
            metadata: {}
            data: {}
            target:
              entity_id: switch.window_server_front_relay_bo_2
mode: single

You won’t get a state change if the event is a repeat keypress.

Read through this post:

i read through the post and the topic seems to be about automations being triggered by entities unintentionally. My automations are not triggering at all.

developer tools shows that the event type for the last action is saved. This explains the behavior that I am seeing. From what I see, if the last event type was keypressed, and I press a button which has event type of keypressed, the system does not see a change in event type. The state updates with the current time, but I’m not sure how to utilize that in the automation.

You can’t use the attribute as a trigger. Move those checks to the conditions. The docs have a sample. https://www.home-assistant.io/integrations/event/#event-types

1 Like

ok i went through the docs and followed the steps and it got the automation working. the visual editor made it seem intuitive to add the event type to the trigger. i didn’t even know the documentation on events existed. Thanks.

now to update all the automations I already built…

The first time I tried to use one of the event entities I encountered the same hangup. I find it unintuitive, even though it’s the way state triggers work. I prefer to use the Z-Wave scene events (your original automation but not using the device versions) since I understand them.