Custom sensor display precision without new sensor

Hey there. I’m curious if and how it is possible to create a custom display precision value for a sensor. I’m not able to figure it out with the other existing topics.

I have 10 gas station sensors from my area. These are listed at 1,969€, for example. The 9 at the end is unimportant. The problem is that the price can only be rounded up with the automatic options of Home Assistant. But I want that the number is simply truncated and 1.96€ comes out.

I know that the template must look like this:
"{{value | round(2, 'floor')}}"

I tried to put it in customize.yaml as value_template, but that doesn’t work.

Assuming this sensor is discovered and not defined in yaml, then no this is not possible. You would need to create a new sensor.

Yes, the sensor is given by the integration Tankerkönig. This hurts. Such a feature would be nice to have.

It’s a pretty uncommon requirement to have a sensor truncated rather than rounded so this is unlikely to be picked up but you could request it here:

A more likely feature request to be implemented would be to ask for a general value_template in the UI for discovered sensors. I’d vote for that.

1 Like