mirror of
https://github.com/home-assistant/home-assistant.io.git
synced 2025-05-05 18:48:59 +00:00
206 lines
5.9 KiB
Markdown
206 lines
5.9 KiB
Markdown
---
|
|
title: "Entity Button Card"
|
|
sidebar_label: Entity Button
|
|
description: "The Entity Button card allows you to add buttons to perform tasks"
|
|
---
|
|
|
|
The Entity Button card allows you to add buttons to perform tasks.
|
|
|
|
<p class='img'>
|
|
<img src='/images/lovelace/lovelace_entity_button_card.png' alt='Screenshot of the entity button card'>
|
|
Screenshot of the Entity Button card.
|
|
</p>
|
|
|
|
```yaml
|
|
type: entity-button
|
|
entity: light.living_room
|
|
```
|
|
|
|
{% configuration %}
|
|
type:
|
|
required: true
|
|
description: entity-button
|
|
type: string
|
|
entity:
|
|
required: true
|
|
description: Home Assistant entity ID.
|
|
type: string
|
|
name:
|
|
required: false
|
|
description: Overwrites friendly name.
|
|
type: string
|
|
default: Name of Entity
|
|
icon:
|
|
required: false
|
|
description: Overwrites icon or entity picture.
|
|
type: string
|
|
default: Entity Domain Icon
|
|
show_name:
|
|
required: false
|
|
description: Show name.
|
|
type: boolean
|
|
default: "true"
|
|
show_icon:
|
|
required: false
|
|
description: Show icon.
|
|
type: boolean
|
|
default: "true"
|
|
icon_height:
|
|
required: false
|
|
description: Set the height for the icon. This is in pixels which is handled by the config ui. (Advanced users can use other CSS values if they like)
|
|
type: string
|
|
default: auto
|
|
tap_action:
|
|
required: false
|
|
description: Action to take on tap
|
|
type: map
|
|
keys:
|
|
action:
|
|
required: true
|
|
description: "Action to perform (`more-info`, `toggle`, `call-service`, `navigate`, `url`, `none`)"
|
|
type: string
|
|
default: "`toggle`"
|
|
navigation_path:
|
|
required: false
|
|
description: "Path to navigate to (e.g. `/lovelace/0/`) when `action` defined as `navigate`"
|
|
type: string
|
|
default: none
|
|
url_path:
|
|
required: false
|
|
description: "Path to navigate to (e.g. `https://www.home-assistant.io`) when `action` defined as `url`"
|
|
type: string
|
|
default: none
|
|
service:
|
|
required: false
|
|
description: "Service to call (e.g. `media_player.media_play_pause`) when `action` defined as `call-service`"
|
|
type: string
|
|
default: none
|
|
service_data:
|
|
required: false
|
|
description: "Service data to include (e.g. `entity_id: media_player.bedroom`) when `action` defined as `call-service`"
|
|
type: string
|
|
default: none
|
|
confirmation:
|
|
required: false
|
|
description: "Present a confirmation dialog to confirm the action. See `confirmation` object below"
|
|
type: [boolean, map]
|
|
default: "false"
|
|
hold_action:
|
|
required: false
|
|
description: Action to take on tap-and-hold
|
|
type: map
|
|
keys:
|
|
action:
|
|
required: true
|
|
description: "Action to perform (`more-info`, `toggle`, `call-service`, `navigate`, `url`, `none`)"
|
|
type: string
|
|
default: "`more-info`"
|
|
navigation_path:
|
|
required: false
|
|
description: "Path to navigate to (e.g. `/lovelace/0/`) when `action` defined as `navigate`"
|
|
type: string
|
|
default: none
|
|
url_path:
|
|
required: false
|
|
description: "Path to navigate to (e.g. `https://www.home-assistant.io`) when `action` defined as `url`"
|
|
type: string
|
|
default: none
|
|
service:
|
|
required: false
|
|
description: "Service to call (e.g. `media_player.media_play_pause`) when `action` defined as `call-service`"
|
|
type: string
|
|
default: none
|
|
service_data:
|
|
required: false
|
|
description: "Service data to include (e.g. `entity_id: media_player.bedroom`) when `action` defined as `call-service`"
|
|
type: string
|
|
default: none
|
|
confirmation:
|
|
required: false
|
|
description: "Present a confirmation dialog to confirm the action. See `confirmation` object below"
|
|
type: [boolean, map]
|
|
default: "false"
|
|
double_tap_action:
|
|
required: false
|
|
description: Action to take on double tap
|
|
type: map
|
|
keys:
|
|
action:
|
|
required: true
|
|
description: "Action to perform (`more-info`, `toggle`, `call-service`, `navigate`, `url`, `none`)"
|
|
type: string
|
|
default: "`more-info`"
|
|
navigation_path:
|
|
required: false
|
|
description: "Path to navigate to (e.g. `/lovelace/0/`) when `action` defined as `navigate`"
|
|
type: string
|
|
default: none
|
|
url_path:
|
|
required: false
|
|
description: "Path to navigate to (e.g. `https://www.home-assistant.io`) when `action` defined as `url`"
|
|
type: string
|
|
default: none
|
|
service:
|
|
required: false
|
|
description: "Service to call (e.g. `media_player.media_play_pause`) when `action` defined as `call-service`"
|
|
type: string
|
|
default: none
|
|
service_data:
|
|
required: false
|
|
description: "Service data to include (e.g. `entity_id: media_player.bedroom`) when `action` defined as `call-service`"
|
|
type: string
|
|
default: none
|
|
confirmation:
|
|
required: false
|
|
description: "Present a confirmation dialog to confirm the action. See `confirmation` object below"
|
|
type: [boolean, map]
|
|
default: "false"
|
|
theme:
|
|
required: false
|
|
description: "Set to any theme within `themes.yaml`"
|
|
type: string
|
|
{% endconfiguration %}
|
|
|
|
## Options For Confirmation
|
|
|
|
If you define confirmation as an object instead of boolean, you can add more customization and configurations:
|
|
{% configuration %}
|
|
text:
|
|
required: false
|
|
description: Text to present in the confirmation dialog.
|
|
type: string
|
|
exemptions:
|
|
required: false
|
|
description: "List of `exemption` objects. See below"
|
|
type: list
|
|
{% endconfiguration %}
|
|
|
|
## Options For Exemptions
|
|
|
|
{% configuration badges %}
|
|
user:
|
|
required: true
|
|
description: User id that can see the view tab.
|
|
type: string
|
|
{% endconfiguration %}
|
|
|
|
## Examples
|
|
|
|
Title and Script Service Example:
|
|
|
|
```yaml
|
|
type: entity-button
|
|
name: Turn Off Lights
|
|
tap_action:
|
|
action: call-service
|
|
service: script.turn_on
|
|
service_data:
|
|
entity_id: script.turn_off_lights
|
|
entity: script.turn_off_lights
|
|
```
|
|
|
|
<p class='img'>
|
|
<img src='/images/lovelace/lovelace_entity_button_complex_card.png' alt='Screenshot of the entity button card'>
|
|
Screenshot of the Entity Button card with Title and Script Service.
|
|
</p>
|