Hi all,
I have a custom field which returns the current weather conditions:
[[[
…
…
var temp = states['sensor.openweathermap_temperature'].state;
return `<ha-icon
icon='${mdi}'
style='width: 20px; height: 20px; color: var(--text-color-sensor);'>
</ha-icon>
<span
style='color: var(--text-color-sensor); vertical-align: -1px;'>
${w} bei ${temp}°C und einer<br>Niederschlagswahrscheinlichkeit von ${nied}%.
</span>`
]]]
I want the temperature to be displayed with 1 digit instead of 2, but having the same problem as described (and resolved) here.
How can I „translate“ the following solution code for use in my custom field?
{{ '%.2f'|format( states('sensor.outside_table_temperature')|float ) }}