Im trying to convert temperature readings from a 433MHz-device. I have a rule by AndrewZ as a model:
val Functions$Function1<Number, BigDecimal> convertTemp = [ tempData |
if (tempData < 32768) { tempData/10 }
else { (32768 - tempData)/10 }
]
rule "Temperaturkonvertering 1"
when
Item utetemp1_raw changed
then
var String tempHex = utetemp1_raw.state.toString
var int tempDec = Integer::parseInt(tempHex, 16)
utetemp1.postUpdate(convertTemp.apply(tempDec))
end
Unfortunately it doesn’t work and I get the following error:
An error occurred during the script execution: Could not invoke method: org.eclipse.smarthome.model.script.actions.BusEvent.postUpdate(org.eclipse.smarthome.core.items.Item,org.eclipse.smarthome.core.types.State) on instance: null
Help appreciated!