Actions


Some cards have support for tap actions. These actions define what will happen when you tap or hold on an object within a card.

Actions can be enabled on the following cards:

Tap action

Action that will be performed when an object on a card is tapped.

tap_action:
  action: toggle

Configuration Variables

tap_action map (Optional)

Action taken on tap.

action string Required

Action to perform (more-info, toggle, call-service, navigate, url, assist, none)

Default:

toggle (some cards overwrite default to more-info if the provided entity cannot be toggled)

navigation_path string (Optional, default: none)

Path to navigate to (e.g., /lovelace/0/) when the action is defined as navigate

navigation_replace boolean (Optional, default: none)

Whether to replace the current page in the the history with the new URL when the action is defined as navigate

url_path string (Optional, default: none)

Path to navigate to (e.g., https://www.home-assistant.io) when the action is defined as url

service string (Optional, default: none)

Service to call (e.g., media_player.media_play_pause) when the action is defined as call-service

data string (Optional, default: none)

Service data to include (e.g., entity_id: media_player.bedroom) when the action is defined as call-service

confirmation boolean | map (Optional, default: false)

Present a confirmation dialog to confirm the action. See confirmation object below

pipeline_id string (Optional, default: last_used)

Assist pipeline to use when the action is defined as assist. It can be either last_used, preferred, or a pipeline id.

start_listening boolean (Optional, default: none)

If supported, listen for voice commands when opening the assist dialog and the action is defined as assist

Hold action

Action that will be performed when an object on a card is tapped, held for at least half a second and then released. Action will only be triggered once, not continuously during hold.

hold_action:
  action: toggle

Configuration Variables

hold_action map (Optional)

Action taken on tap-and-hold

action string Required, default: more-info

Action to perform (more-info, toggle, call-service, navigate, url, assist, none)

navigation_path string (Optional, default: none)

Path to navigate to (e.g., /lovelace/0/) when the action is defined as navigate

navigation_replace boolean (Optional, default: none)

Whether to replace the current page in the the history with the new URL when the action is defined as navigate

url_path string (Optional, default: none)

Path to navigate to (e.g., https://www.home-assistant.io) when the action is defined as url

service string (Optional, default: none)

Service to call (e.g., media_player.media_play_pause) when the action is defined as call-service

data string (Optional, default: none)

Service data to include (e.g., entity_id: media_player.bedroom) when the action is defined as call-service

confirmation boolean | map (Optional, default: false)

Present a confirmation dialog to confirm the action. See confirmation object below

pipeline_id string (Optional, default: none)

Assist pipeline id to use when the action is defined as assist

start_listening boolean (Optional, default: none)

If supported, listen for voice commands when opening the assist dialog and the action is defined as assist

Double tap action

Action that will be performed when an object on a card is double-tapped.

double_tap_action:
  action: toggle

Configuration Variables

double_tap_action map (Optional)

Action taken on double tap

action string Required, default: more-info

Action to perform (more-info, toggle, call-service, navigate, url, assist, none)

navigation_path string (Optional, default: none)

Path to navigate to (e.g., /lovelace/0/) when the action is defined as navigate

navigation_replace boolean (Optional, default: none)

Whether to replace the current page in the the history with the new URL when the action is defined as navigate

url_path string (Optional, default: none)

Path to navigate to (e.g., https://www.home-assistant.io) when the action is defined as url

service string (Optional, default: none)

Service to call (e.g., media_player.media_play_pause) when the action is defined as call-service

data string (Optional, default: none)

Service data to include (e.g., entity_id: media_player.bedroom) when the action is defined as call-service

confirmation boolean | map (Optional, default: false)

Present a confirmation dialog to confirm the action. See confirmation object below

pipeline_id string (Optional, default: none)

Assist pipeline id to use when the action is defined as assist

start_listening boolean (Optional, default: none)

If supported, listen for voice commands when opening the assist dialog and the action is defined as assist

Options for confirmation

If you define confirmation as an object instead of boolean, you can add more customization and configurations.

double_tap_action:
  action: call-service
  confirmation:
    text: Are you sure you want to restart?
  service: script.restart
hold_action:
  action: call-service
  confirmation: true
  service: script.do_other_thing

Configuration Variables

text string (Optional)

Text to present in the confirmation dialog.

exemptions list (Optional)

List of exemption objects. See below

Options for exemptions

Configuration Variables

user string Required

User ID for which the confirmation dialog will not be shown.

double_tap_action:
  action: call-service
  confirmation:
    text: Are you sure you want to restart?
    exemptions:
      - user: x9405b8c64ee49bb88c42000e0a9dfa8
      - user: 88bcfbdc39155d16c3b2d09cbf8b0367
  service: script.restart

Examples

Tap action implemented on an entity button card:

type: button
tap_action:
  action: toggle
hold_action:
  action: more-info

Limitations

It is not possible to use templates for actions. But calling a script is a good alternative.

Related topics