Rules, Items and Sitemap

Hello at all :slight_smile:

i just started with openhab 3 days ago and i tried an example:
enter link description here

It shows me the whole Data-String but not the weight and temperature separately how it should…
Can somebody help me please?


rule "Arduino"
Item Arduino received update
var String ArduinoUpdate = Arduino.state.toString.trim
var int weightStartsOn = ArduinoUpdate.indexOf(“weight:”) + “weight:”.length
var String weight = ArduinoUpdate.mid(weightStartsOn, ArduinoUpdate.indexOf(’_’)-weightStartsOn)

  var int temperatureStartsOn = ArduinoUpdate.indexOf("temperature:") + "temperature:".length
  var String temperature = ArduinoUpdate.mid(temperatureStartsOn, ArduinoUpdate.indexOf(';')-temperatureStartsOn)


String Arduino “Arduino [%s]” (arduino) {serial="/dev/ttyACM0"}
String Arduino_weight "Weight [%s]"
String Arduino_temperature “Temperature [%s]”

sitemap demo label=“demo”
Frame label=“Data” {
Text item=Arduino
Text item=Arduino_temperature
Text item=Arduino_weight

What’s the whole Data string? Maybe there is more than one underscore in it…

Hello Udo_Hartmann,

i found my mistake :sweat_smile: i haven’t known that the .items; .rules; .sitemap have to be the same name…
Sorry for that stupid beginner mistake and thank you for your try!!!

There is no such restriction in openHAB, in fact I have more than one .items file and even more than one .rules file, and they all work together in harmony :slight_smile: The only restriction I remember is, the sitemap file name should consist to it’s name within the file.