I use sbfspot (https://sbfspot.codeplex.com/) together with the following rule which reads the last line of the csv file and uploads to pvoutput. Not very elegant but it works.
rule "PV uitlezen"
when
Time cron "0 0/5 5-23 * * ?"
then
executeCommandLine("/home/pi/SBFspot/SBFspot.sh > /dev/null")
var String PVd = String::format( "%1$tY%1$tm%1$td", new Date() )
var String PVt = String::format( "%1$tH:%1$tM", new Date() )
var String smaspotlogfile = String::format( "/home/pi/smadata/%1$tY/ni-lo-pv-Spot-%1$tY%1$tm%1$td.csv", new Date() )
val fileReader = new java.io.FileReader(smaspotlogfile)
var String line
var String nextline
try {
val values = new java.io.BufferedReader(fileReader)
nextline = values.readLine
while (nextline != null) {
line = nextline
nextline = values.readLine
}
}
finally {
try { fileReader.close() } catch (Exception e) {}
}
var String[] pvbuffer = line.replace(",",".").split(";")
postUpdate (PVPac1, Float::parseFloat(pvbuffer.get(10)))
postUpdate (PVIac1, Float::parseFloat(pvbuffer.get(13)))
postUpdate (PVUac1, Float::parseFloat(pvbuffer.get(16)))
postUpdate (PVEtoday, Float::parseFloat(pvbuffer.get(22)))
postUpdate (PVEtotal, Float::parseFloat(pvbuffer.get(23)))
postUpdate (PVFreq, Float::parseFloat(pvbuffer.get(24)))
postUpdate (PVPdc1, Float::parseFloat(pvbuffer.get(4)))
postUpdate (PVIdc1, Float::parseFloat(pvbuffer.get(6)))
postUpdate (PVUdc1, Float::parseFloat(pvbuffer.get(8)))
postUpdate (PVPdc2, Float::parseFloat(pvbuffer.get(5)))
postUpdate (PVIdc2, Float::parseFloat(pvbuffer.get(7)))
postUpdate (PVUdc2, Float::parseFloat(pvbuffer.get(9)))
postUpdate (PVConditie, pvbuffer.get(28))
postUpdate (PVTemp, Float::parseFloat(pvbuffer.get(30)))
var String v1 = (PVEtoday.state as DecimalType * 1000).intValue().toString
var String v2 = (PVPac1.state as DecimalType).intValue().toString
var String v5 = String::format("%.1f", (PVTemp.state as DecimalType).floatValue())
var String PVOutputGET = "http://pvoutput.org/service/r2/addstatus.jsp?key=xxxxx&sid=xxxxx&d=" + PVd + "&t=" + PVt + "&v1=" + v1 + "&v2=" + v2 + "&v5=" + v5
logInfo("PV-GET",PVOutputGET)
sendHttpGetRequest(PVOutputGET)
end
with the following sbfspot.sh
#!/bin/bash
/usr/local/bin/sbfspot.3/SBFspot -nosql