Possible to add button profiles?

Howdy! I’m looking for a way to improve my creation of Automations in Home Assistant by adding button profiles.

Button Profiles (or Groups)

What I want is the ability to add a device as a trigger in an automation and simply assign it to a button profile that includes all button mappings and trigger IDs I’d typically use to manage my lights. That way, all devices with that profile get updated at the same time.

I mean, you can create Scripts to make a reusable set of actions, so why not buttons too? Maybe a way to make a “button group” so each function of the buttons are grouped somewhere in one spot.

My Goal

I’m trying to reduce the load on me to add a single device. I typically buy in bulk, and it takes hours to fix, and I’m likely to get something wrong. The fewer steps I have to do, especially one that require a keyboard and mouse, the more likely I am to do it right the first time.

It’s also a lot of work doing this manually.

What do you mean when you say “button”?

  • A physical device
  • A Dashboard button
  • A button or input_button entity

A physical device like this:

¯\(ツ)/¯ Sounds like you are looking for…

1 Like

I think you’re going to have to look into labels (and/or groups) and performing actions on label targets

1 Like

Centralized routing of all button presses

Using a single automation.

If ZHA:

If Z2M:

Sadly, that won’t work either. It’s not the targets I want to group but the triggers. I can group targets all the time really easily.

I was watching the zha_event the other day and looking at how I might handle this:

For IKEA buttons, it’s insane. There’s endpoint_id and cluster_id and other things related to args that are all wonky for their more complex buttons.

Inovelli wall switches were a lot easier:

event_type: zha_event
data:
  command: button_2_double

If this really is the way, I guess I’ll have to do it. Not excited about it considering how hacky it is to set up, but I guess that’s all I can do.

I was thinking of having something like this too (from that post):

  switch_map:
    8c:65:a3:ff:fe:c7:bf:71: bedroom_desk
    a4:c1:38:ef:72:f4:18:11: bedroom_entry
    8c:65:a3:ff:fe:b0:f6:ec: living_entry
    94:b2:16:ff:fe:50:53:4d: kitchen_entry
    a4:c1:38:6a:fe:dd:d9:c9: dining_desk

And something else to specify key-value pairs for which room gets affected by which messages.

Thanks for the link! I hope this finally solves that problem. Hopefully there will a less-jank solution in the future that uses the GUI and not YAML.

Please post these events. Secondly, the new triggers and conditions that are getting rolled out can use labels.

1 Like

But ZHA doesn’t currently provide event entities for button devices, so there’s nowhere to apply the Labels in a way that the new triggers can be leveraged.

2 Likes

Can you provide an example of a zigbee event like he’s describing here?

At this rate it’s going to be 10 days before any examples can be provided.

I don’t have any of the IKEA multi button devices. But, I think the picture he posted the other day was of the Rodret which, based on @censay’s blueprint, means the trigger options should be:

  - trigger: event
    event_type: zha_event
    event_data: 
      command: 'on'
      cluster_id: 6
      endpoint_id: 1
    id: tap-on

  - trigger: event
    event_type: zha_event
    event_data: 
      command: 'off'
      cluster_id: 6
      endpoint_id: 1
    id: tap-off

  - trigger: event
    event_type: zha_event
    event_data: 
      command: move_with_on_off
      cluster_id: 8
      endpoint_id: 1
    id: hold-on

  - trigger: event
    event_type: zha_event
    event_data: 
      command: move
      cluster_id: 8
      endpoint_id: 1
    id: hold-off

The events for the two Sonoff single button devices I have are as follows:

event_type: zha_event
data:
  device_ieee: 00:32:4c:00:25:41:76:d3
  device_id: 7a001b5e1a39298b73b5b99ccd6f3f25
  unique_id: 00:12:4b:00:22:41:96:d3:1:0x0006
  endpoint_id: 1
  cluster_id: 6
  command: "off"
  args: []
  params: {}
origin: LOCAL
time_fired: "2026-04-16T12:44:20.480120+00:00"
context:
  id: 01KPB54AM00F1JVPQ8MFM25VA1
  parent_id: null
  user_id: null

I would assume the IKEA device’s event also include their device_id, so he could attach the Label to the device then use {{ trigger.event.data.device_id in label_devices('profile_1_buttons')}} as a condition… or just have a trigger for each device ID.

