Skip to content

v1.2.0

Latest

Choose a tag to compare

@github-actions github-actions released this 21 Aug 11:54
· 6 commits to main since this release

A template that used itself froze the browser tab, and [[entity|friendly_name]] never worked inside a repeat — both are fixed. The rest of the release is about repeats knowing what is inside what they repeat over, so "a tile per room listing that room's lights" stops being a card per room written by hand.

Fixed

  • A template whose card used that same template froze the tab. There was no guard of any kind. Every level built the next one while it was still detached from the page, so nothing in the layout ever got the chance to stop it — tested against a real dashboard, the tab stopped responding and had to be killed. Two templates using each other did the same. A card now refuses and names the path round the loop: the template "room_tile" uses itself (room_tile → room_tile), which would never finish. (#62)
  • [[entity|friendly_name]] never worked inside a repeat. A template that asks Home Assistant for something has to be built again once the registry arrives, because the first build happens before hass is ever set. That was only ever recorded for templates rendered once, so every copy of a for_each kept the brackets on screen permanently. Found while screenshotting a card per room for the wiki: the rooms had names, the lights inside them did not. (#77)
  • A template name that does not exist now offers the closest one that does — nearly always the typo or the rename you are looking for. Capped at two edits on a short name so it never points at something unrelated, and borrowed dashboards are included once they arrive. (#62)
  • A template defining two things says which two, instead of restating the rule. A repeat producing more than fifty copies says so once in the console — not an error, but a registry sweep matching half the house reads as a broken dashboard rather than a big one. (#62)

Added

  • with: gives each area copy the entities inside it. Repeating over areas used to hand you the room's name and nothing else, so the shape people actually build still meant writing a card per room. Each copy now gets items — the whole mappings, ready for a nested repeat — along with entities and entity_count. A room with nothing in it is dropped unless you set keep_empty: true. (#65)

    type: custom:decluttering-card-plus
    template: room_summary
    for_each_from:
      areas: true
      with:
        domain: light
    columns: 3
    # room_summary draws the heading, then repeats a second template over that room's lights
    card:
      type: vertical-stack
      cards:
        - type: markdown
          content: '### [[area]] — [[entity_count]] lights'
        - type: custom:decluttering-card-plus
          template: light_tile
          for_each: '[[items]]'
  • exclude: says what a repeat should leave out, and wins over what was taken in — so "every light except those three" is one line rather than a list of everything you did want. Written as patterns it means entity ids; written as a mapping it narrows by anything the source itself can. (#64)

    for_each_from:
      domain: light
      exclude: light.bedside          # or: exclude: { area: Bedroom }
  • More ways to narrow, order and cap a repeat. (#64)

    Key Does
    device_class Motion sensors but not door sensors — a domain on its own is too coarse
    integration Only what one integration provides
    sort / reverse name, entity, id, area, domain, floor. Anything else keeps the registry's own order
    limit At most this many copies. Every copy still carries total, what matched before the limit, so a card can say "showing 5 of 23"
    range Repeat a fixed number of times, with only the position to go on
    empty A card to draw when nothing matches — silence otherwise looks the same as breakage
  • Placeholders can say what to do when nothing sets them. [[name?]] takes the option out of the card entirely, which is right when it should not be there and wrong when something should still be shown. default: supplies the text; or: names another variable; both chain with each other and with the transforms. A gap is unset, null or empty — a 0 and a false are values and keep their place. (#63)

    name: '[[name|or:entity|friendly_name|default:Unnamed]]'
  • Three more things to ask Home Assistant for: floor, and area_id / device_id — the ids underneath the names, which is what you want when building one entity id out of another, as binary_sensor.[[entity|area_id]]_motion does. Also json, the one step that takes a mapping or a list on purpose rather than refusing it, and dotted access so one for_each item can carry a room's light, sensor and icon together as [[room.light]]. (#63, #65)

  • The card editor counts what a repeat matches as you write it, and lists the first dozen. The registry filters were the most powerful thing here and completely invisible until you saved and looked, so a typo in an area name read as "this card is broken" rather than "nothing matched that". The template dropdown now shows each template's description beside its name. (#67)

  • The template editor can duplicate a template, reorder its variables, and start from a built-in library. It also warns when other cards use the template you have open — the Where used tab always knew, but only if you went and looked. The starters are carried in the card rather than fetched, so nothing reaches the internet. (#68)

  • A dashboard still on the original custom:decluttering-card names can be moved over in one press. They work as they are — this card answers to both — but they would stop working the day the original is installed alongside it, because Home Assistant loads resources in the order they were added. (#68)

  • debug: true renders what the card built instead of the card, which is what you want when it only misbehaves on a phone or in a view whose editor is awkward to reach. strict: true makes it refuse rather than render brackets, for a template you are handing to somebody else. (#66)

  • gap sets the space between repeated copies, and a template can declare grid_options once instead of every card using it repeating the same block. (#66)

  • The editors speak French, Spanish and Portuguese, following your Home Assistant language, and the console warnings are translated too. (#80, #81)

Changed

  • Every copy of a repeat now also gets index0, first, last and total alongside index and count.
  • The wiki is published as a site at https://tempus2016.github.io/decluttering-card-plus/, with the same pages and navigation, and republishes itself whenever a wiki page is edited. (#76, #78, #79)
  • The README is now a summary that points at the wiki, with a compatibility table and an honest note on when to reach for auto-entities or button-card instead. (#61, #69)
  • Every wiki heading added since v1.1.0 carries (v1.2.0+), so it is obvious what needs which version.
  • Repeating a row, badge or picture element is now refused with an explanation rather than a bare message — Home Assistant gives those one slot, so put what you want repeated in a card template.
  • CONTRIBUTING.md, SECURITY.md and a code of conduct, plus CodeQL and test coverage enforced in CI. (#69)

Upgrading

No action needed — nothing here changes existing configuration, and every new option defaults to today's behaviour.

If you have ever had a card render [[entity|friendly_name]] as literal brackets inside a for_each, that was the bug above, not your template: it will now resolve on its own.

There is a whole dashboard in examples/demo-dashboard.yaml that exercises most of this — paste it into a new dashboard's raw configuration editor and it renders, no edits needed.

Full changelog: v1.1.0...v1.2.0