Repository navigation
Badge

A Chartdeck badge for the badge row at the top of a Sections view: one entity, drawn as a pill like Home Assistant's own badges, with the card's colour bands, limits and actions. It comes with the card; there is nothing more to install.
A few numbers you want above every card on a view: the grid, the outside temperature, the phone's battery, with a trend or a fill level the plain badge doesn't show.
type: custom:chartdeck-badge
entity: sensor.phone_battery
style: ring
name: Phone
severity:
- from: 0
color: red
- from: 20
color: amber
- from: 40
color: greenTo add one, edit a Sections view, choose Add badge and search for Chartdeck badge. Its own editor has every option below.
style |
What it draws |
|---|---|
value (default) |
The value and name beside the entity's icon in a circle tinted with the badge's colour |
sparkline |
A small line of the last hours of history, then the value and name |
ring |
A small ring filled to the value's place between min and max, then the value and name |
thin |
A short bar filled the same way, then the value and name |
| Option | Type | Default | Editor |
|---|---|---|---|
entity |
entity id | none (needed) | Entity |
style |
value, sparkline, ring, thin
|
value |
Look |
attribute |
attribute name | none (the state) | Attribute (instead of the state) |
name |
text | the entity's friendly name | Name |
show_name |
true / false | true |
Show name |
show_icon |
true / false | true |
Show icon (value look only) |
icon |
icon, such as mdi:flash
|
the entity's own icon | Icon (value look, while the icon is shown) |
hours |
number of hours, above 0 and at most 168 | 24 |
Hours of history (sparkline only) |
min |
number or entity | 0 |
Minimum |
max |
number or entity | 100 |
Maximum |
unit |
text | the entity's unit | Unit |
decimals |
whole number, 0–20 | as on the card | Decimals |
color |
palette name or any CSS colour | the theme's primary colour | Colour without bands |
severity |
list of bands | none | Colour bands |
tap_action, hold_action, double_tap_action
|
action |
more-info, none, none
|
Actions |
- The options mean the same as on the card, because the badge runs them through the card's own code:
min,maxand band starts can be numbers or entities,unitconverts as on the card (see Options), and decimals follow the entity's display precision. -
Colour: the colour of the band the value is in when
severityis set, otherwisecolor, otherwise the theme's primary colour. -
show_icon: falseon the value look puts a small dot in the badge's colour in place of the icon. - Unavailable or missing entities draw grey, with their status in place of the value.
- The sparkline loads the entity's history once and then adds new states as they arrive. It stops while the badge isn't on the page.
In the badge editor: Entity and Look first, then the attribute, Name and, for the sparkline, Hours of history; Show name and Show icon; Icon; Unit and Decimals; Colour without bands; then Minimum and Maximum (each with Default, Number and Entity, as in the card's Limits section), Colour bands and Actions.
The badge is static: it has no draw-in animation. It needs Home Assistant 2024.8 or later, which added badges to Sections views.
Every card option is described on the Options page; the badge reads the ones in the table above.
Start
Using it
-
Styles
- Bar
- Thin
- Segmented
- Tank
- Ring
- Needle
- Arc
- Line
- Area
- Column
- Combined
- Pie and donut
- Rings
- Pictograph
- Waffle
- Histogram
- Scatter
- Bubble
- Heatmap
- Box plot
- Funnel
- Waterfall
- Treemap
- Sunburst and icicle
- Radar
- Polar area
- Grouped and stacked bars
- Bullet
- Lollipop
- Slope
- Dumbbell
- Range area
- Sparkline
- Streamgraph
- Candlestick
- Violin and raincloud
- Beeswarm
- State timeline
- Climate
- Sankey
- Wind rose
- 24-hour clock
- Trend
- Marimekko
- Chord
- Battery grid
- Spiral
- Strip plot
- Cycle plot
- Badge
- Options
- Visual editor
- Colour bands
Help