Using the new action events in Zigbee2MQTT 2.0

Thanks. I’ve read the thread and I’ve read your original post.

Reason I was here was to try and understand why the official recommended zigbee2mqtt method isn’t working, maybe I have missed that so will scoot back through the thread to check.

Zigbee2mqtt docs have 3 options. 1 is recommend, 2 is experimental and might break and 3 is legacy.

I’m happy to move away from legacy things so moved to the recommended and it simply doesn’t work.

That’s all, the experimental method no doubt works but moving the button type presses to conditions requires a lot of reconfiguring of my automations.

Instead I’ve gone with the route of using the mqtt payload based on the recommendation within this thread, this means very little change to my automations and in fact has made my lights respond a lot quicker than before.

this! Why was this change done? I don’t get it. The old way worked perfectly with the action entity. Why take it away?

Heres what I had to do to get my Aqara/Xiamoi buttons works in NR again.

  1. Turn experimental on in Z2MQTT

  2. Rename the new event entity to what I want.

  3. Go into NR and points the Events state node to the new event entity

  4. Change the property of my switch node from msg.payload to msg.data.new_state.attributes.event_type

The Z2M team complied with a design decision made (some time ago) by the HA team regarding how a physical remote-control device should be modeled in Home Assistant.

The use of a sensor entity, to report the remote-control’s button events, was deprecated in favor of two alternatives.

The preference is to model it as a device so button events can be detected by MQTT Device Trigger (and the button events are self-documented). The other way is to model the button events using an event entity.

As you have already discovered, making the switch from sensor to event is fairly straightforward.

1 Like

Yes and no. I did the experimental option which is noted may break in the future. The recommended way will be even more of a headache.

I’ll speculate for a moment and predict that Z2M will align itself even more closely with how event entities are implemented in Home Assistant.

Instead of one event entity per remote-control device, it will be one event entity per button. That’s the way event entities are currently implemented in Home Assistant’s Hue integration (Paulus is one of two owners of the Hue integration).

Hi Taras, I understand the decision and am in favor of bringing things in line with HA.
What I’m missing right now is the different type of button presses (long, double, triple) on some of my devices.

Do you know/think that this is something that is possible (technically) to have in the future?

My understanding is that Z2M simply reports whatever button events are provided by the device’s firmware. The device’s manufacturer creates the firmware; they decide how to express the device’s capabilities in terms of the Zigbee protocol.

For example, if neither ZHA or Z2M report a double-click event for some device, it’s highly likely the device’s firmware simply doesn’t report it.

1 Like

In Home assistant “Developer tools”, you can see the information about the event types. This shows what the button is capable of. Rather than a long paragraph about it. See the picture. Yours should reveal your buttons capabilities too. On the event_types section.

1 Like

Thanks guys for responding! :bowing_man:

I have these (and some others):

event_types:
  - single
  - double
  - long
event_type: single
icon: mdi:gesture-double-tap
friendly_name: desk button Action

and

event_types:
  - toggle
  - brightness_up_click
  - brightness_down_click
  - brightness_up_hold
  - brightness_up_release
  - brightness_down_hold
  - brightness_down_release
  - hold
  - arrow_left_click
  - arrow_left_hold
  - arrow_left_release
  - arrow_right_click
  - arrow_right_hold
  - arrow_right_release
event_type: brightness_up_click
icon: mdi:gesture-double-tap
friendly_name: kitchen remote Action

With the first (Sonoff) I could use single, double an long with Z2M v1.x and still with the new approach of v2.0
The second one (IKEA) also had the ability to use single, double long with v1.x but not anymore with v2.0
Another IKEA button was even able to detect double & tripple press, now it’s only single…

The Z2M device pages don’t say anything about the button press abilities and I don’t understand why it worked before whereas now with the IKEA button.

I do not believe the 5 button round IKEA remotes ever natively supported double clicks. It is something I have seen implemented in blueprints where some wise detection of two presses with short pause between is triggered as double click.

See this topic 🎮 ZHA, deCONZ, Zigbee2MQTT - Ikea 5-button Remote Universal blueprint - all actions + double click events - control lights, media players and more with Hooks - #126 by mjmcg

1 Like

Owkay… so you’re saying that a blueprint can add double/triple click functions?!?
Of course I didn’t know that this was provided by the firmware or the BP…

If it did then there would be recent evidence that its documentation had been modified to remove the button events you claimed had existed prior to V2.

The latest PR that modified the documentation for the E1524 device was June 2024 (months before the availability of V2) and didn’t remove any button events.

The functionality you believe to have been lost was never there.

I agree with KennethLavrsen and you may be thinking of the additional functionality provided by an Automation Blueprint.

For example, I have IKEA E2001 and E1743 devices and neither model’s firmware explicitly reports a double-click event (not now, not ever). I created an automation to interpret two consecutive single-click button events as a double-click button event. It’s the same technique used by all blueprints that add “double-click” functionality to a device that doesn’t natively report it.

1 Like

Thanks for explaining Taras! :bowing_man:

I was trying to find out how these BP are doing it but with no luck and since it becomes clear to me how this was achieved I wondered how to do this in an automation so your response comes at the right time!

Would you mind sharing that part of the automation how you interpret a double/triple click?

See examples in this post.

Thank you!! My switches are working again !!

What am I missing here, I have Home Assistant ‘Enabled’ and ‘Home Assistant experimental event entities’ checked in the zigbee2mqtt setting, I’ve given zigbee2mqtt a restart, but I still can’t see these event. entities. All I can see under the MQTT integration for the device is battery & power outage count?

What is the device? Post a link to its product page on the Zigbee2MQTT site.

Thanks, it seems to have resolved after updating hass to the latest versions, i see the actions now.

What was your previous version of Home Assistant?

I believe Z2M V2 requires a minimum of 2024.9.0.