It is a bit of a pain, but it does work well if you use state attributes in your triggers.
I have the Aqara mini switch and it fires all kinds of events:
1. initial_press --> this is fired on any kind of press (long, short, multiple)
2. short_release --> fired only after a single press
3. long_press --> was not able to make it fire!
4. long_release --> fired after a long press
5. multi_press_ongoing --> fired on any kind of press (long, short, multiple)
6. multi_press_complete --> fired after any kind of press (long, short, multiple)
So, since multiple types of ‘event_type’ are fired at the same time, you need to use them selectively & carefully. For example, since ‘initial_press’ is fired upon any type of presses, it is useless if you want to trigger a different automation based on different number of presses or long/short press.
So, to trigger automations based on the classic options of ‘Single Press’, ‘Double Press’ and ‘Long Press’, you can use the following options:
For SINGLE press, use the attribute ‘event type’ = short_release:
trigger:
- platform: state
entity_id:
- event.your_switch_name
attribute: event_type
to: short_release
For DOUBLE press, use attribute ‘totalNumberOfPressesCounted’ = 2, (which comes only after the attribute ‘event_type’ = multi_press_complete; but you don’t need to reference the event_type in this case, use totalNumberOfPressesCounted directly):
trigger:
- platform: state
entity_id:
- event.sw_office_desk
attribute: totalNumberOfPressesCounted
to: 2
[NOTE: you can also trigger a SINGLE press using the totalNumberOfPressesCounted attribute directly, by setting its number to 1]
For LONG press, I use the “long_release” event type:
trigger:
- platform: state
entity_id:
- event.your_switch_name
attribute: event_type
to: long_release
I hope this helps anyone who is trying to set up buttons using Matter triggers.
I am not sure if it works with every brand, but it does work like this at least with all Aqara Matter-enabled switches I have tried.