The intent is to raise an event, based on a button press of a remote control. Instead of having to create one automation for each button, I would like to create one automation that can trigger from all of the buttons, then indicate in the event, which button was pressed. However, I have no clue how to specify what event triggered the automation. Ultimately, the āactionā in the example above would probably look something like:
action: {{ triggered.event.action }}
or something like that.
Does anyone know how I can get around this? Thanks.
BTW, the way I currently get around this is to create a MQTT sensor, then when the event is raised, I read the sensor to see which button was pressed. Not very pretty, therefore, Iād like to optimize it.
@tom_l - Thanks for the tip Tom. Have a follow up question for you. In your example, you use an entity:
entity_id: event.dining_button_action
Iām also in the process of transitioning from using the Z2M legacy action to the new āmethodā, but unaware of such āeventā entity. Although I still have the legacy option set in my config file. Is that something that will become available once I get rid of the legacy option in the config file?
What version of HA are you using? Settings ā About.
You can see the entities that Z2M has created in Settings ā Integrations ā MQTT ā Entities. Does that help? If things are up-to-date, you should be seeing event.xxx entities.
If you are not ready to move from the legacy system just yet due to other automations then you should be able to accomplish a similar thing with the action.⦠entity and a state trigger.
Iām going to make the switch. Donāt want to be surprised when the developers decide to deprecate the legacy function. Just need to make a good backup before I do it. Thanks for your help.
For anyone who may stumble into this thread: In order to see the event.xxx entities from Zigbee2MQTT, the option āHome Assistant experimental event entitiesā must be enabled as seen in the screenshot below - at least as of this version: