getting value from last line in a logfile
-
Hi,
I have an inverter for my solar panels.
There is a log file that is written with the actual value of that moment.
The problem is that the file is written for one day and the new value is the last line of the file.
i want to read out the file and have the last value what is teh actual value on that moment displayed on my view, so it must be turned in to a data point.any suggestions ?
this is how the file looks like:
W
-10496
mnuPower63580756887;6,10
63580756947;6,91
63580757007;5,83
63580757067;5,282 minutes later
W
-10496
mnuPower63580756887;6,10
63580756947;6,91
63580757007;5,83
63580757067;5,28
63580757127;5,832 minuts later
W
-10496
mnuPower63580756887;6,10
63580756947;6,91
63580757007;5,83
63580757067;5,28
63580757127;5,83
63580757187;6,37i want to have the last value in this case 6.37 in my data point
thanks in advanced
-
Hey sprokkie,
You could use some regex like this:
http://rextester.com/tester/RQZA31460
To match the value, but not sure how you would get the last occurance.
You have a SMA inverter right? You might be able to buy a cheap speedwire card for it, which would give you a Modbus TCP/IP interface, which would work much better with Mango. You could also then monitor some other parameters too.
-
Hi Jeremyh.
The sma inverter is not a problem, sunnydata explorer has a online function, i read the xml file with a http retriever.
That online file is refreshed with new data each 2 minutes.
I use the modbus for reading out a cheap kwh meter i purchased on alieexpress.com. that works realy fine.
That kwh meter is conencted between the phillips evo inverter.The lof file reading that is not working is for a new power-one pvi 2000 inverter. power one is now part of ABB.
The log file is cummulating during the day.
So i am only interested in the last line written. -
Found it !!
the expression in mango:
;(.*?)$
The $ on the end did the trickon the rextester it is:
([0-9],[0-9][0-9]*.?$) -
Hey Sprokkie, that's great, and thanks for posting your solution - handy trick which will probably come in useful to me! I thought I would try that myself so I know how to do it in future. I have made a file the same as yours on my server:
But my point does not read any value from the file.
Can I ask what values you put for Point Identifier, Point Identifier Index, and Value Index?
-
The data source is http retriever.
I made a junction link between the directory where the logfile is written and a directory in the mango web directory,
so the data in the mango/web/system is the same as in programfiles/auroracommunicator/system.
The auroracommunicator/system is the directory where the inverter software puts the logfiles.junction links are easily made with junction link magic : http://www.rekenwonder.com/linkmagic.htm
the mango webdirectory is accessable with the http retriever.
Point the datasource to the ipaddress and port of youre mango server. ie http://192.168.100.1:8080/system/filename.extension now the file is accesable, i tried the 127.0.0.1 adres, that didn't work
the datapoint is like this:
this wil do the trick :)
now my next challenge put all seperate logfiles in 1 file with the actual value, otherwise i have to configure a data source and data point for each logfile