Can someone help me to round a decimal value to an integer.
My value is a decimal value like 14.00. I got it from the weather binding.
Here is how I get the value:
var Number min = WUTempExtMin.state as DecimalType
What would be the code in a rule to get an integer ?
var int min = ...
It’ll be of the form:
var int min = (WUTempExtMin.state as DecimalType).intValue()
Thank you, I will try that.
[quote=“guessed, post:2, topic:186400”]It’ll be of the form:
var int min = (WUTempExtMin.state as DecimalType).intValue()
[/quote]
And for a rounding:
var int min = (WUTempExtMin.state as DecimalType + 0.5).intValue()
LOL, of course I forgot round vs trunc Thanks for confirming it’s working correctly.
How are the rest of your openHAB efforts going?
EDIT: I split out the subsequent discussion on openHAB Conversion, Co-existence and Augmentation since it’s of broader interest.