Use state_template on with entities cards

Hi guys,

As the title say I wuold like to use a entities card to use a state_template who define the output to show on the “right” side of the card. It’s something possible?

Not sure if I understand your question, but you can create a template sensor to display an entity state attribute. You can then use that newly-created entity in an entities card.

Hi I try to figure out by my self without any big success, I’ve those kind script on my lovelace custom card

{% if state_attr("sensor.waste", "days") == 0 %} Today {% elif
state_attr("sensor.waste", "days") < 7 %} In {% else %} Next Week {%
endif %} {{ state_attr("sensor.waste", "days") }} days

But I don’t get it how to put them into state_template. Could you give me a help?

If you create a template sensor with your desired output, you can use the resulting sensor in an entities card. You need this in your configuration.yaml:

  - platform: template

You can then add any template sensors under that. Once you restart home assistant, you’ll see a new sensor with your templated output. Make sure to use the /dev-template page to test your templates before creating the sensor.