Someone wants to test the folowing





Cumulative raingraph (sort of)
This is only tested with fake data, as we didn't get much rain, and no rain in the forecast for the next days.
create rainlogger.html with folowing contents:
Code: Select all
[actual_localdate] [day1_rain0_total_mm]
Next run folowing shell-script every 5 minutes with cron:
Make it executable: chmod +x rainlogger.sh
Code: Select all
#!/bin/bash
hour=`date +%H`
minute=`date +%M`
mydate=`date +%Y%m%d%H%M%S`
if (( ($hour == 00) && ($minute < 10) )); then
echo "$mydate 0.00" >> /data/weather/rainlog-min5
else
wget -O /var/log/rain "http://127.0.0.1/meteohtml.cgi?file=rainlogger"
cat /data/weather/rainlog-min5 /var/log/rain > /var/log/temprain
mv /var/log/temprain /data/weather/rainlog-min5
fi
Next thing to do is creating the actual graph (you cannot use meteohub for it)
Last 24 hours example:rain-L24.sh
Code: Select all
#!/bin/bash
sleep 2
mydate=`date +%Y%m%d%H%M%S`
yesterday=`date --date='1 day ago' +%Y%m%d%H%M%S`
titledate=`date +%Y-%m-%d`
mytitle="Precipitation ($titledate)"
/usr/local/bin/gnuplot << EOF
#
set terminal png 10 size 610,250
set output "/data/uploads/rain-L24.png"
set title "$mytitle"
set grid
set timefmt "%Y%m%d%H%M%S"
set xdata time
set xrange [ "$yesterday":"$mydate" ]
set yrange [0:30]
set format y "%0.0f mm"
set xdata time
set format x "%H:%M"
plot '/data/weather/rainlog-min5' using 1:2 with steps lw 2 lt rgb "blue" title "rain"
reset
quit
EOF
If you use /data/uploads/ as the folder you write your graph,
meteohub takes care of the upload.
My crontab
I have these on the first lines
Code: Select all
#own scripts
*/5 * * * * /data/scripts/rainlogger.sh > /dev/null 2>&1
*/5 * * * * /data/scripts/rain-L24.sh > /dev/null 2>&1
#
I do it this way, because when I backup meteohub with rsync, I have a backup of them.
Jozef