WTH Matter button event triggers

WTH I can’t create an automation with Matter button as easily as with Zigbee buttons.

There is no trigger for button press:

This is with Zigbee button:

Workaround is:

  1. Detect any change for the entity:

  2. In automation choose condition for event type:

The ergonomics of this is really bad and it has also a side effect, that with restart of the HA, the last event is retriggered - resulting in passing some of the condition unintentionally.

There should be an easy way on how to automate Matter buttons.

Thanks

The button entity is actually a patch solution to people not being able to understand events.
The HA event bus is the correct place to handle that, because the entities only hold the last “state”, which means the user miss the understanding and opportunity to handle on all the other intermediate “states” that occur in many button presses.

The one view you see for Zigbee might be the developer of the integration or the manufacturer of the device that went the extra mile.
With Matter the standard is very specific and nothing can be changed.

Ok, how do I prevent it from calling the automation after the HA restarts (so I won’t receive the last event? If I only set it up when it changes its value, it will not work after the same event is sent again.

Please do not say “nothing can be done with this”. It definitely needs a change - if not technical, then UX at least.

The situation is clearly described here:

3.2.2 CAUTION - Check Your Work - You must leave the Attribute, From, and To fields blank.

You’ll be tempted to take a shortcut of selecting the “Event Type” attribute and a “To” value like “Pressed 2 times”. Don’t do it! This will cause the automation to be unreliable.

This is causing the issue of retriggering the event after the restart. Do you have a solution for that?

1 Like

I completely agree that the UX is horrible for automating buttons, especially for Matter devices. Event entities were once invented as a solution to that issue but in its current shape they actually made the issue worse.

There is work in progress on improving the whole automations editor and flow, but that is something that is not simply done in a couple of days, it needs a lot of work.

Until then, we have adjusted the documentation how to handle with event entities.
Only solution for now is listening to a change of the event entity (do not specify the event type in the trigger) and then either use a condition on the specific type or create a choose to compare the state of event type to figure out what event type was actually fired.

That’s the only solution for now I’m afraid. The device triggers (like you see with zigbee etc) are not implemented for Matter and because those are going away, I can’t add them anymore so we’re stuck between a rock and a hard place.

(I’m the main developer for Matter in HA btw)

1 Like

The event should not be sent again on the event bus, so an event trigger will not react.

But the entity might be restored to last state and that is what your state trigger react to.

The guide you link to above is using a state trigger.

Thank you for your response. I am glad that there are ongoing changes and I am aware that it is not a trivial feature in any regards.

But could you please suggest on how to handle HA restarts? It happens to me, that automations that implement this event handling like you described are re-triggering when HA is restarted. How can I prevent this?

Thank you

This is suggested in the documentation - but maybe I am missing something, but I did it like in the documentation.

Do you suggest an event trigger? If so, it should be reflected in the documentation. :pensive:

Yes,an event trigger.
It might be that the documentation needs to be updated.
The addition of the button “state” entity have muddled it all up.

1 Like

You can probably add something like:

    not_from: unavailable

to the state trigger.