Recipes
Complete, copy-paste examples. Swap the entity IDs for your own.
Each recipe says when you would want it, shows the template, then how to use it, then what to change. The tag on a heading is the oldest release of the card the recipe works on. Every example here was run on the card at v2.9.0.
The examples assume Home Assistant 2024.11 or newer. Sections views arrived in 2024.3 and
badges in them in 2024.8, the heading card in 2024.10 and grid_options in 2024.11. A
recipe marked sections has to go in a sections view; the others work in any view.
On this page:
- Beginner: one template, one or two variables, a card you already know
- Intermediate: repeats, defaults that think for themselves, templates built on templates
- Advanced: whole views and dashboards written by the card
- Shared templates: finished templates other people have posted, by level
Beginner
1. Room card (v1.0.0+)
The classic: one card per room, with a light and a temperature, so a new room is a handful of lines rather than twenty.
decluttering_templates:
room_summary:
card:
type: vertical-stack
cards:
- type: heading
heading: '[[room]]'
icon: '[[icon]]'
- type: grid
columns: 2
square: false
cards:
- type: tile
entity: '[[light]]'
name: Light
features:
- type: toggle
- type: tile
entity: '[[temperature]]'
name: Temperature
default:
- icon: mdi:home-outline
- type: custom:decluttering-card-plus
template: room_summary
variables:
- room: Living Room
- icon: mdi:sofa
- light: light.living_room
- temperature: sensor.living_room_temperature
- type: custom:decluttering-card-plus
template: room_summary
variables:
- room: Kitchen
- icon: mdi:silverware-fork-knife
- light: light.kitchen
- temperature: sensor.kitchen_temperature

To change: leave icon off a card and the room gets mdi:home-outline from default:.
Add a third tile to the grid and every room gets it.
See Cards.
2. Turn the card you already have into a template (v1.0.0+)
You have a tile you like and want it four more times. Three steps, all in the raw configuration editor.
Step 1: the card as it is on the dashboard.
type: tile
entity: light.kitchen
name: Pendants
features:
- type: toggle
Step 2: paste it under decluttering_templates: at the top of the dashboard, give it a
name, put it under card:, and replace each value that changes between copies with a
placeholder.
decluttering_templates:
light_tile:
card:
type: tile
entity: '[[light]]'
name: '[[name]]'
features:
- type: toggle
Step 3: swap the original card for one that uses the template, and add the rest.
- type: custom:decluttering-card-plus
template: light_tile
variables:
- light: light.kitchen
- name: Pendants
- type: custom:decluttering-card-plus
template: light_tile
variables:
- light: light.bedroom
- name: Bedside

To change: anything you do not replace with a placeholder stays the same on every copy, so leave the toggle as it is. The template editor can do steps 2 and 3 for you: see Declutter an existing card.
3. A button that runs a scene or a script (v1.0.0+)
A row of buttons for scenes and scripts, where the only thing that differs is what each one runs.
decluttering_templates:
scene_button:
card:
type: button
name: '[[name]]'
icon: '[[icon]]'
icon_height: 40px
tap_action:
action: perform-action
perform_action: '[[action]]'
target:
entity_id: '[[entity]]'
default:
- action: scene.turn_on
- icon: mdi:play-circle-outline
- type: horizontal-stack
cards:
- type: custom:decluttering-card-plus
template: scene_button
variables:
- entity: scene.movie_night
- name: Movie night
- icon: mdi:movie-open
- type: custom:decluttering-card-plus
template: scene_button
variables:
- entity: script.good_night
- name: Good night
- icon: mdi:weather-night
- action: script.turn_on

To change: a scene needs nothing but its id, since scene.turn_on is the default; a
script passes action: script.turn_on as well. For a button that toggles a light, swap
the whole tap_action for action: toggle and add entity: '[[entity]]' to the card.
4. A tidy Entities card (v1.0.0+)
Every row of an Entities card shaped the same way, with the icon decided once.
decluttering_templates:
temperature_row:
row:
entity: '[[entity]]'
name: '[[name]]'
icon: '[[icon]]'
default:
- icon: mdi:thermometer
- type: entities
title: Temperatures
entities:
- type: custom:decluttering-card-plus
template: temperature_row
variables:
- entity: sensor.living_room_temperature
- name: Living Room
- type: custom:decluttering-card-plus
template: temperature_row
variables:
- entity: sensor.living_room_humidity
- name: Living Room humidity
- icon: mdi:water-percent

