How to display a substring of a attribute value in the entities card

For all of my shellies I am displaying a firmware version attribute value in the entities card.
It works Ok, but the string is a very long one, something like this: 20210318-135942/v1.10.0-geba262d.
I want to display only a substring of it, like: “v1.10.0” so I can quickly check which firmware is loaded on which shelly.
I don’t know if its possible and how, googling didn’t help me find answers.
Any help appreciated.

You’ll need to set up a template sensor for each, unfortunately. Then:

{% set a="20210318-135942/v1.10.0-geba262d" %}
{{ (a.split("/")[1]).split("-")[0] }}

will give a = v1.10.0.

I was hoping not to use the template sensors for each one, but obviously it’s the only solution, so will do it.

I am not that familiar with templates, but with your initial template I have managed to get the attribute value in it, so let me do the hard manual work.
Thanks for the hint!

1 Like