With ZHA is there an easy way to use an easily readable name like switch.ikea_switch_1?

The automated automations tool created the following working config. Basically, it turns on a light however the name 8eff7b21041f948f0a43a3d610405ed6 is not very user friendly, is there an easy way to use an easily readable name like switch.ikea_switch_1

- alias: switch1_short_press_on
  mode: single
  trigger:
    - device_id: 8eff7b21041f948f0a43a3d610405ed6 #a readable name here
      domain: zha
      platform: device
      type: remote_button_short_press
      subtype: turn_on
  action:
    - data:
        brightness_step_pct: 12.5
      entity_id: light.bedside_light
      service: light.turn_on

I know it is bad practice to use the automation tool. What I need is the correct code to interpret a ZHA button press where its human readable.

the old way was

  trigger:
    - platform: state
      entity_id: switch.button1_click
      to: 'single'

but I cannot get this to work because ZHA has no switch.ikeaswitch1 state.

That is not bad practice, device automations are.

Bit pointless your comments, they have not helped with my problem in the slightest.

It feels like you are saying “You are doing it wrong and I am not going to tell you how to do it correctly”.

The whole reason I am here is because I already know it was wrong, I just need to know the correct entity_id to use how does one find it?

zha has not incorporated event entities yet. So your only “easy” option is to use device triggers. Otherwise, you’d have to use normal HA events.

and if you’re confused about my response. You cannot alias device_id’s. And normal events allow you to use friendly names (to an extent). It depends on the event you’re triggering off of.

Thanks for the answer, I thought as much but was thinking maybe I’d missed a trick.

can I do

- device_id: 8eff7b21041f948f0a43a3d610405ed6 #switch.ikeaswitch1

You cannot use in-line comments with yaml. So no, that’s not possible. Comments can go before or after (100% YAML only, no UI including UI yaml). Or you can alias the device trigger.

I know nothing about ZHA - would you mind adding a few lines about this to the device trigger wiki? :grinning_face_with_smiling_eyes:

Hi there !
Do you know if ZHA will incorporate event entities ?
It’s difficult to find information on this.

:man_shrugging: No idea

Too bad
I really want this feature, I hope it will come fast to ZHA.

Just use the events described in the documentation. They are pretty easy to set up in the UI.

Yes bring on event entities in zha

Which event are you talking about ? Like “button pressed” or things like that ?

All events that come through Z2M are normal home assistant events or you can trigger off topic changes themselves.

See:

Ok but I’m looking for event entities to create automation with “multiple triggers”

Trigger :
Remote1 trigger “something” (could be really any button)
Action :
If “something” is button 1 pressed then do
Elseif “something” is button 2 pressed then do
Elseif “something” is button 3 pressed then

I know that Blueprints can handle it, but it’s only in theory as most of the blueprints I’m using are not working at 100% (like double press not doing anything, are the action not working and needs to be done once again, etc.).

That doesn’t change anything that i’ve said…

I agree ZHA needs a more friendly way to handle button like events.

Device triggers in their current form are evil IMO.