To change: a row template takes any key an Entities row does, so
secondary_info: last-changed under row: puts the time under every name. For one row per light without
listing them, see recipe 23.
See Rows.
5. A name or icon only when you give one (v1.1.0+)
Most tiles are fine with the entity’s own name and icon; one or two want their own.
[[name?]] takes the key out when nothing fills it, so Home Assistant falls back to what
the entity has.
decluttering_templates:
sensor_tile:
card:
type: tile
entity: '[[entity]]'
name: '[[name?]]'
icon: '[[icon?]]'
- type: custom:decluttering-card-plus
template: sensor_tile
variables:
- entity: sensor.living_room_humidity
- name: Lounge humidity
- icon: mdi:water-percent
- type: custom:decluttering-card-plus
template: sensor_tile
variables:
- entity: sensor.kitchen_temperature

To change: the ? works on any key, and on a whole list item, so - type: '[[feature?]]'
under features: adds a feature only to the cards that ask for one.
See A variable the template can do without.
6. A name that falls back to the entity’s own (v1.1.0+)
Like recipe 5, but the name is part of a longer label, so the key cannot just go. The template asks Home Assistant for the entity’s name and uses that unless the card gives one.
decluttering_templates:
named_light:
card:
type: tile
entity: '[[light]]'
name: '[[name]] ([[light|area]])'
features:
- type: toggle
default:
- name: '[[light|friendly_name]]'
- type: custom:decluttering-card-plus
template: named_light
variables:
- light: light.living_room
- type: custom:decluttering-card-plus
template: named_light
variables:
- light: light.kitchen
- name: Main light

To change: |area is one of several things a placeholder can ask Home Assistant for;
|device, |floor and |icon work the same way.
See Asking Home Assistant for a value.
7. An alert that only appears when it matters (v1.0.0+)
One template, three instances, each watching a different sensor. Cards whose condition is not met vanish without leaving a gap.
decluttering_templates:
motion_alert:
card:
type: tile
entity: '[[sensor]]'
name: '[[name]]'
visibility:
- condition: state
entity: '[[sensor]]'
state: '[[show_when]]'
default:
- show_when: 'on'
- name: Motion
- type: custom:decluttering-card-plus
template: motion_alert
variables:
- sensor: binary_sensor.hallway_motion
- name: Hallway motion
- type: custom:decluttering-card-plus
template: motion_alert
variables:
- sensor: binary_sensor.front_door
- name: Front door
- type: custom:decluttering-card-plus
template: motion_alert
variables:
- sensor: binary_sensor.garage_door
- name: Garage door
- show_when: 'off'

The hallway has motion and the garage door is closed, so those two show. The front door
is closed and its card is waiting for on, so it is not there at all.
To change: quote the state, since YAML reads a bare on and off as true and false.
See Visibility.
8. Badges for the top of a view (v1.0.0+) (sections)
A badge per power sensor, each in its own colour, from one definition.
decluttering_templates:
power_badge:
badge:
type: entity
entity: '[[entity]]'
name: '[[name]]'
color: '[[color]]'
show_name: true
default:
- color: blue
views:
- type: sections
badges:
- type: custom:decluttering-card-plus
template: power_badge
variables:
- entity: sensor.solar_power
- name: Solar
- color: yellow
- type: custom:decluttering-card-plus
template: power_badge
variables:
- entity: sensor.house_power
- name: House
- color: red

To change: a badge template takes any key a badge does, so show_icon: false under
badge: drops the icon from all of them.
See Badges.
9. One template, several widths (v1.2.0+) (sections)
The same tile at full width, two thirds and a third. Pass the grid width in as a number.
decluttering_templates:
sized_tile:
card:
type: tile
entity: '[[entity]]'
name: '[[name]]'
hide_state: true
grid_options:
columns: '[[cols]]'
rows: 1
default:
- cols: 6
- type: custom:decluttering-card-plus
template: sized_tile
variables:
- entity: sensor.solar_power
- name: Solar
- cols: 12
- type: custom:decluttering-card-plus
template: sized_tile
variables:
- entity: sensor.house_power
- name: House
- cols: 8
- type: custom:decluttering-card-plus
template: sized_tile
variables:
- entity: sensor.kitchen_temperature
- name: Kitchen
- cols: 4

