I hear your cry…
Tbh, templating isn’t the best documented bit in HA, especially not what/which to use when, let alone how…Different types of entities, device_trackers, sensors, being template or not, and needing them to be in browser or server side.
these could have been done differently, I know, its just I had this working syntax at hand and copied it…
but thats the serverside part. which was all we had untill the custom UI came along.
i didnt even know there were templating possibilities on client side.
i guess you would normally first use the server side possibilities. and then if you run out of options you get the clientside possibilities.
in the first case you can reuse the variable in the second case not.
and the first case depends on the speed from the server and the second on the speed from the device showing it.