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_varsandconfig_template_card_staticVarscan be set on a view as well as the dashboard.config_template_card_entitiesat either level is added to every card's watch list, so cards there can leave out their ownentities. Variables load dashboard, then view, then card. - Async templates (#215). Templates and variables can return Promises, for example from
hass.callWS.awaitworks 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 viewconfig_template_card_staticVars) are evaluated once when the card loads, and read assvarsor by name. They're useful for values that don't change or are expensive to compute. configandoutputtemplate variables (#213).configis the card's own configuration (config.card.entity, custom top-level keys,!secretvalues in YAML dashboards).outputis 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.jsfrom 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
nullor<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
configrequest (#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.