I am basically looking for help for googling on how to use templating… There are multiple different templating options, and I often google wrong things. So few basic questions:
How to know which configurations are templatable (e.g. “entity_id:”)?
When templating the line must end with some special character(s), such as >, >-, |, |-. When to use which one?
How to know which templating syntax can/should be used? Such as:
- [[[ return value; ]]]
- {{ value }}
- expression {{ value }}
- {{ value_if_true if (boolean, true) else value_if_false }}
- {% if boolean==true %} value_if_true {% else %} value_if_false {% endif %}
Currently I’m trying to hide an entity in apexchart conditionally and apparently nor stroke_width or in_chart can be templated at all. I guess. In github readme’s there are occasionally some examples on templating, but no list of configurations that can be templated in the first place. It is slightly time consuming to try all different expressions (in question 3) using all different special characters (in question 2). Especially just to conclude that none of them works.
I don’t even know if some of the syntaxes in question 3 are actually the same. Just names for them would help googling (e.g. javascript, CSS, SCSS)
One important point is that almost none of the basic core cards allow templating of any kind, so the answer to your “basic questions” may vary from one card to the next, as the developers of custom cards can do pretty much whatever they want.
The only definitive source of truth will be the repository docs provided by the developer.
The ones using curly braces are Jinja. This in the template engine used by Home Assistant so it is probably the more common type used in custom cards.
The ones that use triple square brackets are Javascript Templates, most commonly seen in Custom Button card, but there may be other cards out there using them.