eg_bz_thermostat_soll.label = eg_bz_thermostat_ist.state.toString() + " °C IST Temp-> Soll [%.0f °C]"
with e.g. this output: 21.84 °C IST Temp->Soll 23 °C
Now I want, that the first number is only with one comma display, also ’ 21.8 °C IST Temp->Soll 23 °C’
How can I do this?
Thank you!
This show me the item name ‘eg_bz_thermostat_soll’ from the output from sitemap.
I think I need a function, that concert the string “21.84” to a number, than format it to 1 comma-digit (“21.8”) and then convert back to a string and concatenate with the rest of the string (“°C IST Temp-> Soll”)
It is possible?
eg_bz_thermostat_soll.label = String::format("%.1f", (eg_bz_thermostat_ist.state as DecimalType).floatValue()) + " °C IST Temp-> Soll [%.0f °C]"
If the output is not what’s expected then add Grad. like below.
eg_bz_thermostat_soll.label = String::format("%.1f", (eg_bz_thermostat_ist.state as DecimalType).floatValue()) + " Grad." + " °C IST Temp-> Soll [%.0f °C]"