To change: the placeholder is the whole value, so cols: 4 arrives as the number 4, which
grid_options needs. A card that passes nothing gets 6, half the section.
See Grid options in sections views.
10. Themed card with a colour variable (v1.0.0+)
A border colour per room, set from the card rather than with card-mod.
decluttering_templates:
fancy_room:
card:
type: tile
entity: '[[light]]'
name: '[[room]]'
features:
- type: toggle
style: |
:host {
--ha-card-border-color: [[accent]];
--ha-card-border-width: 2px;
--ha-card-border-radius: 18px;
}
default:
- accent: '#2E5EA8'
- type: custom:decluttering-card-plus
template: fancy_room
variables:
- light: light.living_room
- room: Living Room
- type: custom:decluttering-card-plus
template: fancy_room
variables:
- light: light.kitchen
- room: Kitchen
- accent: '#c2410c'

To change: only CSS custom properties reach inside the wrapped card, so set
--ha-card-background or --tile-color the same way; a rule on ha-card itself will
not match.
See Styling.
11. Defaults that build on each other (v1.0.0+)
label is derived from area unless you override it outright, so most cards pass two
values and the odd one passes its own label.
decluttering_templates:
area_sensor:
card:
type: tile
entity: '[[entity]]'
name: '[[label]]'
icon: '[[icon]]'
default:
- label: '[[area]] temperature'
- area: Living Room
- entity: sensor.living_room_temperature
- icon: mdi:thermometer
- type: custom:decluttering-card-plus
template: area_sensor
- type: custom:decluttering-card-plus
template: area_sensor
variables:
- area: Bedroom
- entity: sensor.bedroom_temperature
- type: custom:decluttering-card-plus
template: area_sensor
variables:
- label: Solar output right now
- entity: sensor.solar_power
- icon: mdi:solar-power

To change: a default can hold any placeholder, including one with steps, so
label: '[[area|title]] temperature' tidies a lower-case area name.
See Defaults that reference other variables.
Intermediate
12. Floorplan markers (v1.0.0+)
A tappable light icon per room on a floorplan, styled once.
decluttering_templates:
room_marker:
element:
type: state-icon
entity: '[[light]]'
tap_action:
action: toggle
style:
transform: translate(-50%, -50%)
'--paper-item-icon-color': white
background-color: rgba(30, 41, 59, 0.75)
border-radius: 50%
padding: 6px
- type: picture-elements
image: /local/floorplan.svg
elements:
- type: custom:decluttering-card-plus
template: room_marker
variables:
- light: light.living_room
style:
top: 32%
left: 26%
- type: custom:decluttering-card-plus
template: room_marker
variables:
- light: light.kitchen
style:
top: 32%
left: 72%

To change: the style: on the card is the element’s position and is read by Home
Assistant; the style: in the template is the element’s look. Keep them apart.
See Elements.
13. A shared template library (v1.0.0+)
Keep templates on one dashboard and borrow them everywhere else, so a change in one place reaches every dashboard.
# dashboard: shared-templates
decluttering_templates:
house_room:
card:
type: tile
entity: '[[light]]'
name: '[[room]]'
icon: '[[icon]]'
features:
- type: toggle
default:
- icon: mdi:lightbulb
views:
- title: Library
cards: []
# every other dashboard
decluttering_templates_from:
- shared-templates
views:
- title: Home
cards:
- type: custom:decluttering-card-plus
template: house_room
variables:
- light: light.kitchen
- room: Kitchen

To change: a dashboard at the URL path decluttering-templates is borrowed from by every
dashboard without being named, so you can skip the decluttering_templates_from: line
altogether.
See Sharing Templates Between Dashboards.
14. A template built from other templates (v1.0.0+)
Two rooms side by side, where each half is itself a template, so one edit to the tile changes both.
decluttering_templates:
room_light:
card:
type: tile
entity: '[[light]]'
name: '[[room]]'
features:
- type: toggle
room_pair:
card:
type: horizontal-stack
cards:
- type: custom:decluttering-card-plus
template: room_light
variables:
- light: '[[light_a]]'
- room: '[[room_a]]'
- type: custom:decluttering-card-plus
template: room_light
variables:
- light: '[[light_b]]'
- room: '[[room_b]]'
- type: custom:decluttering-card-plus
template: room_pair
variables:
- light_a: light.living_room
- room_a: Living Room
- light_b: light.kitchen
- room_b: Kitchen

