Add entity badge (#33866)

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: c0ffeeca7 <38767475+c0ffeeca7@users.noreply.github.com>
This commit is contained in:
Paul Bottein 2024-07-19 12:07:19 +02:00 committed by GitHub
parent 972fbfccdf
commit 11aec70466
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 63 additions and 3 deletions

View File

@ -61,7 +61,7 @@ hide_state:
state_content:
required: false
description: >
Content to display for the state. Can be `state`, `last-changed`, or any attribute of the entity. Can be either a string with a single item, or a list of string items. Default depends on the entity domain.
Content to display for the state. Can be `state`, `last_changed`, `last_updated`, or any attribute of the entity. Can be either a string with a single item, or a list of string items. Default depends on the entity domain.
type: [string, list]
tap_action:
required: false

View File

@ -10,9 +10,69 @@ Badges are widgets that sit at the top of a panel, above all the cards.
Badges at the top of a panel.
</p>
## State Label Badge
## Entity badge
The State Label badge allows you to display a state badge. This badge supports [actions](/dashboards/actions/).
The Entity badge allows you to display the state of an entity on a badge. This badge supports [actions](/dashboards/actions/).
```yaml
type: entity
entity: light.living_room
```
{% configuration entity %}
type:
required: true
description: "`entity`"
type: string
entity:
required: true
description: Entity ID.
type: string
name:
required: false
description: Overwrites the entity name.
type: string
icon:
required: false
description: Overwrites the entity icon.
type: string
color:
required: false
description: Set the color when the entity is active. By default, the color is based on `state`, `domain`, and `device_class` of your entity. It accepts [color token](/dashboards/tile/#available-colors) or hex color code.
type: string
default: state
show_entity_picture:
required: false
description: If your entity has a picture, it will replace the icon.
type: boolean
default: false
display_type:
required: false
description: Type of display for the badge. It can be either `minimal` (icon only), `standard` (icon and state), or `complete` (icon, state, and name).
type: string
default: standard
state_content:
required: false
description: >
Content to display for the state. Can be `state`, `last_changed`, `last_updated`, or any attribute of the entity. Can be either a string with a single item, or a list of string items. Default depends on the entity domain.
type: [string, list]
tap_action:
required: false
description: Action taken on card tap. See [action documentation](/dashboards/actions/#tap-action). By default, it will show the "more-info" dialog.
type: map
hold_action:
required: false
description: Action taken on tap-and-hold. See [action documentation](/dashboards/actions/#hold-action).
type: map
double_tap_action:
required: false
description: Action taken on double tap. See [action documentation](/dashboards/actions/#double-tap-action).
type: map
{% endconfiguration %}
## State label badge
The state label badge allows you to display a state badge. This badge supports [actions](/dashboards/actions/).
```yaml
type: state-label

Binary file not shown.

Before

Width:  |  Height:  |  Size: 23 KiB

After

Width:  |  Height:  |  Size: 25 KiB