I would just like to change the string variable sent by an arduino to be changed to an integer (preferably a decimal value) so that I can use it in a chart/graph. I get an error stated below and the libraries and rules i currently have are under the rules section below as well.
error:
2016-04-19 17:58:07.893 [ERROR] [o.o.c.s.ScriptExecutionThread ] - Error during the execution of
rule ‘Arduino sends to Openhab’: Could not invoke method: java.lang.Integer.parseInt(java.lang.String) on instance: null
rule "Arduino sends to Openhab"
when
Item Arduino received update
then
var Integer newWeight = Integer::parseInt(Arduino)
Weigth.sendUpdate(newWeight)
end rule
Note: While the Rule’s Domain Specific Language (DSL) uses the Xtend syntax it is not Xtend and does not support the full range of Xtend language features (e.g. no arrays or classes).
Examples: On the wiki (bottom of the page) and in this forum.
The DSL is able to import and use Java language features and the documentation for those will be on Oracle’s Java API website or the library’s website (e.g. Joda is here).
I also forgot to mention that using Designer and <ctrl><space> is also a key way to discover the language as you type. For example if you can type now.minus<ctrl><space> and a dialog will pop-up with all the valid ways to complete the the statement which will tell you all the methods on now that start with “minus”.