Using my own weather sensors and python code with WeeWx

436 views
Skip to first unread message

Steve Harris

unread,
Jan 16, 2016, 3:40:51 PM1/16/16
to weewx-development
Hello all!

I currently have coded my own python suite to collect data from Wireless Things.net sensors, and this is successfully collecting data, validating it, calculating dewpoint etc, posting to weather underground and posting into a SQL database.

I would like to use weewx to generate the website, graphs etc, from this data. I have no idea how to go about this in weewx. The data can be presented in files or from the SQL database, or I can write python code to push the data over IP to WeeWx.

Does anyone have any idea how I would go about this?

Newbie to weewx!

Thanks

Steve Harris

mwall

unread,
Jan 16, 2016, 4:14:58 PM1/16/16
to weewx-development

hi steve,

welcome to weewx!

ideally you would write a weewx driver that talks to the hardware.

if that is not feasible, then you can use the fileparse weewx driver to read data from a file.  or you could write a weewx driver that queries a socket for the data.

in its simplest form, a driver simply polls (or waits on) the hardware for data, then yields the data as a packet (a python dict).  this is the genLoopPacket method.

take a look at the fileparse driver (in the extensions directory), or the ws1 (uses serial comms) or simulator drivers (in bin/weewx/drivers).

the customization guide has a section about driver basics.

if you need more help, give us a shout or suggest how we can improve the documentation/examples.

when you get something working, please consider posting it on the weewx wiki.

m

mwall

unread,
Jan 23, 2016, 4:55:37 PM1/23/16
to weewx-development
On Saturday, January 23, 2016 at 4:41:51 PM UTC-5, Steve Harris wrote:

Thank you so much for the advice, I've now got it working :)

Check out http://www.raynesparkweather.co.uk/sw20wx

And also http://www.raynesparkweather.co.uk/weewx

One final question if I may,

I'd like to be able to have daily graphs shown on the website, by selecting say a particular date. I'm sure the data is archived in the SQL DB as I see data going back week or so at 5 minute intervals.

What query would I need to run in the skin config to get that to happen?

THanks for a great piece of code !:)

nice work steve!

would you consider writing up what you did then making a link to it on the weewx wiki?  or just put it on the weewx wiki at github?

the weewx report engine is not set up to do on-the-fly queries such as "select an arbitrary date then show the data for that day".  you would have to write some javascript or php to query the database then display the results.

or, if you know what queries you'll want (e.g., daily graphs for each of the past 14 days), you could create a skin with canned queries.

tom is working on weert, which provides a RESTful api that will make dynamic plots and interactive queries *much* easier to implement.  its a bit like graphite or influxdb, but simple and flexible (for example, no rigid schemas).  fyi, some of the other tools for doing this include influxdb, redis, rrdtool, graphite, with some focused on timeseries and others not so much.  on top of those you have the display layer such as D3, highcharts, jcharts, and others.

weewx will still do the data collection, uploading, and optionally the static reports.  weert will provide the back-end for interactive plots, visualizations, and queries.

m

Thomas Keffer

unread,
Jan 23, 2016, 5:00:33 PM1/23/16
to mwall, weewx-development
On Sat, Jan 23, 2016 at 1:55 PM, mwall <mw...@users.sourceforge.net> wrote:
On Saturday, January 23, 2016 at 4:41:51 PM UTC-5, Steve Harris wrote:

Thank you so much for the advice, I've now got it working :)

Check out http://www.raynesparkweather.co.uk/sw20wx

And also http://www.raynesparkweather.co.uk/weewx

One final question if I may,

I'd like to be able to have daily graphs shown on the website, by selecting say a particular date. I'm sure the data is archived in the SQL DB as I see data going back week or so at 5 minute intervals.

What query would I need to run in the skin config to get that to happen?

THanks for a great piece of code !:)

nice work steve!

would you consider writing up what you did then making a link to it on the weewx wiki?  or just put it on the weewx wiki at github?

the weewx report engine is not set up to do on-the-fly queries such as "select an arbitrary date then show the data for that day".  you would have to write some javascript or php to query the database then display the results.

​One thing you can do is run the utility wee_reports with a unix epoch time as an argument. Bit of a kludge, but it works. See the docs.

-tk

tjg...@soton.ac.uk

unread,
Jun 13, 2016, 12:08:58 PM6/13/16
to weewx-development, mw...@users.sourceforge.net
Hi there!

This thread describes pretty exactly something I'm trying to tackle at the moment, where I am using I2C and other protocols to collect weather data and output it to a variety of sources.
Although I haven't implemented it yet, I'm fairly confident I can generate a database similar to the one generated by the Weewx code - and I would like to use Weewx to display the data.

It seems that this thread had some very helpful information on it but has been taken down? I would be very grateful if someone could point me in the right direction!

Thanks,

Tim
Reply all
Reply to author
Forward
0 new messages