To change: when the inner card should get every variable of the outer one without
listing them, write inherit_variables: true on it instead of variables:.
See Nesting.
15. Light tiles grouped by room (v1.2.0+)
You want every room’s lights on one card, each room under its own heading, without listing a single light.
decluttering_templates:
light_toggle:
card:
type: tile
entity: '[[entity]]'
features:
- type: toggle
room_lights:
card:
type: vertical-stack
cards:
- type: heading
heading: '[[area]]'
- type: custom:decluttering-card-plus
template: light_toggle
columns: 2
for_each: '[[items]]'
- type: custom:decluttering-card-plus
template: room_lights
columns: 2
min_column_width: 300
for_each_from:
areas: true
with:
domain: light

areas: true makes one copy per area, and with: hands each copy the lights in it as
items, which the inner card repeats over. A room with no lights is left out, and a new
light or room appears without touching the dashboard.
To change: with: {domain: [light, switch]} brings the switches in too, and
sort: floor on the outer repeat groups the rooms by floor.
See Repeating a Template.
16. Radiators, warmest room first (v1.5.0+)
You want a thermostat card per radiator valve, ordered by how warm each room is when the dashboard opens.
decluttering_templates:
room_thermostat:
card:
type: thermostat
entity: '[[entity]]'
name: '[[area]]'
- type: custom:decluttering-card-plus
template: room_thermostat
columns: 3
min_column_width: 220
for_each_from:
domain: climate
require: area
sort: -attr:current_temperature

sort: -attr:current_temperature reads each thermostat’s attribute and the minus puts the
highest first. require: area drops any valve not yet put in a room, so every card has a
name. The order is taken when the card is built, not kept up to date as rooms warm up.
To change: sort: [-attr:current_temperature, name] breaks ties by name, and limit: 4
shows only the four warmest.
See Repeating a Template.
17. A navigation strip that follows the dashboard (v2.0.0+)
You want a row of buttons, one per view, that stays right when you add, rename or reorder views.
decluttering_templates:
view_button:
card:
type: button
name: '[[name]]'
icon: '[[icon]]'
tap_action:
action: navigate
navigation_path: '[[navigation_path]]'
- type: custom:decluttering-card-plus
template: view_button
columns: 4
for_each_from:
views: true
exclude: Settings

views: true repeats over the views of the dashboard the card sits on, in the dashboard’s
order, and each copy carries a ready-made navigation_path. Subviews are left out, and
exclude: drops a view by its title or path.
To change: a view without an icon leaves [[icon]] unfilled, so write icon: '[[icon?]]'
when not every view has one.
See Repeating a Template.
18. One list per floor, in floor order (v1.8.0+)
You want an Entities card for each floor of the house, listing that floor’s lights, from the bottom of the house up.
decluttering_templates:
floor_lights:
card:
type: entities
title: '[[floor]]'
entities: '[[entities]]'
- type: custom:decluttering-card-plus
template: floor_lights
for_each_from:
floors: true
sort: level
with:
domain: light

Floors come in name order unless asked otherwise. sort: level uses the level you gave each
floor in Home Assistant, as a number, so the basement at -1 comes before the ground floor
at 0. with: hands each floor its lights as entities, a list of ids the Entities card
takes as it is, and a floor with no lights is left out.
To change: with: {domain: light, exclude: light.*_lamp} keeps the lamps off the list.
See Repeating a Template.
19. A toggle only when asked for: if: and bool (v1.12.0+)
Some tiles want a toggle and a state line, some want neither. One template, two switches on the card.
decluttering_templates:
option_tile:
default:
- controls: false
- toggle:
type: toggle
card:
type: tile
entity: '[[light]]'
hide_state: '[[compact|bool]]'
features:
- '[[toggle|if:controls?]]'
- type: custom:decluttering-card-plus
template: option_tile
variables:
- light: light.living_room
- controls: 'yes'
- type: custom:decluttering-card-plus
template: option_tile
variables:
- light: light.kitchen
- compact: true

