Are stateless Matter/Thread buttons supported? Tuo button only shows battery state

I just got a Tuo Thread/Matter stateless button. In Apple Home it supports single press, double press, long press. However, when I add the button to HA I only see a battery sensor. There’s no entity related to button presses or such. When I run the automation wizard it only gives me two options related to battery status.

Are stateless multi-click buttons supported with Matter? Or am I not understanding how stateless buttons interact or show up in HA?

Add an automation. Click “Add trigger” and then select “device” from the popup. For the device, select the device that you are talking about. Then the next drop down, trigger, should show you the options for that device - button 1 short press, etc…

Nope only battery option.

This is a standard Hue button, so not Matter/Thread but I imagine the principle should be the same (in that it is also stateless).

Maybe not - the Matter integration is still in beta and I don’t see Tuo mentioned in the docs.

I would enter it as an issue for that integration, the developer can then give direction (unless it is in fact a bug)

The Matter integration? Over on Discord someone referred me to: Add generic switch support to Matter integration by ProstoSanja · Pull Request #96064 · home-assistant/core · GitHub (add generic switch support to Matter integration).

Buttons usually go on the HA event bus and not as a state, which is why you only see the battery state.
Look for the events in developers tools → events

Thanks, but no events with button presses.

I have this Tuo Button and figured out how to get an automation to pick up button press (see pic).

1 Like

Ya the complication is triggering on double tap, triple tap, or long presses as well.

No luck in getting those different actions working, I assume? Would love to find what smart button I can program well with Home Assistant

Not worth the effort, IMHO. HA devs need to radically update their button support.

1 Like

It seems to be a common problem with matter and generic buttons.

How did you pull that off?

Initial press is easy to do in HA. However, double press and long press are the killers, until HA overhauls their Matter button code.

I installed an Aqara Wireless Mini Switch through Matter. For devices it only lists the Battery as you indicated. I did search by name under Entities and found my switch. From there, I could see that events were fired. This was not particularly useful, but showed me that the device was functioning. I then used the Event Listener to follow * and pressed the button to see that state_changed events fired with each press of the button. I then used these to better automate the button.

To add to what @KruseLuds said, I used the Add Trigger and then select Entity and then the Attribute to get a basic automation started that you might see what is going on in the yaml below.

edit: I missed part of the thread—
Pulling apart the event got me to a variable showing the number of presses and this enabled me do catch events with single and multiple presses upon the end of the multi_press event to determine the action to be taken.

  - choose:
      - conditions:
          - condition: numeric_state
            entity_id: event.steph_s_button
            attribute: totalNumberOfPressesCounted
            above: 0
            below: 2
        sequence:
          - service: switch.toggle
            metadata: {}
            data: {}
            target:
              entity_id: switch.readinglight
      - conditions:
          - condition: numeric_state
            entity_id: event.steph_s_button
            above: 1
            below: 3
            attribute: totalNumberOfPressesCounted
        sequence:
          - service: tts.speak
            metadata: {}
            data:
              cache: true
              media_player_entity_id: media_player.kitchen_group
              message: Two
            target:
              entity_id: tts.google_en_com```

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.

I’m working on a blueprint to this effect yet. I have one roughed in. I’m curious as to your -

attribute: totalNumberOfPressesCounted
to: 2

Would that not trigger on the way to a triple press? I have been using a trigger that the multi_press_complete before choosing based upon totalNumberOfPressesCounted. Similary, if the count is 1…the from state can be checked with long_release v short_release to get discern between those to as well, yes?

That depends on how the button works.
If it sends a state change after each single button press then yes.
If it sends a state change x ms seconds after the last button press then no.

Got ya!

My button (Aqara WXKG11LM) sends several state changes with each press. A single short press will send:

initial_press
short_release
multi_press_complete (count 1)

A double short press would be:

initial_press
short_release
initial_press
short_release
multi_press_complete (count 2)

That makes for a lot of events! I’m slowly getting the grasp of where to intercept what information. I have had most success working from the multi_press_complete as a trigger.