Temperature only xx and not xx.xx

I have a small question. I have a temperature which numbers are xx.xx and I want my saycommand only uses xx. How do I do it ??

item part

Number Temperatur_Udebygninger_Udv “Temeratur udenfor [%.1f °C]” { channel=“zwave:device:b277fbae:node10:sensor_temperature3” }
Rules part

rule "Sonos play url test"
when
Time cron “0 49 18 ? * MON-FRI”

then
setMasterVolume(new PercentType(70))
say(“Temperaturen udenfor er”+ Temperatur_Udebygninger_Udv_Sonos.state + “grader” )

end

You need to format the number, as you already do it in the items file.
I would initially try to make the correct string. Use a
logInfo (“MyLogInfo”,“MyNewString:{}”, MyNewString)

to check wether the string is correct, then you can use it with the say command.

Sorry I don’t know what you mine I am new I openHAB can you try again with more info on what I most do

You could do it like so:

say("Temperaturen udenfor er"+ String::format("%f", (Temperatur_Udebygninger_Udv_Sonos.state as DecimalType).floatValue()) + "grader" )

by changing the “%f” part, you can change the decimals. “%.2f” will give you a xx,xx readout, so “%f” should give you a “xx grader” type readout
HTH,
Regards,
-OLI

1 Like

It became suddenly very cold in Denmark sonos says is it - 2 millions and 730 thousand degrees could

what do i need to change:-)

Why don’though read this thread String formatting
In there you’ll find how to format a string out of a number showing only the digits.

1 Like

it has to be “%.0f” :slight_smile: :slight_smile:

Thank you very much for your help