Trying It Out
Three ways to find out what to write before you build anything real: one that makes a template from cards you already have, one that shows what a placeholder gives back, and a dashboard you paste in to try placeholders against your own Home Assistant.
On this page:
Template builder
Paste the cards you already have, the way the card editor or the raw configuration editor
shows them. A list of cards, a view or a whole dashboard all work, and cards inside stacks
are found too. It finds the ones that are copies of each other and gives back two things:
the decluttering_templates: block, and the cards that replace yours.
Copies are not always exact. If three tiles have an icon and the fourth does not, the
template gets icon: '[[icon?]]', and the fourth card just does not pass one - see
A variable the template can do without.
Cards it cannot make a template from are listed with the reason, and for a card that is
nearly a copy of another it says what only one of them has, which is usually the one thing
to change.
It does the same work as Find similar cards in the editor, without needing the card installed. Nothing you paste leaves your browser.
Nothing to paste yet
The same page can write a template from a description instead. Say what it makes - cards,
badges or rows of an Entities card - and which card, tick what changes from one copy to the
next (the name, the icon, the colour, the page it opens, or any other setting by name), and
list the entities. Ticking the extras adds a visibility condition that hides a copy while
its entity is unavailable, variables: declarations so the visual editor shows a field for
each variable, or one card that repeats the template with
for_each instead of a card per copy.
The template and the cards are written as you answer, and under them a line for each part saying what it is, with a link to where it is written up here.
Try a placeholder
Give it some variables and a placeholder, and it shows what comes out at each step of the
chain, and whether that is text, a number, true or false, or a list. For
[[count|add:[[offset]]|mul:2]] with count: 3 and offset: 2:
| Step | Gives | As |
|---|---|---|
count |
3 |
a number |
\|add:[[offset]] |
5 |
a number |
\|mul:2 |
10 |
a number |
The type matters when the placeholder is the whole value of an option -
columns: '[[count]]' gets the number, not the text. Inside a longer piece of text
everything becomes text, and the page shows both. See Value types.
It runs the card’s own code, so what it shows is what a card gets. The steps that ask Home
Assistant - area, state, friendly_name and the rest - read a small made-up house
described on the page, because a web page has no Home Assistant. For your own entities, use
the sandbox below.
The placeholder sandbox dashboard
A dashboard that is not meant to be kept: each card is a list of placeholders, each shown
as you write it and what it turns into, using values you set at the top and your own Home
Assistant. Text, numbers, lists and mappings, stand-ins for what nothing set, if:, and
everything you can ask Home Assistant. It needs v2.0.0 or later.
- Make a new dashboard and open its raw configuration editor (three dots, Raw configuration editor).
- Paste in examples/playground-dashboard.yaml and save.
- Change the values under
decluttering_defaultsand watch the cards follow.
decluttering_defaults:
entity: sun.sun
text: Back Garden lights
number: 7
offset: 2
list: [kitchen, hall, study]
level: warning
colours:
error: red
warning: amber
good: green
Set entity to one of your lights. sun.sun works anywhere, but it has no area, device or
floor, so those lines stay as written, which is what a placeholder does when Home Assistant
has nothing to give. Put the same entity in rebuild_on on the “Asking Home Assistant”
card too: |state only reads entities a card lists there - see
Following an entity’s state.
To try your own, edit the “Your turn” template. Each line shows what was written by
escaping it, [[!text|upper]], and a placeholder inside another needs its own !:
[[!count|add:[[!offset]]]]. See Writing [[ and meaning it.