Minimalist UI - How to convert Centigrade to Fahrenheight within a label?

This code I have for a label won’t show up in the UI as there must be an error in it:

label: '[[[ return "Upstrs Hlwy: " + ((float(states["sensor.hallway_shelly_motion_2_temperature"].state) * 9/5) + 32) | round(1) + "°F" ]]]'

However, this works perfectly in Developer-> templates:

{{ ((float(states["sensor.hallway_shelly_motion_2_temperature"].state) * 9/5) + 32) | round(1) }}

FYI, this does not work either:

label: '[[[ return "Upstrs Hlwy: " + {{ ((float(states["sensor.hallway_shelly_motion_2_temperature"].state) * 9/5) + 32) | round(1) }} + "°F" ]]]'

But, this does work (but shows it in centrigrade!):

label: '[[[ return "Upstrs Hlwy: " + states["sensor.hallway_shelly_motion_2_temperature"].state + "°F" ]]]'

Strangely, I have the settings on the Shelly Motion 2 set to display in F but in code in HA it stil shows in C!

So how do I convert it within a label (as X * 9/5 + 32 is the correct formula) . Where is my syntax wrong?

Maybe float(value) does not work.
Try to use value|float instead

I tried, still no cigar. I was going to create state sensors that did the conversion and use those instead however upon a little more digging within the Shelley integration itself you can change them from Centigrade to Fahrenheit… When I said that I had them set to show Fahrenheit earlier that was actually within the Shelley app on an Android so this is a setting within HA itself within the Shelly integration.

To complete the answer: You cannot mix Javascript and Jinja. To convert C in F, use


[[[ return Math.round(states["sensor.hallway_shelly_motion_2_temperature"].state * 9/5 + 32); ]]]