Stop HA from removing decimal places/rounding numbers?

I’m setting up my home theater. I have all my movies on a media server, and I’ve edited the filenames to include the aspect ratio as the last four characters (ie “Barbie (2023) - 2.00.mkv”, “Two Thousand One A Space Odyssey (1968) - 2.21.mkv”, “Matrix, The (1999) - 2.40.mkv”, “Koyaanisqatsi (1982) - 1.85.mkv”).

When playback starts, my server sends a webhook to HA, and I have a dropdown selector with options for each potential aspect ratio, which sets itself to the last four characters of the filename:

action: input_select.select_option
        metadata: {}
        data:
          option: '{{ trigger.json.PlaybackInfo.MediaSource.Path[-8:-4] }}'
        target:
          entity_id: input_select.aspect_ratio

I then have an automation that, when this dropdown is changed, alters the aspect ratio of my projector.

It works fine for 2001 and Koyaanisqatsi, but it fails with Barbie and The Matrix because the results returned are “2” and “2.4” respectively, which aren’t valid options in the dropdown.

How do I get it to stop removing the zeroes after the decimal? Every result I can find in search is people who have too many decimal places and want to get rid of them, which is the opposite problem.

The easiest fix would be to change the options in you Input select. You could either remove the characters that are causing the issue or add a non-numeric character to all the options, like “2.00x” instead of “2.00”, then you could just append the “x” in your template:

option: '{{ trigger.json.PlaybackInfo.MediaSource.Path[-8:-4] ~ "x"}}'

At the moment, the dropdowns and their associated scenes are referenced a number of times in a number of places, while the filename extraction is only called once. Changing the filename extraction is going to be much, much easier.