bool turns whatever compact holds into a real true or false, and an unset compact
counts as false, so the living room keeps its state line. if:controls keeps the toggle
mapping only while controls is a yes; when it is not, the ? drops the list item, which
empties features:, which goes too.
To change: if:mode=night keeps a value only while another variable is exactly that
text, which is how one template builds a day and a night version of itself.
See Keeping a value only while another variable says so and Switching an option on and off.
20. An icon that follows the sensor: rebuild_on, |state and switch: (v2.9.0+)
A tile whose icon changes with a binary sensor. A card is built once, so it has to say
which entity it follows; rebuild_on does that, and then |state can read it.
decluttering_templates:
watch_tile:
card:
type: tile
entity: '[[sensor]]'
name: '[[name]]'
icon: '[[sensor|state|switch:on=mdi:alert-circle,default=mdi:check-circle]]'
color: amber
- type: custom:decluttering-card-plus
template: watch_tile
rebuild_on: binary_sensor.front_door
variables:
- sensor: binary_sensor.front_door
- name: Front door
- type: custom:decluttering-card-plus
template: watch_tile
rebuild_on: binary_sensor.hallway_motion
variables:
- sensor: binary_sensor.hallway_motion
- name: Hallway motion

The card builds again whenever the listed entity’s state changes, and only then. switch:
picks one value by the state, with default= catching anything no arm names. The tile
only colours an active entity, so the closed door stays grey whatever color: says.
To change: without rebuild_on the placeholder keeps its brackets on purpose, so a state
read once can never go stale. List more than one entity as a list.
See Following an entity’s state
and unless: and switch:.
21. A family of tiles that differ by a line: extends: (v1.8.0+)
Two tiles that are the same but for a colour and a state line. The second starts from the first and says only what differs.
decluttering_templates:
room_tile:
default:
- colour: amber
card:
type: tile
entity: '[[entity]]'
color: '[[colour]]'
features:
- type: toggle
quiet_tile:
extends: room_tile
default:
- colour: grey
card:
hide_state: true
icon: mdi:lightbulb-outline
- type: custom:decluttering-card-plus
template: room_tile
variables:
- entity: light.living_room
- type: custom:decluttering-card-plus
template: quiet_tile
variables:
- entity: light.bedroom

The child’s card: is merged into the parent’s key by key, and its defaults go in front
of the parent’s, so colour is grey while the toggle is inherited untouched.
To change: features: null in the child takes the parent’s toggle away altogether, and a
list of names under extends: folds several parents together.
See A template built on another.
22. A frame the card fills in: slots (v2.9.0+)
A heading and a stack that every room shares, where each card decides what goes inside. No variable per tile, and no limit on how many.
decluttering_templates:
room_frame:
card:
type: vertical-stack
cards:
- type: heading
heading: '[[room]]'
- '[[body|slot]]'
- '[[footer|slot?]]'
- type: custom:decluttering-card-plus
template: room_frame
variables:
- room: Kitchen
slots:
body:
- type: tile
entity: light.kitchen
- type: tile
entity: sensor.kitchen_temperature
- type: custom:decluttering-card-plus
template: room_frame
variables:
- room: Bedroom
slots:
body:
- type: tile
entity: light.bedroom
footer:
- type: markdown
content: The lamp goes off at eleven.

The cards under slots: land in the stack where the placeholder stood, exactly as
written. slot? is a slot the card may leave empty; only the bedroom fills the footer.
To change: quote the placeholder, since unquoted YAML reads [[body|slot]] as a list in
a list. A card put in a slot can itself be a custom:decluttering-card-plus card with
variables of its own.
See Slots.
23. An Entities card with a row per light: with: and repeat: (v2.3.0+)
One Entities card with every light in the house, plus the sun at the top, without writing a row per light or a row template.
decluttering_templates:
house_lights:
default:
- row:
entity: '[[entity]]'
name: '[[name]]'
secondary_info: last-changed
- lights:
domain: light
sort: name
card:
type: entities
title: Lights
entities:
- '[[row|with:entity=sun.sun,name=Sun]]'
- type: divider
- '[[row|repeat:lights]]'
- type: custom:decluttering-card-plus
template: house_lights

with: fills the row block once with the values after the colon. repeat: fills it
once per light that the lights source finds and splices the copies into the list,
beside the divider written by hand. Each copy gets the entity’s entity and name.
To change: lights: {domain: light, area: Kitchen} narrows it to one room, or pass the
source from the card with variables: [{lights: {label: night_lights}}].
See List Entries.
24. One repeat, a template per kind of entity: template_by_domain (v2.0.0+)
A room’s entities on one card, where the lights get a toggle, the temperatures a graph, and everything else a plain tile.
decluttering_templates:
lamp_tile:
card:
type: tile
entity: '[[entity]]'
features:
- type: toggle
temperature_graph:
card:
type: sensor
entity: '[[entity]]'
graph: line
plain_tile:
card:
type: tile
entity: '[[entity]]'
- type: custom:decluttering-card-plus
template_by_domain:
light: lamp_tile
sensor: temperature_graph
default: plain_tile
columns: 2
for_each:
- entity: light.living_room
- entity: light.kitchen
- entity: sensor.living_room_temperature
- entity: sensor.kitchen_temperature
- entity: binary_sensor.hallway_motion
- entity: binary_sensor.front_door

