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.
-
Turn experimental on in Z2MQTT
-
Rename the new event entity to what I want.
-
Go into NR and points the Events state node to the new event entity
-
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.
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.
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.
Thanks guys for responding!
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.
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.
Thanks for explaining Taras!
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.
Hi,
I have a Hue Dimmer switch v1 and want to it use with the new events instead of the old actions. I have to say, that I am new to Zigbee2MQTT. But I found your (@KennethLavrsen) automations and here I am.
I have the options 1, 2, 6 and 7 of your automation working. But option 3, 4 and 5 are not working and I do not understand why.
I hope that someone here can help me.
Here is my automation:
alias: Büro Dimmer - Event test
triggers:
- trigger: state
entity_id: event.buro_dimmer_action
not_from: unavailable
actions:
- choose:
- conditions:
- "{{trigger.to_state.attributes.button == 'on'}}"
- "{{trigger.to_state.attributes.event_type == 'press'}}"
sequence:
- data:
brightness_pct: 90
action: light.turn_on
target:
entity_id: light.spots_vorn_buro
- conditions:
- condition: template
value_template: "{{trigger.to_state.attributes.button == 'on'}}"
- condition: template
value_template: "{{trigger.to_state.attributes.event_type == 'hold'}}"
sequence:
- data:
brightness_pct: 90
action: light.turn_on
target:
entity_id:
- light.spots_vorn_buro
- light.spots_hinten_buro
- light.tischleuchten_buro
- conditions:
- condition: template
value_template: "{{trigger.to_state.attributes.button == 'up'}}"
- condition: template
value_template: "{{trigger.to_state.attributes.event_type == 'hold'}}"
sequence:
- action: mqtt.publish
metadata: {}
data:
topic: zigbee2mqtt/Büro Dimmer/set
payload: "{\"brightness_move\": 50 }"
- conditions:
- condition: template
value_template: "{{trigger.to_state.attributes.button == 'down'}}"
- condition: template
value_template: "{{trigger.to_state.attributes.event_type == 'hold'}}"
sequence:
- action: mqtt.publish
metadata: {}
data:
topic: zigbee2mqtt/Büro Dimmer/set
payload: "{\"brightness_move\": -50 }"
- conditions:
- condition: template
value_template: "{{trigger.to_state.attributes.button in ('up', 'down')}}"
- condition: template
value_template: "{{trigger.to_state.attributes.event_type == 'hold_release'}}"
sequence:
- action: mqtt.publish
metadata: {}
data:
topic: zigbee2mqtt/Büro Dimmer/set
payload: "{\"brightness_move\": 0 }"
- conditions:
- condition: template
value_template: "{{trigger.to_state.attributes.button == 'off'}}"
- condition: template
value_template: "{{trigger.to_state.attributes.event_type == 'press'}}"
sequence:
- data: {}
action: light.turn_off
target:
entity_id: light.spots_vorn_buro
- conditions:
- condition: template
value_template: "{{trigger.to_state.attributes.button == 'off'}}"
- condition: template
value_template: "{{trigger.to_state.attributes.event_type == 'hold'}}"
sequence:
- data: {}
action: light.turn_off
target:
entity_id:
- light.spots_vorn_buro
- light.spots_hinten_buro
- light.tischleuchten_buro
initial_state: "on"
mode: queued
max_exceeded: silent
This is what I see in the logs for all four buttons (press and hold).
info 2025-02-08 23:37:38z2m:mqtt: MQTT publish: topic 'zigbee2mqtt/Büro Dimmer', payload '{"action":"on_press","action_duration":null,"battery":37,"linkquality":174,"update":{"installed_version":1124102917,"latest_version":1124102917,"state":"idle"}}'
info 2025-02-08 23:37:38z2m:mqtt: MQTT publish: topic 'zigbee2mqtt/Büro Dimmer/action', payload 'on_press'
info 2025-02-08 23:37:38z2m:mqtt: MQTT publish: topic 'zigbee2mqtt/Büro Dimmer', payload '{"action":"on_press_release","action_duration":null,"battery":37,"linkquality":174,"update":{"installed_version":1124102917,"latest_version":1124102917,"state":"idle"}}'
info 2025-02-08 23:37:38z2m:mqtt: MQTT publish: topic 'zigbee2mqtt/Büro Dimmer/action', payload 'on_press_release'
info 2025-02-08 23:37:42z2m:mqtt: MQTT publish: topic 'zigbee2mqtt/Büro Dimmer', payload '{"action":"on_press","action_duration":null,"battery":37,"linkquality":171,"update":{"installed_version":1124102917,"latest_version":1124102917,"state":"idle"}}'
info 2025-02-08 23:37:42z2m:mqtt: MQTT publish: topic 'zigbee2mqtt/Büro Dimmer/action', payload 'on_press'
info 2025-02-08 23:37:42z2m:mqtt: MQTT publish: topic 'zigbee2mqtt/Büro Dimmer', payload '{"action":"on_hold","action_duration":0.791,"battery":37,"linkquality":174,"update":{"installed_version":1124102917,"latest_version":1124102917,"state":"idle"}}'
info 2025-02-08 23:37:42z2m:mqtt: MQTT publish: topic 'zigbee2mqtt/Büro Dimmer/action', payload 'on_hold'
info 2025-02-08 23:37:43z2m:mqtt: MQTT publish: topic 'zigbee2mqtt/Büro Dimmer', payload '{"action":"on_hold_release","action_duration":null,"battery":37,"linkquality":174,"update":{"installed_version":1124102917,"latest_version":1124102917,"state":"idle"}}'
info 2025-02-08 23:37:43z2m:mqtt: MQTT publish: topic 'zigbee2mqtt/Büro Dimmer/action', payload 'on_hold_release'
info 2025-02-08 23:37:49z2m:mqtt: MQTT publish: topic 'zigbee2mqtt/Büro Dimmer', payload '{"action":"off_press","action_duration":null,"battery":37,"linkquality":160,"update":{"installed_version":1124102917,"latest_version":1124102917,"state":"idle"}}'
info 2025-02-08 23:37:49z2m:mqtt: MQTT publish: topic 'zigbee2mqtt/Büro Dimmer/action', payload 'off_press'
info 2025-02-08 23:37:49z2m:mqtt: MQTT publish: topic 'zigbee2mqtt/Büro Dimmer', payload '{"action":"off_press_release","action_duration":null,"battery":37,"linkquality":163,"update":{"installed_version":1124102917,"latest_version":1124102917,"state":"idle"}}'
info 2025-02-08 23:37:49z2m:mqtt: MQTT publish: topic 'zigbee2mqtt/Büro Dimmer/action', payload 'off_press_release'
info 2025-02-08 23:37:51z2m:mqtt: MQTT publish: topic 'zigbee2mqtt/Büro Dimmer', payload '{"action":"off_press","action_duration":null,"battery":37,"linkquality":160,"update":{"installed_version":1124102917,"latest_version":1124102917,"state":"idle"}}'
info 2025-02-08 23:37:51z2m:mqtt: MQTT publish: topic 'zigbee2mqtt/Büro Dimmer/action', payload 'off_press'
info 2025-02-08 23:37:52z2m:mqtt: MQTT publish: topic 'zigbee2mqtt/Büro Dimmer', payload '{"action":"off_hold","action_duration":0.787,"battery":37,"linkquality":163,"update":{"installed_version":1124102917,"latest_version":1124102917,"state":"idle"}}'
info 2025-02-08 23:37:52z2m:mqtt: MQTT publish: topic 'zigbee2mqtt/Büro Dimmer/action', payload 'off_hold'
info 2025-02-08 23:37:52z2m:mqtt: MQTT publish: topic 'zigbee2mqtt/Büro Dimmer', payload '{"action":"off_hold_release","action_duration":null,"battery":37,"linkquality":163,"update":{"installed_version":1124102917,"latest_version":1124102917,"state":"idle"}}'
info 2025-02-08 23:37:52z2m:mqtt: MQTT publish: topic 'zigbee2mqtt/Büro Dimmer/action', payload 'off_hold_release'
info 2025-02-08 23:38:01z2m:mqtt: MQTT publish: topic 'zigbee2mqtt/Büro Dimmer', payload '{"action":"up_press","action_duration":null,"battery":37,"linkquality":174,"update":{"installed_version":1124102917,"latest_version":1124102917,"state":"idle"}}'
info 2025-02-08 23:38:01z2m:mqtt: MQTT publish: topic 'zigbee2mqtt/Büro Dimmer/action', payload 'up_press'
info 2025-02-08 23:38:01z2m:mqtt: MQTT publish: topic 'zigbee2mqtt/Büro Dimmer', payload '{"action":"up_press_release","action_duration":null,"battery":37,"linkquality":174,"update":{"installed_version":1124102917,"latest_version":1124102917,"state":"idle"}}'
info 2025-02-08 23:38:01z2m:mqtt: MQTT publish: topic 'zigbee2mqtt/Büro Dimmer/action', payload 'up_press_release'
info 2025-02-08 23:38:04z2m:mqtt: MQTT publish: topic 'zigbee2mqtt/Büro Dimmer', payload '{"action":"up_press","action_duration":null,"battery":37,"linkquality":174,"update":{"installed_version":1124102917,"latest_version":1124102917,"state":"idle"}}'
info 2025-02-08 23:38:04z2m:mqtt: MQTT publish: topic 'zigbee2mqtt/Büro Dimmer/action', payload 'up_press'
info 2025-02-08 23:38:05z2m:mqtt: MQTT publish: topic 'zigbee2mqtt/Büro Dimmer', payload '{"action":"up_hold","action_duration":0.799,"battery":37,"linkquality":174,"update":{"installed_version":1124102917,"latest_version":1124102917,"state":"idle"}}'
info 2025-02-08 23:38:05z2m:mqtt: MQTT publish: topic 'zigbee2mqtt/Büro Dimmer/action', payload 'up_hold'
error 2025-02-08 23:38:05z2m: No converter available for 'brightness_move' (50)
info 2025-02-08 23:38:05z2m:mqtt: MQTT publish: topic 'zigbee2mqtt/Büro Dimmer', payload '{"action":"up_hold_release","action_duration":null,"battery":37,"linkquality":174,"update":{"installed_version":1124102917,"latest_version":1124102917,"state":"idle"}}'
info 2025-02-08 23:38:05z2m:mqtt: MQTT publish: topic 'zigbee2mqtt/Büro Dimmer/action', payload 'up_hold_release'
error 2025-02-08 23:38:05z2m: No converter available for 'brightness_move' (0)
info 2025-02-08 23:38:10z2m:mqtt: MQTT publish: topic 'zigbee2mqtt/Büro Dimmer', payload '{"action":"down_press","action_duration":null,"battery":37,"linkquality":182,"update":{"installed_version":1124102917,"latest_version":1124102917,"state":"idle"}}'
info 2025-02-08 23:38:10z2m:mqtt: MQTT publish: topic 'zigbee2mqtt/Büro Dimmer/action', payload 'down_press'
info 2025-02-08 23:38:10z2m:mqtt: MQTT publish: topic 'zigbee2mqtt/Büro Dimmer', payload '{"action":"down_press_release","action_duration":null,"battery":37,"linkquality":178,"update":{"installed_version":1124102917,"latest_version":1124102917,"state":"idle"}}'
info 2025-02-08 23:38:10z2m:mqtt: MQTT publish: topic 'zigbee2mqtt/Büro Dimmer/action', payload 'down_press_release'
info 2025-02-08 23:38:12z2m:mqtt: MQTT publish: topic 'zigbee2mqtt/Büro Dimmer', payload '{"action":"down_press","action_duration":null,"battery":37,"linkquality":178,"update":{"installed_version":1124102917,"latest_version":1124102917,"state":"idle"}}'
info 2025-02-08 23:38:12z2m:mqtt: MQTT publish: topic 'zigbee2mqtt/Büro Dimmer/action', payload 'down_press'
info 2025-02-08 23:38:13z2m:mqtt: MQTT publish: topic 'zigbee2mqtt/Büro Dimmer', payload '{"action":"down_hold","action_duration":0.797,"battery":37,"linkquality":178,"update":{"installed_version":1124102917,"latest_version":1124102917,"state":"idle"}}'
info 2025-02-08 23:38:13z2m:mqtt: MQTT publish: topic 'zigbee2mqtt/Büro Dimmer/action', payload 'down_hold'
error 2025-02-08 23:38:13z2m: No converter available for 'brightness_move' (-50)
info 2025-02-08 23:38:13z2m:mqtt: MQTT publish: topic 'zigbee2mqtt/Büro Dimmer', payload '{"action":"down_hold_release","action_duration":null,"battery":37,"linkquality":174,"update":{"installed_version":1124102917,"latest_version":1124102917,"state":"idle"}}'
info 2025-02-08 23:38:13z2m:mqtt: MQTT publish: topic 'zigbee2mqtt/Büro Dimmer/action', payload 'down_hold_release'
error 2025-02-08 23:38:13z2m: No converter available for 'brightness_move' (0)
What do the errors want to tell me?
z2m: No converter available for 'brightness_move'
Thank you Hoppel