Trigger an automation on an event with no state change (Voice Assistant PE button)

Hi all,
I would like to use the button of the new Home Assistant Voice Assist and trigger a light scene with a double click. Unfortunately the state always remains at “Double_press” and does not change. How can I work with the events, which are also listed in the history, as triggers in an automation?

Would be great if someone could give me a hint… :kissing_smiling_eyes:

Interesting, I’m also curious about a more official answer …

I observed that this seems to work fine:

alias: TEST double press event
description: ""
triggers:
  - trigger: state
    entity_id:
      - event.ha_voice_pe_hobby_button_press
conditions:
  - condition: template
    value_template: "{{ trigger.to_state.attributes.event_type in ('double_press') }}"
actions:
  - action: notify.mobile_app_mobil_adi
    metadata: {}
    data:
      message: double pressed
mode: single

While the first one I was expecting to work (which works from the GUI), works ONLY if I change the event type (e.g.: long_press, then double_press ). If I double_press 2 times, then second time it doesn’t work anymore … :

alias: TEST double press event
description: ""
triggers:
  - trigger: state
    entity_id:
      - event.ha_voice_pe_hobby_button_press
    attribute: event_type
    to: double_press
conditions: []
actions:
  - action: notify.mobile_app_mobil_adi
    metadata: {}
    data:
      message: double pressed
mode: single

Aah, this one works also from the GUI:

alias: TEST double press event
description: ""
triggers:
  - trigger: state
    entity_id:
      - event.ha_voice_pe_hobby_button_press
conditions:
  - condition: state
    entity_id: event.ha_voice_pe_hobby_button_press
    attribute: event_type
    state: double_press
actions:
  - action: notify.mobile_app_mobil_adi
    metadata: {}
    data:
      message: double pressed
mode: single

1 Like

thx for the hint, the event type was the missing part. Unfortunately that is not available in the UI directly, I see only the device class. I was expecting that this is already available for such a project with the current focus. But okay, lets wait for further releases, hopefully its directly available in the dropdown list when using a device as trigger.

Try with: “State”

Thank you adynis for figuring this out!

Could this behavior be a bug? I wanted to use trigger IDs for both long_press and double_press in the same automation. However, it becomes cumbersome if I need to add an additional conditions to determine which type of button press just occurred.
The long_press event should work as a trigger, but it doesn’t work for me without the work around marked as the Solution.