github iantrich/config-template-card 2.1.0-b1

latest releases: 2.3.0, 2.2.0, 2.1.2-b1...
pre-release7 days ago

The first beta of 2.1.0. It brings in community work from the 1.3.7 beta era that couldn't be merged as it was, rebuilt on 2.0. Please try it and report back. The README covers every new feature.

New

  • View-wide variables and shared entities (#216). config_template_card_vars and config_template_card_staticVars can be set on a view as well as the dashboard. config_template_card_entities at either level is added to every card's watch list, so cards there can leave out their own entities. Variables load dashboard, then view, then card.
  • Async templates (#215). Templates and variables can return Promises, for example from hass.callWS. await works in a template expression, such as ${(await getFavorites()).map(...)}. While waiting, the card keeps showing its previous render.
  • Static variables (#214). staticVariables (and dashboard or view config_template_card_staticVars) are evaluated once when the card loads, and read as svars or by name. They're useful for values that don't change or are expensive to compute.
  • config and output template variables (#213). config is the card's own configuration (config.card.entity, custom top-level keys, !secret values in YAML dashboards). output is the inner card config built so far (output.entities.length). Closes #160.
  • $! prefix (#211). Passes a value through as plain text, for ${...} meant for an inner card's own templating.
  • Build artifact on every PR (#210). Testers can download a pull request's config-template-card.js from its Build check.

Fixes

  • A broken template no longer blanks the card (#212). The error is still logged. A whole-value template becomes null, so the inner card uses its default, and a template inside a string becomes <error>.
  • Config-template-cards fill the height of horizontal stacks and grids (#209). Before, they could look shorter than the cards next to them.

Behavior changes to check

  • Template errors (#212): a config with a broken template now shows the card, with null or <error> in place of the broken values, instead of a blank card.
  • Variable order (#216): with view-wide variables, the order is dashboard → view → card. If you use list-style variables at more than one level, they're joined in that order in vars.

Thank you

  • @PaulSD for the design and code behind async templates, static variables, config/output, the $! prefix, error handling and the CI artifact (#159).
  • @malmeloo for the original async templates work (#149).
  • @Triple-S for view-wide variables and shared entities (#171).
  • @ildar170975 for the stack/grid height fix (#158), the docs (#163–#169) and the config request (#160).

Installing

Enable beta versions for Config Template Card in HACS / Marketplace, update to 2.1.0-b1, then clear your browser or app cache. The console should show Version 2.1.0-b1.

Don't miss a new config-template-card release

NewReleases is sending notifications on new releases.