| int and | round() in template give a result with one decimal?

I have a fairly complex template that yields a result of 17.046558833 (just an example) which is saved to an input_number. I now need the result to be an integer because I am going to use it in a tts to my alexas and on a lovelace page.

I have tried both | int and | round() at the end of my template and both give me a result of 17.0, not 17. If I use the template editor and enter 17.04655 and either | int or | round(), the result is 17 not 17.0.

Don’t understand why this is happening. Is there a “work around”?

Try:

{{ '%0.0f'|format(Your_number_here) }}

I was saving the result in an input_number. I changed to save the result in a VAR (HACS) and now both int and round() give me an integer.

Must be something in the input_number code that insists on one decimal…which sounds like a bug…but I’m not going to report it…

input_number is a float. Probably why you get one decimal.