Arduino data won't post data on sitemap/chart

Hi,

I’m trying to create a chart/graph using the data sent by an Arduino. The warning code, items, sitemap and rules config is below.

Data is updated on events.log but the data won’t show on the sitemap (i.e. if Arduino sends a value 20, the sitemap doesn’t show the number 20, it remains blank). Chart also doesn’t show up.

The warning code:
2016-04-19 15:52:28.657 [ERROR] [o.o.c.s.ScriptExecutionThread ] - Error during the execution of rule ‘Arduino sends to Openhab’: Could not invoke constructor: java.lang.Integer.Integer(java.lang.String)
2016-04-19 15:52:28.701 [WARN ] [o.o.u.w.i.render.ChartRenderer] - Chart cannot be rendered as item ‘Weight’ does not exist.

Items:
String Arduino “Arduino [%s]” (arduino) {serial="/dev/ttyACM0"}
Number Weigth “[Weight %s]” (arduino)

Sitemap:
Text label=“Arduino” item=Arduino
Chart label=“Weight” item=Weight period=h refresh=2000

Rules:
rule "Arduino sends to Openhab"
when
Item Arduino received update
then
var Integer Weight = new Integer(Arduino)
Weigth.sendUpdate(Weight)
end rule

The Chart problem may be related to using “Weight” in some places and “Weigth” (mispelling?) in others.

It was, I don’t know how I missed that.
Anyway, I have the chart but I am still unsure as to why the Arduino String won’t post its data on the sitemap

Well, it’s because of the error in the log about the Integer constructor. I use the JSR223 rules rather than Xtend so I can’t help much with that. However, you might try “Integer::parseInt(Arduino)” instead of “new Integer(Arduino)”. I’d also be careful about naming your var (variable) the same name as the item since that might confuse the rule language. Good luck!

1 Like

Will look into it, Thanks