Rules: which libraries do I needed?


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.

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

import org.openhab.core.library.type.*
import org.openhab.core.persistence.*
import org.openhab.model.script.actions.*
import java.lang.Integer.*

rule "Arduino sends to Openhab"
Item Arduino received update
var Integer newWeight = Integer::parseInt(Arduino)
end rule

var Integer newWeight = Integer::parseInt(Arduino)

should be

var Integer newWeight = Integer::parseInt(Arduino.state.toString)

where can I learn more about how to create these rules, more of the syntax?

Basic Rule Syntax

What Rules Can Do

Low Level Syntax

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).

Thank you, I was looking for those java/joda libraries.

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”.

Thank you