I want share with you my new milestone, but in this case is not strictly related to script problem, but a data flow, here my question in detail:
My data comining from Serial Port Com1 about 15/20 seconds, but the interval is every 6 second, I show you:
<msg><src>CC128-v0.11</src><dsb>01591</dsb><time>20:04:02</time><tmpr>23.1</tmpr><sensor>0</sensor><id>00077</id><type>1</type><ch1><watts>00301</watts></ch1></msg>
<msg><src>CC128-v0.11</src><dsb>01591</dsb><time>20:04:08</time><tmpr>23.1</tmpr><sensor>0</sensor><id>00077</id><type>1</type><ch1><watts>00300</watts></ch1></msg>
<msg><src>CC128-v0.11</src><dsb>01591</dsb><time>20:04:14</time><tmpr>23.1</tmpr><sensor>0</sensor><id>00077</id><type>1</type><ch1><watts>00303</watts></ch1></msg>
<msg><src>CC128-v0.11</src><dsb>01591</dsb><time>20:04:20</time><tmpr>23.1</tmpr><sensor>0</sensor><id>00077</id><type>1</type><ch1><watts>00310</watts></ch1></msg>
<msg><src>CC128-v0.11</src><dsb>01591</dsb><time>20:04:26</time><tmpr>23.1</tmpr><sensor>0</sensor><id>00077</id><type>1</type><ch1><watts>00303</watts></ch1></msg>
<msg><src>CC128-v0.11</src><dsb>01591</dsb><time>20:04:32</time><tmpr>23.1</tmpr><sensor>0</sensor><id>00077</id><type>1</type><ch1><watts>00299</watts></ch1></msg>
I get my data with this script, every 5 second and put the result in a RRD DB
Code: Select all
@echo off
set RIGA=
for /F %%a in ('tail -n2 CurrentCostXml.xml ^| find "<watts>"') do call set RIGA="%%a"
set TEMP=%RIGA:~71,4%
set WATT=%RIGA:~104,5%
rrdtool update powertemp.rrd N:%WATT%:%TEMP%
But the result is wrong because data coming every 15/20 second, so I read for 15 second the same result because is not updated
How can I read every 5 second the real last raw?
20:04:02 00301
20:04:08 00300
20:04:14 00303
20:04:20 00310
20:04:26 00303
20:04:32 00299
Thanks in advance and regards