Zigbee2Mqtt buttons doesn't reports first press on automations as action

When using an event entity, if you want to detect two consecutive identical button events you have to make the State Trigger detect all button events and then use a choose to determine which button event occurred.

In other words, instead of doing this:

  - trigger: state
    entity_id:
      - event.przyciski_lazienka_action
    id: RADIO_NS
    to: 1_double
    attribute: event_type

You must do this:

  - trigger: state
    entity_id:
      - event.przyciski_lazienka_action
    not_from: unavailable 

Then use a choose in the automation’s actions to determine which button event occurred.


actions:
  - variables:
      event: "{{ trigger.to_state.attributes.event_type }}"
  - choose:
      - conditions: "{{ event == 'on' }}"
        sequence:
           ... etc ...
      - conditions: "{{ event == 'off' }}"
        sequence:
           ... etc ...
      - conditions: "{{ event == '1_double' }}"
        sequence:
           ... etc ...

I posted an example here and you find a detailed explanation with more examples here.

If you’re interested, I posted my observations on the process of converting one of my automations to detect consecutive identical button events in this post: