Button pressed

Use this trigger when you want an automation to run every time a button entity is pressed. This is useful when a button starts a task on a device and you also want Home Assistant to take a follow-up action.

Labs

Requires the Purpose-specific triggers and conditions Labs preview feature. Enable it at Settings > System > Labs.

Using this trigger from the user interface

If you prefer building automations visually, Home Assistant walks you through this trigger step by step. You pick what to watch, tweak a few options, and save. No YAML knowledge required.

To use this trigger in an automation:

  1. Go to Settings > Automations & scenes.
  2. Open an existing automation, or select Create automation > Create new automation.
  3. In the When section, select Add trigger.
  4. Select what you want to monitor. Under By target (see Targets), select the area, floor, device, label, or entity you want to monitor.
  5. From the triggers shown for that target, select Button pressed.
  6. Select Save.

Options in the UI

This trigger has no additional options beyond the target.

Using this trigger in YAML

If you work directly in YAML, or you want to know exactly what Home Assistant does under the hood, this section has the technical reference. It lists the field names you use in YAML, their types, and which ones are required.

In YAML, refer to this trigger as button.pressed. A basic example looks like this:

TriggerA trigger is a set of values or conditions of a platform that are defined to cause an automation to run. [Learn more]
trigger: button.pressed
target:
  entity_id: button.air_purifier_reset_filter

This fires every time button.air_purifier_reset_filter is pressed.

Options in YAML

This trigger has no additional YAML options beyond the target.

Targets of the trigger

This trigger requires a target. The target is the object that Home Assistant will watch. You can select a single entityAn entity represents a sensor, actor, or function in Home Assistant. Entities are used to monitor physical properties or to control other entities. An entity is usually part of a device or a service. [Learn more], a device, an area, a floor, or a label as a target, and Home Assistant will watch every matching button entity behind that target.

  • Entity: one specific button entity, such as button.living_room.
  • Device: every button entity that belongs to a device.
  • Area: every button entity in a room or area.
  • Floor: every button entity on a floor.
  • Label: every button entity that shares a label.

You can also select different target types in one trigger. For example, you can add a specific entity and an area as targets in the same trigger to monitor both of them at once.

Good to know

  • This trigger fires when Home Assistant detects a button press from the button entity.
  • Changes to unavailable or unknown do not count as button presses.
  • If you only need to press a button from an automation, use the related Press button action instead.

Try it yourself

Ready to test this? Go to Settings > Automations & scenes, create a new automation, and add this trigger. Save the automation, then change the state of the targeted entity to watch the trigger fire on your actual entitiesAn entity represents a sensor, actor, or function in Home Assistant. Entities are used to monitor physical properties or to control other entities. An entity is usually part of a device or a service. [Learn more].

More examples

Real scenarios where this trigger fires in automations and scripts. Copy any example and adapt it to your setup.

Tip

You don’t need to edit YAML to use these examples. Copy a YAML snippet from this page, open the automation editor in Home Assistant, and press Ctrl+V (or Cmd+V on Mac). Home Assistant automatically converts the pasted YAML into the visual editor format, whether it’s a full automation, a single trigger, a condition, or an action.

Automation: send a notification when a filter reset button is pressed

Use this automation to keep a record of when a maintenance button was pressed.

  • Trigger: Button pressed
    • Target: Air purifier filter reset button
  • Action: Send a notification message
    • Target: My Device (notify.my_device)
YAML example for a filter reset button notification
AutomationAutomations in Home Assistant allow you to automatically respond to things that happen in and around your home. [Learn more]
- alias: "Notify when the filter reset button is pressed"
  triggers:
    - trigger: button.pressed
      target:
        entity_id: button.air_purifier_reset_filter
  actions:
    - action: notify.send_message
      target:
        entity_id: notify.my_device
      data:
        message: "The air purifier filter reset button was pressed."

Automation: turn on a light when an identify button is pressed

Use this automation when a button helps you locate a device and you want a nearby light to turn on at the same time.

  • Trigger: Button pressed
    • Target: Front door camera identify button
  • Action: Light: Turn on
YAML example for turning on a light from an identify button
AutomationAutomations in Home Assistant allow you to automatically respond to things that happen in and around your home. [Learn more]
- alias: "Turn on the porch light when the camera identify button is pressed"
  triggers:
    - trigger: button.pressed
      target:
        entity_id: button.front_door_camera_identify
  actions:
    - action: light.turn_on
      target:
        entity_id: light.porch

Still stuck?

The Home Assistant community is quick to help: join Discord for real-time chat, post on the community forum with the trigger you’re using and what you expected to happen, or share on our subreddit /r/homeassistant.

Tip

AI assistants like ChatGPT or Claude can also explain triggers or suggest the right one when you describe what you want in plain language.