Skip to content

v1.12.0

Choose a tag to compare

@github-actions github-actions released this 08 Oct 16:31
· 41 commits to main since this release

A template card hidden by its own visibility conditions no longer leaves an empty space in a sections view. This release also adds three ways to make a template depend on what a card passes it, plus a way to tweak one card without writing a new template.

Fixed

  • A hidden template card no longer keeps its place in a sections view. The card collapsed itself, but a section only frees a card's grid cell when the card tells Home Assistant it is hidden, and nothing did. So the empty cell stayed, and a section with nothing but hidden template cards stayed on the page and pushed the other sections off centre. Template cards now report hiding and showing the way inline cards do, so the cell closes up and an all-hidden section goes. Badges and cards inside stacks are covered too. (#153, fixes #152)

Added

  • A block emptied by optional placeholders is now removed as well. [[name?]] already took its own key out. The block it sat in stayed, so features: [{type: '[[light_type?]]'}] with no light_type gave the card features: [{}]. Now the empty item goes, then features, and so on upward. A block written empty in the template, or one with anything else left in it, stays as it is. (#144, from discussion #141)

    features:
      - type: '[[control?]]'   # no control, no features
  • bool turns a variable into a real true or false. A card reads the word "false" as switched on, so options like hide_state or enabled could not be driven from a variable before. [[compact|bool]] gives true for yes, on, 1 and anything else with something in it, and false for no, off, 0, empty or unset. (#145, from discussion #142)

    hide_state: '[[compact|bool]]'
  • if: keeps a value only while another variable says so. [[name|if:other]] keeps it while other is a yes, and [[name|if:other=text]] while other is exactly that text. When the condition fails the value counts as unset, so ? drops it and a default: after it still applies. It lets mappings and lists through whole, so one card can choose which list items it gets. (#151, from discussion #150)

    color: '[[colour|if:mode=night|default:amber]]'
    features:
      - '[[toggle|if:controls?]]'
  • A card's own card: block is laid over what its template builds. Changing one card's icon or tap action no longer needs a new template or an extends: child. Mappings merge key by key, lists replace, and null removes a key the template sets. Placeholders inside the block are taken literally. It applies to every copy of a repeat, and the editor's preview and Eject include it. (#146, fixes #143)

    type: custom:decluttering-card-plus
    template: room_light
    variables:
      - light: light.kitchen
    card:
      icon: mdi:light-flood-down
      color: teal

Upgrading

No action needed. The one change to existing output is that a block emptied by optional placeholders is now removed instead of being left as [{}] or {}. If you had moved visibility onto the card itself to avoid the gap a hidden template card left in a section, you can put it back in the template.

Docs: Variables, Using Templates, Visibility.

Full changelog: v1.11.0...v1.12.0