I’m trying to round my temperature to the lowest tenth of temperature (27.1 -> 20 and 31.2 -> 30).
Item is:
Number sw_leiliruum_temp3 “Sauna Up [%.2f °C]”
From influx when i get last value from influx i do get the desired result - 20 (last is 27.0)
val Number lastSaunaTemp = (sw_leiliruum_temp3.previousState(true, “influxdb”).state)
val int lastYmardus = Math::round((lastSaunaTemp.longValue / 10) * 10).intValue
But the problem is when i trie to do the same with current temperature.
The result is 30 (temp is same - 27.1).
val calculatedCurrTemp = (Math::round((sw_leiliruum_temp3.state as DecimalType).floatValue()/10) * 10)
logInfo(“saun”, "calculatedCurrTemp: " + calculatedCurrTemp.toString)
I’ve tried different approaches and reading a lot of forum posts - but it’s still the same
I’m quite sertain it has something to do with conversions … but i can’t figure it out
Can someone help … ?