wview to wfrog archive conversion

Following a not so minor mishap with my home server, I recently rebuilt it on new hardware. I decided to take another look at what software was available for talking to my WH1080 based weather station. Up until then I had been using wview, but I've not been particularly happy with it; configuration is a little cumbersome, the generated webpage isn't easily customisable and it periodically crashes. Having said that, it has largely faithfully recorded the weather from my station over the past year or so with reasonable accuracy.

Never-the-less, I decided it was time for a change and stumbled across wfrog. Used it conjunction with pywws, it is able to record and display readings from my station. I'm not totally happy with it; I don't like the fact it uses its own HTTP server and am looking into how to make it simply generate static HTML which I can serve with Nginx. It also has limited database support; only CSV (!), MySQL and Firebird. Maybe if I get time (ha!) I'll look at adding SQLite and/or PostgreSQL support to it.

It is however working and online, and I've even managed to import the archived data from wview. I think the data may need a little massaging however, as it tells me there were several recordings of winds close to 400km/hr. I'm not sure if this is bad data recorded by wview or an issue with wfrog's CSV import (or possible an issue with my conversion).

Anyway, the script I used to convert the SQLite db into CSV for wfrog is as follows:

sqlite3 -csv wview-archive.sdb "SELECT dateTime, strftime('%Y-%m-%d %H:%M:%S', dateTime, 'unixepoch', 'localtime'), (outTemp-32)*100/180, outHumidity, windSpeed, windDir, windGust, windGustDir, (dewpoint-32)*100/180, rain, rainRate, pressure*33.86389, UV from archive;" |sed -ne 's/\"//g;s/-1\.0//p' > ~/wfrog-archive.csv

From there you can simply move the old wfrog.csv file out the way, move in the newly created archive and cat the two together. Something like this should work:

mv /var/lib/wfrog/wfrog.csv /var/lib/wfrog/wfrog.csv.old
cat ~/wfrog-archive.csv /var/lib/wfrog/wfrog.csv.old > /var/lib/wfrog/wfrog.csv

Hopefully someone else may find this useful. When I eventually find out where the spurious wind recordings have come from I'll update this page. If you're interested, my weather station is available at http://w.na.id.au/.

Add new comment

Filtered HTML

  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <strike> <u> <div> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <img> <h1> <h2> <h3> <h4> <h5> <h6> <span> <br> <br /> <p> <pre>
  • Lines and paragraphs break automatically.

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
Image CAPTCHA
Enter the characters shown in the image.