Page 1 of 1

Python weather station

PostPosted: Thu Apr 17, 2014 4:57 pm
by auda
I'm playing with a weather station and have wview http://www.wviewweather.com and weewx http://www.weewx.com running on the file server and uploading to a website.
I dislike the idea of the file server having access to the internet and so would like to run them on Freesco.
My preference is for Weewx which needs python 2.5 -> 2.7 Is this possible ? The python that is.
I did see Dingetje mention it back in 2010 http://www.freesco.info/support-forum/viewtopic.php?f=9&t=17454&p=95582&hilit=python#p95582
Thanks
Auda

Re: Python weather station

PostPosted: Thu Apr 17, 2014 6:51 pm
by Lightning
There is a version of Python in the 03x Edna package "cgipython", but I have no way of knowing what version it is. Although the date inside the binary said Feb 2001, but the version was difficult to pick out of the binary source. But I suspect it could be something like 1.6

I will do some more research on this.....

Re: Python weather station

PostPosted: Thu Apr 17, 2014 7:16 pm
by Lightning
I found the sources for Python 2.7.6 and it seems to compile. So I guess the pertinent information is what do you need exactly?

also when compiling there was these messages, which may or may not be relevant.
Python build finished, but the necessary bits to build these modules were not found:
_bsddb _hashlib _sqlite3
bz2 sunaudiodev
To find the necessary bits, look in setup.py in detect_modules() for the module's name.


Failed to build these modules:
_ctypes _curses _curses_panel
_multiprocessing _ssl _tkinter
bsddb185 linuxaudiodev math
mmap ossaudiodev readline
resource

Re: Python weather station

PostPosted: Thu Apr 17, 2014 9:54 pm
by Lightning
I went ahead and made a python package that can be installed using
Code: Select all
pkg -i http://lewis.freesco.net/packages/0.4.x/python-2.7-lightning.pkg


Let me know how it works for you.

Re: Python weather station

PostPosted: Thu Apr 17, 2014 11:19 pm
by auda
That I don't know about. All It says is "Python 2.5, 2.6, or 2.7 is required. Python 3 will not work" and that it uses the sqlite3 archive database.
It can also use MySQL so maybe your mysql-3.23.37-lightning.pkg will work with it.
If its not to hard for you to compile Ill just try it and find out, on a test machine.
Thanks
Auda

Re: Python weather station

PostPosted: Sun Apr 20, 2014 12:50 pm
by Lightning
I did some testing and the 2.7 version of python plainly has some issues that make it non functional for this purpose. However the 2.5 version of python I think will work, but there are some add ons to the binary that need to be in place to make it fully functional. I will play with it some more as I read through all of the requirements for weewx and attempt to meet them.

As this is a really cool side job for any FREESCO machine I will attempt to package it. Also the author of weewx lives less than 200 miles from me :wink:

Re: Python weather station

PostPosted: Mon Apr 21, 2014 8:39 pm
by Lightning
I think that I have a functional version of python with the necessary addons for weewx. You can give it a try and see what you think.
Code: Select all
pkg -i http://lewis.freesco.net/packages/0.4.x/python-2.5-lightning.pkg

Although at present I have not gotten radlib to compile and I am not certain if weewx really has to have it, but I am looking for other versions of it. Secondly weewx states it will use a MySQL database. Which is good because MySQLite won't compile. I suspect the MySQL 3.23.37 package should work fine.

Re: Python weather station

PostPosted: Wed Apr 23, 2014 6:40 pm
by Lightning
After a little more tinkering I realize the the python package also needs to have a mySQL addon before it can communicate with a mySQL database. So still a bit more tinkering to do before it can be a reality. But it is looking at least promising. I am however still unsure which version of mySQL will be the target, although I have the source code for the 4.1.x version of mySQL and I don't have it for the 3.23.x version.
Also as a side note, only IP and serial based weather stations will be supported as there is no USB support in FREESCO.

Re: Python weather station

PostPosted: Thu Apr 24, 2014 7:00 pm
by auda
Thanks for all this I haven't been getting emails telling me that you have been replying I'll fix that now
thanks
Auda

Re: Python weather station

PostPosted: Fri Apr 25, 2014 10:43 am
by Lightning
I have just updated the python 2.5 package to include mySQL support. This supports mySQL 4.1.x as I could not get the 3.23 version source to compile. The above URL posted will give the latest version as I have not distributed it to FREESCOsoft yet.

Re: Python weather station

PostPosted: Sun May 04, 2014 3:26 am
by Lightning
Having had problems with python and mysql I have repackaged the python package again. I am still unable to get the weewx database installed, but it is getting closer at least as I can see improvements in how far I am getting with it. I still think there might be something still not completely right with the package or with weewx in this environment, but I have not figured it out yet. But python seems to be working pretty well at this point.

Re: Python weather station

PostPosted: Mon May 05, 2014 8:00 pm
by auda
Wish my weather station was going as well the wireless link 433mHz about 130' keeps dropping I will have to move it and hard wire it.
Thanks for the progress so far
Auda

Re: Python weather station

PostPosted: Sun Jun 15, 2014 2:37 pm
by auda
Hardware wise the weather station is running well, except for the occasional 137.9 km/h wind that doesn't actually happen.
This is what I have so far http://www.waghornswood.net.nz/weather/index.html
Any thing further with python ?
Thanks Auda

Re: Python weather station

PostPosted: Mon Jun 16, 2014 10:18 pm
by Lightning
The python package seams to be working fine. The problems come with the mysql 2.23 module. which seams to sort of work, but it is failing to create the database for the weather station. If the other data base for the weather station would compile it would solve the problem. However I am not an expert in C to know how to tweak it. Also if a person had an existing weather station data base to just insert into mysql it might work.