Each copy picks its template by the domain of its entity. A domain with no entry takes
default:.
To change: swap the written list for for_each_from: {area: Living Room} and the card
covers whatever the room holds, each entity in the shape its domain asks for.
25. A template that says what is wrong: checks: and alert: (v2.9.0+)
A temperature tile built from a room name, which says so in plain words when the room has no sensor, instead of showing Entity not found.
decluttering_templates:
room_temperature:
default:
- sensor: sensor.[[room]]_temperature
checks:
- name: No sensor
condition: '[[sensor|exists]]'
fail_on: false
level: error
message: There is no [[sensor]] in Home Assistant.
alert:
type: markdown
content: '**[[room|title]]**: [[__alerts__.error.items|join:, ]]'
card:
type: tile
entity: '[[sensor]]'
name: '[[room|title]]'
- type: custom:decluttering-card-plus
template: room_temperature
variables:
- room: kitchen
- type: custom:decluttering-card-plus
template: room_temperature
variables:
- room: bathroom

The check runs against the card’s values before the card is built. fail_on: false turns
it round, so it fails when the sensor does not exist. While a warn or error check is
failing the template builds its alert: instead of its card:, with the messages in
[[__alerts__]].
To change: leave alert: out and a failed error check opens the debug report under the
card instead; continue_rendering: false on the check stops the card being built at all.
See Checks and Strict.
26. A template written for someone else to install (v2.9.0+)
A lamp card you mean to share. It says who wrote it and what it needs, asks for the lamp when it is installed, offers the lamps as a dropdown in the card editor, shows the note field only when a note is wanted, and hides the editor parts it has no use for.
decluttering_templates:
lamp_card:
description: One lamp with a toggle, and a line of text under it when you want one
author: John
requires:
homeassistant: '2024.11'
setup: [light]
editor_hide: [repeat, fit, advanced]
variables:
- name: light
label: Lamp
options_from:
domain: light
option_label: '[[name]] ([[area|default:no area]])'
- name: show_note
label: Show a note
type: boolean
default: false
- name: note
label: Note
show_if: show_note
default:
- light: light.bedroom
- note_card:
type: markdown
content: '[[note]]'
card:
type: vertical-stack
cards:
- type: tile
entity: '[[light]]'
features:
- type: toggle
- '[[note_card|if:show_note?]]'
- type: custom:decluttering-card-plus
template: lamp_card
variables:
- light: light.bedroom
- show_note: true
- note: Dim it after ten, the baby sleeps next door.

None of the sharing keys change what the card builds. requires and setup are read by
the Share tab when someone installs it, options_from, show_if and editor_hide by the
card editor. Quote the version: YAML reads an unquoted 2024.10 as the number 2024.1.
To change: setup: [light, note] asks for both on install, and
requires: {integrations: [hue]} says what the template needs before it is installed,
without blocking it.
See Saying who wrote it and what it needs, A dropdown of what Home Assistant has, Showing a field only when it matters and Leaving out what a template has no use for.
27. Three across on a desk, one under another on a phone: variables_mobile (v2.9.0+)
Not hiding a card on a phone, but building it differently: fewer columns, and tiles that stand upright.
decluttering_templates:
light_strip:
card:
type: custom:decluttering-card-plus
template: strip_tile
columns: '[[columns]]'
for_each_from:
domain: light
floor: Ground floor
sort: name
variables:
- vertical: '[[vertical]]'
strip_tile:
card:
type: tile
entity: '[[entity]]'
vertical: '[[vertical|bool]]'
- type: custom:decluttering-card-plus
template: light_strip
variables:
- columns: 3
- vertical: false
variables_mobile:
- columns: 1
- vertical: true


variables_mobile: is laid over variables: while the screen is 870 pixels wide or less,
the width Home Assistant itself uses for its narrow layout. Anything not set again keeps
its usual value.
To change: mobile_below: 500 on the card measures the card itself instead of the screen,
for a card in a narrow column on a desk.
See Different values on a phone.
Advanced
28. A section per room: the view strategy (v1.11.0+) (sections)
A sections view with one section per area that has a light, each under the area’s own
heading, laid out and reflowed by Home Assistant like any other sections view. The
light_toggle template is the one from recipe 15.
views:
- title: Rooms
path: rooms
strategy:
type: custom:decluttering-card-plus
max_columns: 3
sections:
- for_each_from:
areas: true
with:
domain: light
section:
type: grid
cards:
- type: heading
heading: '[[area]]'
icon: '[[area_icon?]]'
- type: custom:decluttering-card-plus
template: light_toggle
for_each_from:
area: '[[area_id]]'
domain: light

The strategy writes the view’s sections, one per area, filling [[area]], [[area_icon]]
and [[area_id]] from each copy before the cards inside are built. An area without an
icon has [[area_icon?]] dropped.
To change: a badges: list beside sections: repeats badges the same way, and anything
else on the strategy, background say, is passed to the view.
See Repeating Sections and Badges.
29. A view per room: the dashboard strategy (v2.0.0+)
A whole dashboard: a Home view written by hand, then a view per area with a light in it, each holding that room’s lights, sensors, media players and covers. In the raw configuration editor of a dashboard of its own, replace everything with:
strategy:
type: custom:decluttering-card-plus
decluttering_templates:
entity_tile:
card:
type: tile
entity: '[[entity]]'
views:
- title: Home
path: home
cards:
- type: markdown
content: One view per room follows, written by the strategy.
- for_each_from:
areas: true
with:
domain: light
view:
title: '[[area]]'
path: '[[area_id]]'
type: sections
max_columns: 2
sections:
- type: grid
cards:
- type: heading
heading: '[[area]]'
- type: custom:decluttering-card-plus
template: entity_tile
for_each_from:
area: '[[area_id]]'
domain: [light, sensor, binary_sensor, media_player, cover]

The dashboard is written out again when an area, device or entity changes, so a new room
gets its tab without a reload. decluttering_templates on the strategy is copied to the
dashboard, which is where the cards inside look for entity_tile.
To change: a decluttering_templates_from: beside decluttering_templates: borrows the
templates from elsewhere instead, and variables: at the top of the strategy fills in the
hand-written views too.
See A view per item.
30. A whole dashboard from one template: page templates (v2.9.0+)
Recipe 29 as a template, so a second house, or a second wall tablet, is three lines naming the template and what is different. In the raw configuration editor:
strategy:
type: custom:decluttering-card-plus
decluttering_templates:
house_page:
description: A welcome view, then a view per area with a light in it
variables:
- name: house
- name: domain
default: light
dashboard:
title: '[[house]]'
views:
- title: Home
path: home
cards:
- type: markdown
content: |-
## Welcome to [[house]]
Every area with a [[domain]] in it has a view of its own.
- for_each_from:
areas: true
with:
domain: '[[domain]]'
view:
title: '[[area]]'
path: '[[area_id]]'
type: sections
max_columns: 2
sections:
- type: grid
cards:
- type: heading
heading: '[[area]]'
- type: custom:decluttering-card-plus
template: entity_tile
for_each_from:
area: '[[area_id]]'
domain: '[[domain]]'
entity_tile:
card:
type: tile
entity: '[[entity]]'
page:
template: house_page
variables:
- house: Rose Cottage

page: names the template and the values to build it with. The template’s variables:
and default: work as on any template, so domain falls back to light.
To change: keep house_page on a dashboard every other dashboard borrows from, and the
second dashboard is only the strategy: block with page: and its two variables.
See Page Templates.
31. Everything carrying one label (v1.8.0+)
A card headed with the label’s name, holding a tile for every entity that carries the label, whatever its domain.
decluttering_templates:
plain_tile:
card:
type: tile
entity: '[[entity]]'
label_board:
card:
type: vertical-stack
cards:
- type: heading
heading: '[[label]]'
- type: custom:decluttering-card-plus
template: plain_tile
columns: 2
for_each: '[[items]]'
- type: custom:decluttering-card-plus
template: label_board
for_each_from:
labels: night_lights
with:
entities: true

