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.