Remove decimal in gauge

I am trying to remove a decimal as I want to have rounded percentages. I’m retrieving values for a device between 0.1 and 1.0.

As template_value I’m using:
value_template: "{{ states('sensor.homey_mechanisch_vent') | float * 100 | int }}"


I tried various functions like


, but every time the .0 appears. Is there a way to have this fixed?

Take a look here:

does this work

{{ states("sensor.homey_mechanisch_vent")|int }}

1 Like

Of course this page was the first thing I looked at, especially the priority of operators but I couldn’t get it fixed after some attempts.

Thanks, but it does not work this way. :slight_smile:

Try it with

value_template: "{{ (states('sensor.homey_mechanisch_vent') | float * 100) | int }}"

Like the docs say, your template calculates a float * (100 | int) and that returns a float.

EDIT: You can play with it in Dev Tools/templates.


That did the trick! Those damn parentheses :slight_smile: And I also did not know you could play around in Dev Tools. I was reloading the config each time. Thanks!