You create an item without any binding - and update this one with the offset in a rule.
rule "temperature update"
when
Item WindowTemperature changed
then
// give the ProxWindowTemperature item the state of the measured temperature with the offset (+10 in this example)
ProxyWindowTemperature.sendCommand(WindowTemperature.state + 10)
end
Number Outside "Draussen [%.lf°C]"(graphtemp){channel="zwave:device:9d2ecd6a:node23:sensor_temperature"}
Created new item
proxy.items
like:
Number Proxytmp
Number Proxytmp "Proxytmp [%.lf°C]"
New Rule:
rule "temperature update"
when
Item Outside received changend
then
// give the ProxWindowTemperature item the state of the measured temperature with the offset (+10 in this example)
Proxytmp.sendCommand(Outside.state + 10)
end
Log Error:
2018-02-22 17:20:09.056 [ERROR] [ntime.internal.engine.RuleEngineImpl] - Rule 'temperature update': An error occurred during the script execution: Could not invoke method: org.eclipse.xtext.xbase.lib.ObjectExtensions.operator_plus(java.lang.Object,java.lang.String) on instance: null
Proxytmp.sendCommand((Outside.state as DecimalType) + 2)
rule "temperature update"
when
Item Outside changed
then
// give the ProxWindowTemperature item the state of the measured temperature with the offset (+2 in this example)
Proxytmp.sendCommand((Outside.state as DecimalType) + 2)
end
Outside is a NumberItem but as far as the Rule is concerned it is an Item until you tell it otherwise. And Item returns the state as a State. You can’t do math with just a State.
Usually, the Rules Engine is smart enough to say “hey state, do you understand +?” and the state object will say “yes” or “no” (in which case an error is thrown). But sometimes the Rules Engine fails to ask the question or gets a “no” for an answer erroneously. I’ve not been able to determine a pattern for when it works and when it fails.
If you would rather avoid the times when it fails work right automatically, you can just always cast it though I would cast it to Number, not DecimalType because there are some cases where DecimalType itself can cause some Type problems, in particular when one tries to use it with the sendCommand or postUpdate methods on a Item.