Apply Template to several entities

I have a bunch of entities, measurement type, Sensor; all having a couple of decimal places, e.g. 123.987. I want to keep that precision, however, in my dashboard, I want to see only the integer-part, e.g. 123.

So, changing the display precision in UI is not what I want, as this changes the displayed precision throughout HA. Besides: I to not want rounding to be applied but really just get only the integer-part (e.g. “floor()”), e.g. I want 123 and not 124.

I created a template: {{ states('sensor.<my_sensor_name>') | round(0, "floor", default) }}

My question: is there a clever way to just save this template and “apply” it to several entities? Or do I have to create separate template sensors for every single entity where I want this “conversion”. I the latter: does this also affect database storage, i.e. is additional space occupied by the template sensors?

Thanks

You need to create one for every entity. Though you can use YAML anchors to assist with this.

Yes it affects database storage.

A better approach is to use the custom card multiple entity row. That way you don’t need to create new entities as it supports display precision per entity and you don’t need to add multiple entities on each row, you can just use a single one like the entities card.

The precision option is in the format option.