1 Like

If that’s the case, then he can simply use 1 trigger and a template.

triggers:
  - trigger: event
    event_type: zha_event
    event_data:
      device_id: 7a001b5e1a39298b73b5b99ccd6f3f25
variables:
  config_target: "{{ trigger.event.data.command }}-{{ trigger.event.data.cluster_id }}-{{ trigger.event.data.endpoint_id }}"
actions:
- choose:
  - condition: "{{ config_target == 'on-6-1' }}"
    sequence:
    ...

Or if it’s just turning on/off single items, make a config.

triggers:
  - trigger: event
    event_type: zha_event
    event_data:
      device_id: 7a001b5e1a39298b73b5b99ccd6f3f25
variables:
  config:
    on-6-1:
      action: switch.turn_on
      entity_id:
      - switch.a
    off-6-1:
      action: switch.turn_off
      entity_id:
      - switch.a
    move_with_on_off-8-1:
      action: light.turn_on
      entity_id:
      - light.a
      - light.b
      data:
        brightness_pct: 100
    move-8-1:
      action: light.turn_off
      entity_id:
      - light.a
      - light.b
  config_target: "{{ trigger.event.data.command }}-{{ trigger.event.data.cluster_id }}-{{ trigger.event.data.endpoint_id }}"
  item: "{{ config.get(config_target) }}"
conditions:
- condition: template
  value_template: "{{ item is not None }}"
actions:
- action: "{{ item.action }}"
  target:
    entity_id: "{{ item.entity_id }}"
  data: "{{ item.get('data', {}) }}"

@Sawtaytoes the point is, if you lean into templates, you can condense 100 single use automations, into 1 automation if you use templates. This example was just for zha button events.

What’s label_devices do? Is this like creating the button profile?

You were similar. I have RODRET buttons, but that one posted was from a SYMPHONIK media button.

I haven’t had a chance to look into this, so you’re correct, my respones are slow :laughing:.

This looks great! I’ll take a look when I next touch this. The fewer triggers, the better! I like this variables for the whole button. I can then have a single trigger for each button rather than each press type in zha_event. Great!

Is device_id the device itself or the unique ID for that device? Or is that unique_id? I was thinking of using the IEEE ID, but I’d rather whatever picks the make and model correctly from Home Assistant, so all my RODRET buttons are the same.

I wouldn’t be calling actions from there, I’d be assigning strings to actions and the room certain devices belong to. Then I can do an event listener in those room-specific automations to remove all button triggers and replace them with a single event listener.

1 Like

It’s not a unique_id, I have no idea what this is. I don’t use ZHA, that’s why I need your examples to show an actual working version. @Didgeridrew provided something that I could work with.

My assumption is that device_id is an id that ZHA passes around with it’s events. So in the case above, that single trigger is limited to only that device’s events.

Yeah, I’m looking to do this for a category of devices, not that one particular device.

I have many of the same buttons, so that’s why I’m looking for that solution, something that is an ID or model or something to reduce the number of IDs I need to find an add.

If all I have to add is one trigger per make 'n model, that’s good. If I have add each device individually, it’s about as bad as what I have now.

then remove that declaration and have it work for a category of devices.

triggers:
  - trigger: event
    event_type: zha_event
variables:
  config:
    on-6-1:
      action: switch.turn_on
      entity_id:
      - switch.a
    off-6-1:
      action: switch.turn_off
      entity_id:
      - switch.a
    move_with_on_off-8-1:
      action: light.turn_on
      entity_id:
      - light.a
      - light.b
      data:
        brightness_pct: 100
    move-8-1:
      action: light.turn_off
      entity_id:
      - light.a
      - light.b
  config_target: "{{ trigger.event.data.command }}-{{ trigger.event.data.cluster_id }}-{{ trigger.event.data.endpoint_id }}"
  item: "{{ config.get(config_target) }}"
conditions:
- condition: template
  value_template: "{{ item is not None }}"
actions:
- action: "{{ item.action }}"
  target:
    entity_id: "{{ item.entity_id }}"
  data: "{{ item.get('data', {}) }}"

Again, you haven’t provided any examples, so I’m grasping at straws here trying to show you how to do this.

1 Like