I guess not as the docs specifically mention templates for the content but not for the title. If someone knows a trick, let me know.
Instead of using the “title” parameter, create you own in the markdown. Here is an example of a template in the title of a markdown card
type: markdown
content: >-
## Lights On [<ha-icon
icon=mdi:lightbulb></ha-icon>](/climate-and-temperatures/lights) {{''}}
({{states('sensor.power_calc_lights_power')|int()}} w)
<font color = 'blue' >
{% set lights = ['light.all_basement_lights'] %}
{{ expand(lights) | selectattr('state','eq','on') | list | count }} basement
lights {% set lights = ['light.all_main_floor_lights'] %}
{{ expand(lights) | selectattr('state','eq','on') | list | count }} main floor
lights {% set lights = ['light.all_second_floor_lights'] %}
{{ expand(lights) | selectattr('state','eq','on') | list | count }} second
floor lights {% set lights = ['light.all_outdoor_lights'] %}
{{ expand(lights) | selectattr('state','eq','on') | list | count }} outdoor
lights
If you are interested, I believe you can use a for-loop to reduce the template to this:
type: markdown
content: >-
## Lights On [<ha-icon
icon=mdi:lightbulb></ha-icon>](/climate-and-temperatures/lights) {{''}}
({{states('sensor.power_calc_lights_power')|int(0)}} w)
<font color = 'blue' >
{%- for light in ['light.all_basement_lights', 'light.all_main_floor_lights',
'light.all_second_floor_lights', 'light.all_outdoor_lights'] -%}
{{ expand(light) | selectattr('state','eq','on') | list | count }} {{ light.replace('_', ' ')[10:] }}
{% endfor -%}
1 Like