Page 1 of 1
SQL-Database
Posted: Wed Jul 08, 2009 11:25 am
by speerwerfer
Hello,
Used someone Meteohub in conjunction with a database?
Martin
Re:SQL-Database
Posted: Wed Jul 08, 2009 6:10 pm
by YJB
Yes, I'm running MySQL on a second system (Solaris) and I'm pulling the records from meteohub (using meteolog.cgi) every 5 minutes.
Eventually I'm planning to build some PHP pages to populate my webserver, but I'm lacking the time at this stage.
Re:SQL-Database
Posted: Wed Jul 08, 2009 8:33 pm
by speerwerfer
Can you tell me something about the pulling? Is it a cron job? Can you show me the script?
Re:SQL-Database
Posted: Wed Jul 08, 2009 10:45 pm
by erwinkooi
That script would indeed be interesting. I use rrdtool for most of my graphs already and generating them from the sql database would offload some precious cpu cycles from my meteohub system.
Re:SQL-Database
Posted: Thu Jul 09, 2009 9:23 am
by YJB
Main logic
- I've got a distinct table for every data type (thb th t wind rain uv sol data), although I do only use thb, th, wind and data
- Table stores all sensor data including load datetime (for maintenance purposes) as well as the datetime of the sensor reading
- A shell script that runs out of cron, currently every 5 minutes
Main logic:
1) Pull records from meteohub for each datatype using meteolog.cgi and wget starting from the last record processed during the previous run.
2) Do some sanity checking and other data processing, like calculating my rfxmeter delta's
3) Load the data into mysql (using mysql --execute load data infile)
I'm more than happy to share the script, but that implies that
- I need to do some cleanup (I've been working with Boris to get the logging protocol changed a bit and until then I had to work around things, this messy code is still in the script).
- I need to document the table structure used.
Re:SQL-Database
Posted: Thu Jul 09, 2009 9:48 am
by speerwerfer
you have a website with the data?
Re:SQL-Database
Posted: Thu Jul 09, 2009 10:18 am
by YJB
Not really at this stage, like I mentioned already:
<Quote>
Eventually I'm planning to build some PHP pages to populate my webserver, but I'm lacking the time at this stage.
</Quote)
I'm still experimenting with the queries etc, and I'm still deciding on the graphs as well, right now I tend to lean towards jpgraph it seems quite flexible, but I haven't made up my mind yet.
Re:SQL-Database
Posted: Thu Jul 09, 2009 8:26 pm
by speerwerfer
YJB wrote:Not really at this stage, like I mentioned already:
Sorry, I have understood it differently
Re:SQL-Database
Posted: Thu Nov 19, 2009 7:36 pm
by erwinkooi
OK, my setup is as follows:
A scheduled script pulls raw data from MeteoHub, parses the values and uploads it into a mysql database.
The database has four tables. Host, Mapping, Reading and Sensor.
Host is the table that holds the info on the MeteoHub server.
Sensor is the table that holds the info on the various sensors. A sensor is always linked to an entry in the Host table.
Reading is the table that holds the readings of the various sensors. A reading is always linked to an entry in the Sensor table.
Mapping is the table that holds the mapping of a MeteoHub sensor name to a sensor in the Sensor table. This will map the raw value to the actual sensor.
Questions and comments are always welcome.
[file name=script_and_database_schema.txt size=5902]
http://www.meteohub.de/joomla/images/fb ... schema.txt[/file]
Re:SQL-Database
Posted: Mon Apr 12, 2010 2:22 pm
by foo8ar
Erwin,
Thanks for sharing your code.
I didn't really get all the details working.
Could You please dump the content of your tables excluding the reading table. That could hopefully make me understand.
BR
/t
Re:SQL-Database
Posted: Mon Apr 12, 2010 9:44 pm
by erwinkooi
Sure, here you go.
The reading table (and host table) have been stripped.
Please let me know if it works and if you have any problems and/or improvements. [file name=weatherlog.txt size=7996]
http://www.meteohub.de/joomla/images/fb ... herlog.txt[/file]
Re:SQL-Database
Posted: Tue Apr 13, 2010 9:09 am
by black23
Hi
I tried to make implemetation Meteohub into Joomla. I want to import data into MySQL. I use HTTP request for automatic import of actual values. Reguest run every minute by CRON.
Project is still in progress.
Mike
Re:SQL-Database
Posted: Wed Apr 14, 2010 5:52 pm
by erwinkooi
Hi Mike,
Depending on your weather station hardware, you probably do not need a reading every minute. I found my wireless sensors sending data every 15 minutes, so there was no reason for more frrquent polling and I could lower the stress on the servers.
Just a thought.
Re:SQL-Database
Posted: Fri May 21, 2010 6:23 pm
by spoetnik
I upload my data to weather underground using Rapid Fire.
I am using a script to import my data into a Mysql database from the weather underground API. This way I don't tress my NSLU2 to much.
You can find the mysql-dump and the script here:
http://drop.io/wunder_import
Just edit the config.inc.php to mach your setup.
I have got this running every minute using a cron-job
I am no mysql or php guru, so any insight would be welcome. [file name=wunder_import.zip size=7456]
http://www.meteohub.de/joomla/images/fb ... import.zip[/file]
Re:SQL-Database
Posted: Sat May 22, 2010 9:41 am
by spoetnik
Still working and improving the database schema. [file name=wunder_import-8f3118176c20d2815bc39d396cb0b437.zip size=8726]
http://www.meteohub.de/joomla/images/fb ... b0b437.zip[/file]