[SOLVED] Parse file and make items

Ok so:

rule "Get weater station data"
when
    Time cron "1 * * ? * * *" // Every minute at 1 second past
then
    executeCommandLine("cp /home/pi/CumulusMX/realtime.txt /etc/openhab2/html/realtime.txt", 5000) //Copies the file into the html shared folder
    Thread::sleep(500) // give time for the system to copy the file
    val String rawWeather = sendHttpGetRequest("http://localhost:8080/static/realtime.txt")
    logInfo("RAW DATA", rawWeather)
    val weatherArray = rawWeather.split("_")
    Pressure.postUpdate(weatherArray.get(10))
    ...
end
2 Likes