Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Matter - Pressed Twice (Three, Four) doesn't clear #124236

Closed
LarryWMSN opened this issue Aug 19, 2024 · 10 comments
Closed

Matter - Pressed Twice (Three, Four) doesn't clear #124236

LarryWMSN opened this issue Aug 19, 2024 · 10 comments

Comments

@LarryWMSN
Copy link

The problem

When using the new Pressed Twice (three, four or five times) for an automation, the state of the button doesn't clear. This is an issue if a Press Twice event turns on lights in another room and then it is turned off from a different event. The primary event will stay in the Twice Pressed status, so it won't trigger as expected the next time. This can be worked around by doing a single, triple... press to change the status, but that's not optimal as those events can have automations tied to them.

What version of Home Assistant Core has the issue?

core-2024.8.2

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant OS

Integration causing the issue

Matter

Link to integration documentation on our website

https://www.home-assistant.io/integrations/matter

Diagnostics information

No response

Example YAML snippet

No response

Anything in the logs that might be useful for us?

No response

Additional information

No response

@home-assistant
Copy link

Hey there @home-assistant/matter, mind taking a look at this issue as it has been labeled with an integration (matter) you are listed as a code owner for? Thanks!

Code owner commands

Code owners of matter can trigger bot actions by commenting:

  • @home-assistant close Closes the issue.
  • @home-assistant rename Awesome new title Renames the issue.
  • @home-assistant reopen Reopen the issue.
  • @home-assistant unassign matter Removes the current integration label and assignees on the issue, add the integration domain after the command.
  • @home-assistant add-label needs-more-information Add a label (needs-more-information, problem in dependency, problem in custom component) to the issue.
  • @home-assistant remove-label needs-more-information Remove a label (needs-more-information, problem in dependency, problem in custom component) on the issue.

(message by CodeOwnersMention)


matter documentation
matter source
(message by IssueLinks)

@LarryWMSN
Copy link
Author

This is not a repeat of issue #123347

The problem that caused that issue was not identified completely and therefore closed. The yaml solution fails under many scenarios since the event_state doesn't reset. This prevents an action from getting triggered again until a different event_state is triggered. The same trigger may need to happen two times in a row, separated by some time (could be days or more), if another action caused changes to any of the same objects as the initial automation.

@marcelveldt
Copy link
Member

Yes, this is by design for the event entity - the event_type attribute just contains the last fired event type. The only thing that changes every time is the state to the timestamp of the last action.

@marcelveldt
Copy link
Member

To create automations for event entities you never filter for event_type but just for state and then you check the event type with an additional if or choose statement

@LarryWMSN
Copy link
Author

The main issue is that a multi press is an event in reality, but it is treated as a state by HA (tied to the trigger on a generic button event), therefore actions that you would want to automate are made more complex.

Imagine a motion detector that stayed in the motion state once activated, lack of motion isn't an event so it would never clear if it were handled the same way as multi-press is in HA. The firmware creates the idle event as a timeout of the motion state once motion is no longer detected. Since the matter switches do not maintain multi-press in their firmware, HA is taking on that role.

The issue becomes that you cannot create a single automation that handles all the buttons on Matter switch; you would need to create a separate automation for up and down or any other button that may be included to do this intuitively. A trigger Id can be used to accomplish this in a single automation, but this seems overly complex for most non-advanced users.

So, I guess this issue should be changed to a feature request to add a state timeout back to "Unknown" to the matter button entities. Or, even better, to have multi-press events be first class attribute citizens on the button with no dependency on state. If you accept the timeout feature, a default option for "forever" would keep the current behavior, but I suspect most users would want it to be a few seconds at most. We could close this issue if required and I can open up a feature request if that's the proper etiquette.

@jvmahon
Copy link
Contributor

jvmahon commented Aug 21, 2024

@LarryWMSN
I did a write-up on how to properly set up triggers for the event entity, with emphasis on the Inovelli VTM31. This may help: https://github.com/jvmahon/HomeAssistant-Tools/wiki/Matter-Devices-%E2%80%90-Setting-Up-A-Basic-Automation-Using-Button-Taps

If you're using the Inovelli device, this Blueprint is also very helpful: https://gist.github.com/sethvargo/ed6f1cc1ce9e974f484ec34af00f6776

@LarryWMSN
Copy link
Author

I am using a VTM31 too and the blueprint is exactly the same as what I built as an automation using your guide as a starting point. But my contention is still that this isn't very discoverable for an average user to find and, building an automation from scratch requires understanding more logic and flow skills than most users will have. These multi-press events are individual events that should trigger and then cease to exist, using state may make it easier to create the integration but I don't believe this delivers a good or consistent user experience. I do want to thank @jvmahon and @marcelveldt (and Seth Vargo) for all the work you're putting in.

@home-assistant
Copy link

home-assistant bot commented Sep 3, 2024

@marcelveldt
Copy link
Member

marcelveldt commented Sep 3, 2024

This is not a Matter integration issue but a fundamental issue in the event entity itself: when the same event type gets fired multiple times in a row, it doesn't trigger a state update and thus rendering all automations based on the explicit event type unusable.

The only workaround for this is to not listen to the event_type attribute but listen to the state change and then filter the event type in your actions (or conditions). That is, at least until this issue gets fixed at core level.

@marcelveldt
Copy link
Member

We have updated the docs for automating on the event entity. For now that's all we can do.
See the updated documentation here: https://www.home-assistant.io/integrations/event/#automating-on-a-button-press

Its still not very helpful but on the long run the entire automation editor is going to be redesigned completely and this will be taken into account.

@github-actions github-actions bot locked and limited conversation to collaborators Nov 3, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants