Event actions OK but event type triggers not firing! 🤔

I'm trying to use a zigbee battery powered switch to run multiple actions with a choose block.

It's a sonoff SNZB-01 button which supports short, long and double press.
So I have these 3 triggers in a single automation:

  - trigger: state
    entity_id:
      - event.bedroom_switch_action
    attribute: event_type
    to:
      - long
    id: long
  - trigger: state
    entity_id:
      - event.bedroom_switch_action
    attribute: event_type
    to:
      - single
    id: single
  - trigger: state
    entity_id:
      - event.bedroom_switch_action
    attribute: event_type
    to:
      - double
    id: double

I see that the device action happens for each type of button press but the automation does only run 'occasionally'.
Am I doing something wrong or what am I missing?

Ok, even though I have been looking for quite some time at this, just now I figured out what the solution is! :blush:

triggers:
  - trigger: state
    entity_id:
      - event.bedroom_switch_action
    not_from: unvavailable

....

actions:
  - choose:
      - conditions:
          - condition: template
            value_template: "{{trigger.to_state.attributes.event_type == 'long'}}"

Hi @Didgeridrew, it seemed as my first solution should work and I don't understand why it worked only sometimes.
Can you enlighten me by telling why it is like that?

The attribute doesn't change when the same event type happens in succession. So if you do a single press, but the last event was also a single press it doesn't cause a change that an attribute-focused State trigger recognizes.

Thanks for explaining! :person_bowing: