Getting live data into a SQLite database or similar

270 views
Skip to first unread message

Kenneth Ljungqvist

unread,
Jul 14, 2014, 4:32:15 PM7/14/14
to py...@googlegroups.com
First of all, kudos on an awesome project!
I've got a weather station hooked up to a Raspberry Pi and it works like a charm. Currently I'm only uploading the data to Weather Underground.

Now I want to use the data for my garden irrigation system. I'd like to store the data in a database or setup a web service to expose the data for storage somewhere else.
I can't find any documentation on how to extract the data and access it through a python script or whatever. Could someone please point me in the right direction?

Am I suppose to use templates with live log and read the data from the templates every 48 seconds?

Thanks in advance!

Jim Easterbrook

unread,
Jul 15, 2014, 3:00:00 AM7/15/14
to py...@googlegroups.com
On 14/07/14 21:32, Kenneth Ljungqvist wrote:
> I've got a weather station hooked up to a Raspberry Pi and it works
> like a charm. Currently I'm only uploading the data to Weather
> Underground.

I assume you're using 'live logging' to do this.

> Now I want to use the data for my garden irrigation system. I'd like
> to store the data in a database or setup a web service to expose the
> data for storage somewhere else.
> I can't find any documentation on how to extract the data and access
> it through a python script or whatever. Could someone please point me
> in the right direction?
>
> Am I suppose to use templates with live log and read the data from the
> templates every 48 seconds?

That's one possibility - to use a template to write a data file of
current conditions that's then read by another program.

The pywws.DataStore module's documentation describes how to use it to
access stored data, but it's generally a bad idea to have two different
programs accessing the same data files. It's a very simple storage system.

You could create a "user calibration" module that writes data to a
proper database, but you'd need to do something to prevent the same data
being stored a second time if the data is reprocessed.

You could send your data to another service such as OpenWeather or CWOP
and then use that service's API to get data for your irrigation system.

Long term, I'd like to write an alternative storage "back end" for pywws
that uses MySQL or similar, but I haven't had time to look into this yet.
--
Jim Easterbrook <http://www.jim-easterbrook.me.uk/>

Peter Mount

unread,
Jul 15, 2014, 6:34:05 AM7/15/14
to py...@googlegroups.com
What I've done is write my own template which submits direct to a rest service on one of my own servers & hence into the db. The website then displays the data direct from there either in page or via another set of rest services, i.e. used for plotting graphs/html5 widgets etc.

Although it means running another service it's easier in the end than writing to a file then reading from it to import into the db as once pywws submits it to the service it's in the db immediately.

tdarren

unread,
Jul 18, 2014, 3:12:43 PM7/18/14
to py...@googlegroups.com
I will also be attempting to do the same thing. It would completely remove the need to generate templates (CPU Usage) and then have a web server generate templates from the database instead.

It would also allow the user to enter their own times and dates and select what data they want to see. More interactivity.

I'm planning to use a MySQL database for this.
Reply all
Reply to author
Forward
0 new messages