I noticed however that many users struggle with setting up template sensors. I myself find it much easier and much more fun to use Node-RED, so I decided to share and explain my setup for those who are interested:
In my case I render a single sorted glance card using custom entity nodes to change state and picture:
with a sequece like this:
I hope this is useful for others also. Feel free to leave a comment if you have questions or remarks.