labels: night_lights gives one copy, named after the label, and with: {entities: true}
hands it everything that carries the label as items. Write labels: true for a card per
label.
To change: for tiles without the heading, repeat the tile straight over
for_each_from: {label: night_lights}; label: is a filter on entities, where labels:
is a source of copies.
See Repeating over devices, floors and labels.
32. The lights that were on when the page opened: a Jinja template: source (v2.0.0+)
A list no filter can describe, handed to Home Assistant’s own templating. The
plain_tile template is the one from recipe 31.
- type: custom:decluttering-card-plus
template: plain_tile
columns: 2
empty:
type: markdown
content: Nothing was on when the page opened.
for_each_from:
template: >-
{{ states.light | selectattr('state', 'eq', 'on')
| map(attribute='entity_id') | list }}

The template is rendered once, when the card is built, and not again as states change; a
reload renders it afresh. A list of entity ids gives each copy the same values an entity
sweep does. empty: is what shows when the list comes back with nothing in it.
To change: a list of mappings gives each copy the mapping’s keys, so a template can hand
over a name and a temp of its own working out.
See Repeating over a list a Jinja template works out.
33. A warning at the top of the dashboard when a template breaks (v2.9.0+) (sections)
You want to know when a card has lost its template or been left without a value, without opening an editor to find out, and you do not want anything there on a good day.
views:
- title: Home
type: sections
badges:
- type: custom:decluttering-card-plus-health-card
hide_when_clean: true

The badge counts the templated cards and badges on the dashboard that point at a template that is not there, leave a declared variable unset, or use a deprecated template. While there are none it takes itself away and the row closes up. Click it for the full list, with a button to open each card. The one above is counting a card whose template was renamed.
To change: dashboards: all counts every dashboard, and the same type as a card rather
than a badge lists the problems in full.
See The Health Card and Badge.
34. Checking YAML dashboards on every push (v2.9.0+)
Your dashboards are YAML files in a Git repository, and you want a misspelt template or step caught before it reaches Home Assistant.
# .github/workflows/dashboards.yml
name: Check dashboards
on: [push, pull_request]
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v4
with:
repository: tempus2016/decluttering-card-plus
ref: v2.9.0
path: dcp
- run: node dcp/bin/dcp-lint.js lint --format=github dashboards/
A template that does not exist fails the run; a misspelt step shows as a warning on the file in the pull request. Run on a folder with one of each, it prints:
::warning file=dashboards/home.yaml,line=2::[[room|titel]]: "titel" is not a transform, a lookup or a fallback this card knows, so the placeholder will show as written. (room_light.card.name)
::error file=dashboards/home.yaml,line=16::The template "room_lite" doesn't exist in decluttering_templates or in a custom:decluttering-template card. Did you mean "room_light"? (template: room_lite)
1 error, 1 warning, 1 info in 1 file · 0.2 s
To change: --format=text reads better on a terminal, and --format=json feeds another
tool.
See Checking Dashboards from the Command Line.
Shared templates
Finished templates other people have posted, in the Share your templates category. They install from the card editor’s Share tab, under Shared by others, or paste in from the post. By level:
Beginner
- Light tile with a brightness slider: one light, a toggle and a slider you can switch off
- Sensor with a graph of the last day: a sensor card with a line graph, hours as a variable
- Gauge with optional colour bands: a gauge whose green, amber and red bands switch on
- Button that runs a scene or script: a button for a scene, a script or a button helper
- Weather with a daily or hourly forecast: the forecast card with its usual choices as variables
- Thermostat tile with modes: a thermostat with its target and heating modes
- Cover tile with optional slider: a blind or garage door with open, stop and close
- Battery row with last report: an Entities row showing when a battery last reported
- Person badge with zone and time: where someone is, and for how long
- Now playing (hides when off): a media player card that shows only while something plays
Intermediate
- Which lights are on in a room: a live line of text counting and naming them
- History graph for the sensors you pick: one graph for as many sensors as you choose
- A button for every scene in a room: a grid of buttons that grows as scenes are added
- Who is home: a tile per person, with a switch to hide anyone away
- Energy used today and this month: two statistic cards from one meter
- Low batteries, live: the batteries below a level, following them as they change
- Doors and windows that are open: a red tile for each open one, with how long
- Everything playing in the house: a media card per player, shown only while it plays
- Navigation bar from your views: a bar that keeps up as views come and go
Advanced
- Everything one device has: an Entities card with every entity of a device
- Everything with a label, with the right controls: a card per label, each entity in the shape its domain asks for
- Room card built from an area: a heading with the room’s readings, then a tile for everything in it
- Every light, grouped by room: the whole house’s lights, a heading per room, in floor order