How do I narrow down the type of a device to only buttons?

I’m creating a device field in Home Assistant, and I want to narrow this list down to only buttons.

In my script, I tried to create a field which took in buttons:

buttons:
  selector:
    device:
      multiple: true
      entity:
        domain: button
  name: Buttons
  required: false
  description: Buttons used to control lights.

But it shows things like light bulbs (which have no buttons) in addition to my ZHA buttons.

Is there a device_class or domain for devices that can fire events?

The Device selector selects whole devices. When you supply an entity domain criteria as you have shown, the list is reduced from all devices to only devices that have at least one entity in that domain. If you want to limit selection to only button entities, use an Entity selector. Be aware that integrations are not limited to using button entities for physical button they are commonly used as a means to get user input to the device for things like rebooting, resetting, or triggering an “identify” routine.

Devices don’t have device_class or domain… those are properties of entities. All entities post events to the Event bus.

1 Like