How do I use this button in an automation?

I genuinely do not understand how the UI is supposed to work.

I’ve got this button and the logbook shows it fires an “on event” and “off event”

But then I go to “Automations” and look for triggers, and can for the life of me not find anything like this.

Under “Device” the button press is not exposed at all:

The other triggers seem… not applicable? Under “Entity” I get a choose of “State” and “Numeric State” but neither of them offer anything when searching for “Livarno”.

I am so confused. What am I missing / supposed to see on the ZHA device page, to let me create an automation for this button?

And more concretely to let me solve this problem; how do I make a trigger for the button on and button off?

If the device trigger is not giving you button events then you will have to use an event trigger. See: https://www.home-assistant.io/docs/automation/trigger/#event-trigger

1 Like

Go into developer tools - states

Find the button in the list and toggle it to see what states it gives you, this should give you a clue if not post what it says in states and someone will point you in the right direction

Ignore the states for now. Follow @tom_l’s suggestion and use an event for your automations.

If you’re lucky, you might find someone has already created a blueprint for your exact device model.
If not, it should be pretty easy to modify the closest blueprint you can find via the UI if you’re on the latest version of HA, and adapt it to fit your model.

Got it working. Here’s what I did, for my own future reference:

  1. Go to Developer tool → Event → “Listen to events” → enter zha_event and press “Start listening

  2. Press the button to see what event pops up.

  3. Copy the device_ieee and command values.

  4. Create a new automation and add a “Manual event” as your trigger, enter zha_event, and under Event data, enter the device_ieee and command:

      device_ieee: 2c:11:65:ff:fe:57:dd:6d
      command: "off"

Now the automation should react to the button press. Here’s the full yaml for one of my Livarno buttons:

alias: Turn off media center
description: ""
trigger:
  - platform: event
    event_type: zha_event
    event_data:
      device_ieee: 2c:11:65:ff:fe:57:dd:6d
      command: "off"
condition: []
action:
  - type: turn_off
    device_id: 2a68672f0cdc556b05a40787e614afb5
    entity_id: switch.lumi_lumi_plug_maeu01_switch_2
    domain: switch
mode: single

There is just no way that this is supposed to be the intended way of hooking up a trivial button-press automation, but… here we are. Disoverability in the UI is not great.