Button hold ended

Use this trigger when you want an automation to run when you release a button after holding it down. It works with event entities that have the button device class, such as the buttons of a remote control or a wall switch, if the button reports both the start and the end of a hold.

This is useful together with the Button held trigger: start something when you hold a button, and stop it when you release the button. For example, you can make the blinds move only while you hold a button on your remote control.

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 button event entity you want to monitor. You can also select an area, a floor, a device, or a label.
  5. From the triggers shown for that target, select Button hold ended.
  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. For how an automation is built in YAML, refer to Automations in YAML.

In YAML, put the settings that are specific to this trigger under options. Keep target, if the trigger uses one, and general settings such as id, alias, enabled, and variables at the top level, next to trigger.

When this trigger starts an automation, it passes data about what happened to the automation. You can use this trigger data in the templates of your conditions and actions. To see which data is available, refer to Trigger data in templates.

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

TriggerA trigger is the part of an automation that makes the automation start when something specific happens, for example, when the sun sets, a door opens, or a button is pressed. [Learn more]
trigger: button.hold_ended
target:
  entity_id: event.bedroom_switch_button

This fires every time the button of event.bedroom_switch_button is released after a hold.

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 event entity behind that target.

  • Entity: one specific button event entity, such as event.living_room_remote_open_button.
  • Device: every button event entity that belongs to a device.
  • Area: every button event entity in a room or area.
  • Floor: every button event entity on a floor.
  • Label: every button event 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.

To learn which entities Home Assistant includes for a device, area, floor, or label, and how it handles several entities, refer to Automation targets.

To leave out some of these entities, refer to Excluding targets. For example, you can leave out one button event entity in an area.

Trigger variables

When the trigger reacts, the trigger variable contains the following data:

  • trigger.entity_id: Entity ID of the button event entity that is released.
  • trigger.from_state: State object of the entity before the release was reported.
  • trigger.to_state: State object of the entity when the release was reported.
  • trigger.for: Always None, because this trigger has no duration option. It doesn’t tell you how long the button was held.
  • trigger.description: state of followed by the entity ID, such as state of event.living_room_remote_open_button.

For example, use {{ trigger.to_state.name }} in an action to include the name of the released button in a notification.

For the data that all triggers include, refer to Trigger data in templates.

Good to know

  • This trigger works with event entities with the button device class (domain event). Event entities with another device class are skipped, even if you select them directly. Button entities and button helpers can’t report a hold, so they don’t work with this trigger.
  • This trigger reacts to the Long press end (long_press_end) event type, which the button reports when you release it after a hold.
  • This trigger only works with button event entities that support both Long press start and Long press end. A button that only supports Long press end reports a hold only when you release it, and the Button held trigger already reacts to that. This way, the two triggers never fire for the same event. To see which event types a button supports, add an Event received trigger for it, and open the Event type list.
  • You can still select a button event entity that is missing Long press start, Long press end, or both, but it never starts the automation. Each event it receives records a Did not trigger trace instead. For details, refer to Testing automations.
  • Changes to Unavailable or Unknown don’t count as releases. The first release after Home Assistant starts also counts, even if the entity showed Unknown before. If the entity comes back from Unavailable, that recovery doesn’t count as a release.
  • To react to the start of a hold, use the Button held trigger. If you set an interval on Button held, its repeats stop when you release the button. To react to a press of the same button, use the Button pressed trigger. To react to other event types, such as Multi-press, use the Event received trigger instead.

Try it yourself

Ready to test this? Go to Settings > Automations & scenes, create a new automation, and add this trigger. Save the automation, and then make the trigger react. For example, change the state of the targeted 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], turn on a light that the trigger monitors, or change its brightness. To check whether the automation ran, open its traces.

More examples

Real scenarios where this trigger fires in automations and scripts. Copy any example and adapt it to your setup. In the visual editor, select the UI options listed in the example when they are available, or paste the YAML code.

Tip

You don’t need to edit YAML to use these examples. Copy a YAML snippet from this page, open the visual 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: stop the blinds when you release a remote button

Use this automation to stop the blinds when you release a button on your remote control. Together with an automation that opens the blinds with the Button held trigger, the blinds only move while you hold the button.

  • Trigger: Button hold ended
    • Target: Living room remote open button
  • Action: Stop cover
    • Target: Living room blinds
YAML example for stopping the blinds when a button is released
AutomationAutomations in Home Assistant allow you to automatically respond to things that happen in and around your home. [Learn more]
alias: "Stop the living room blinds when the remote button is released"
triggers:
  - trigger: button.hold_ended
    target:
      entity_id: event.living_room_remote_open_button
actions:
  - action: cover.stop_cover
    target:
      entity_id: cover.living_room_blinds

Automation: close a garden water valve when you release a button

Use this automation to let water run from the garden hose only while you hold a button, like when you fill a watering can. Together with an automation that opens the valve with the Button held trigger, the water stops as soon as you release the button. To make sure the water also stops if Home Assistant doesn’t receive the release, for example because the battery of the button runs out, add another automation that closes the valve after it has been open for a few minutes.

  • Trigger: Button hold ended
    • Target: Garden switch button
  • Action: Close valve
    • Target: Garden hose valve
YAML example for closing a water valve when a button is released
AutomationAutomations in Home Assistant allow you to automatically respond to things that happen in and around your home. [Learn more]
alias: "Close the garden hose valve when the button is released"
triggers:
  - trigger: button.hold_ended
    target:
      entity_id: event.garden_switch_button
actions:
  - action: valve.close_valve
    target:
      entity_id: valve.garden_hose

Still stuck?

To find out why the trigger didn’t react, make the change that it should react to, and then open the traces of the automation. If the automation didn’t run, there’s usually no trace, but some triggers record a Did not trigger trace. For details, refer to Testing automations. For common problems and their solutions, refer to Troubleshooting automations.

If that doesn’t help, 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.

Related triggers

Explore related triggers:

  • Button held: Triggers when one or more buttons are held, optionally repeating at a set interval for as long as they stay held.

  • Button pressed: Triggers when one or more buttons are pressed.

  • Event received: Triggers when one or more event entities receive a matching event type.