Python/PyWeather collaboration??


36 posts   Page 1 of 2   1, 2
by prodata » Mon May 14, 2012 3:27 pm
Anyone with a reasonable working of Python (and ideally not too far from the GMT timezone) willing to provide some collaboration in the sense of help/assistance in getting an established Python program working? This is a weather-related program called PyWeather which I can't yet get running on the Pi, mainly because I'm not familiar enough with Linux/Python and probably just need some pointers on getting the package correctly installed and configured.

Initial task is just to get the program running but there is scope for further development.
Posts: 113
Joined: Tue Jan 24, 2012 5:53 pm
by pingu512 » Mon May 21, 2012 8:57 pm
Not got my Pi yet but I have an emulator running pywws python software http://code.google.com/p/pywws/
The results can be seen at www.dragontail.co.uk . Its not live data yet, but my pi is due this week.
Setup is straight forward.
User avatar
Posts: 62
Joined: Sun Apr 01, 2012 2:39 pm
Location: Chester
by nr » Thu May 24, 2012 10:43 am
mmm... trying to get pywws 12.05_r521 running this morning, but keep getting problems reading the weather station from the USB port:
Code: Select all
root@raspbian:/mnt/usbdisk/weather/pywws-12.05_r521#  python TestWeatherStation.py
Traceback (most recent call last):
  File "TestWeatherStation.py", line 145, in <module>
    sys.exit(main())
  File "TestWeatherStation.py", line 91, in main
    raw_fixed = ws.get_raw_fixed_block()
  File "/mnt/usbdisk/weather/pywws-12.05_r521/pywws/WeatherStation.py", line 578, in get_raw_fixed_block
    self._fixed_block = self._read_fixed_block()
  File "/mnt/usbdisk/weather/pywws-12.05_r521/pywws/WeatherStation.py", line 610, in _read_fixed_block
    result += self._read_block(mempos)
  File "/mnt/usbdisk/weather/pywws-12.05_r521/pywws/WeatherStation.py", line 598, in _read_block
    new_block = self.cusb.read_block(ptr)
  File "/mnt/usbdisk/weather/pywws-12.05_r521/pywws/WeatherStation.py", line 309, in read_block
    return self.dev.read_data(32)
  File "/mnt/usbdisk/weather/pywws-12.05_r521/pywws/device_pyusb.py", line 134, in read_data
    raise IOError('pywws.device_libusb.USBDevice.read_data failed')
IOError: pywws.device_libusb.USBDevice.read_data failed


The device is recognised when I connect it:
Code: Select all
usb 1-1.2.2: new low speed USB device number 15 using dwc_otg
usb 1-1.2.2: New USB device found, idVendor=1941, idProduct=8021
usb 1-1.2.2: New USB device strings: Mfr=0, Product=0, SerialNumber=0
generic-usb 0003:1941:8021.0008: hiddev0: USB HID v1.00 Device [HID 1941:8021] on usb-bcm2708_usb-1.2.2/input0


so obviously a bit of twiddling needed somewhere. Probably the pyusb library, but that's really just guesswork. libusb and pyusb are both installed:
Code: Select all
root@raspbian:~# dpkg -l | grep usb
ii  libusb-0.1-4:armhf               2:0.1.12-20                    userspace USB programming library
ii  python-usb                       0.4.3-1                        USB interface for Python


Anyhow. I'll keep fiddling and see what happens.
Posts: 11
Joined: Wed Jan 11, 2012 10:04 am
by joefly » Tue Jun 05, 2012 4:36 pm
http://code.google.com/p/python-weather-api/

have you tried pywapi..

i am running it fine from my RPi and sending info to Arduino with LCD
Posts: 52
Joined: Thu May 31, 2012 4:10 pm
by kenmc » Wed Jun 06, 2012 9:46 am
nr wrote:mmm... trying to get pywws 12.05_r521 running this morning, but keep getting problems reading the weather station from the USB port:
Code: Select all
root@raspbian:/mnt/usbdisk/weather/pywws-12.05_r521#  python TestWeatherStation.py
Traceback (most recent call last):
  File "TestWeatherStation.py", line 145, in <module>
    sys.exit(main())
  File "TestWeatherStation.py", line 91, in main
    raw_fixed = ws.get_raw_fixed_block()
  File "/mnt/usbdisk/weather/pywws-12.05_r521/pywws/WeatherStation.py", line 578, in get_raw_fixed_block
    self._fixed_block = self._read_fixed_block()
  File "/mnt/usbdisk/weather/pywws-12.05_r521/pywws/WeatherStation.py", line 610, in _read_fixed_block
    result += self._read_block(mempos)
  File "/mnt/usbdisk/weather/pywws-12.05_r521/pywws/WeatherStation.py", line 598, in _read_block
    new_block = self.cusb.read_block(ptr)
  File "/mnt/usbdisk/weather/pywws-12.05_r521/pywws/WeatherStation.py", line 309, in read_block
    return self.dev.read_data(32)
  File "/mnt/usbdisk/weather/pywws-12.05_r521/pywws/device_pyusb.py", line 134, in read_data
    raise IOError('pywws.device_libusb.USBDevice.read_data failed')
IOError: pywws.device_libusb.USBDevice.read_data failed


The device is recognised when I connect it:
Code: Select all
usb 1-1.2.2: new low speed USB device number 15 using dwc_otg
usb 1-1.2.2: New USB device found, idVendor=1941, idProduct=8021
usb 1-1.2.2: New USB device strings: Mfr=0, Product=0, SerialNumber=0
generic-usb 0003:1941:8021.0008: hiddev0: USB HID v1.00 Device [HID 1941:8021] on usb-bcm2708_usb-1.2.2/input0


so obviously a bit of twiddling needed somewhere. Probably the pyusb library, but that's really just guesswork. libusb and pyusb are both installed:
Code: Select all
root@raspbian:~# dpkg -l | grep usb
ii  libusb-0.1-4:armhf               2:0.1.12-20                    userspace USB programming library
ii  python-usb                       0.4.3-1                        USB interface for Python


Anyhow. I'll keep fiddling and see what happens.

I also tried to get pywws working with my WH1080 and RPi, and got similar (I'm not at home now) errors to that posted above. I was half thinking that the problem was the console was drawing too much power from the RPi USB ports (if you have the head unit connected to a usb, you can remove the batteries and it stays alive), so I bought a powered hub to try to stop this happening, but it doesn't seem to have helped.

I started looking at wview then since, but haven't had the time to do much, as I went on holidays shortly after and have been catching up since.

Did you have any further progress?
http://goatstownweather.hostoi.com
Posts: 52
Joined: Fri May 04, 2012 8:02 am
Location: Dublin, Ireland
by kenmc » Wed Jun 06, 2012 9:47 am
joefly wrote:http://code.google.com/p/python-weather-api/

have you tried pywapi..

i am running it fine from my RPi and sending info to Arduino with LCD

Not the same - this just pulls a weather forecast from the web, rather than from a weather station sitting in your garden.
http://goatstownweather.hostoi.com
Posts: 52
Joined: Fri May 04, 2012 8:02 am
Location: Dublin, Ireland
by kenmc » Fri Jun 08, 2012 2:24 pm
Just to add..
I got wview installed last night and it was able to connect to the head unit and read something, as the log messages were displaying the unit type, but it (wview) didn't fully "boot", it was constantly in the booting status on the wviewmgmt webpage.
Hopefully can get through that stage.
http://goatstownweather.hostoi.com
Posts: 52
Joined: Fri May 04, 2012 8:02 am
Location: Dublin, Ireland
by stevewardell » Fri Jun 08, 2012 9:15 pm
have been trying to install wview myself this evening but without success, not quite sure what is wrong at this point but I admit I've been darting through the notes rather than reading, checking then doing. Will start clean tomorrow and see if I can spot what's wrong.
Steve
@stevewardell
stevewardell.wordpress.com
Posts: 16
Joined: Thu Jun 07, 2012 9:15 pm
by Chargenut » Mon Jun 11, 2012 9:51 am
I managed to get wview working on my Raspberry PI last night with my UK Maplin based "USB Touch Screen Weather Station" http://www.maplin.co.uk/usb-wireless-weather-forecaster-223254 after various issues. These included:

Installation - I added the wview repository to the APT-GET libraries - see:
http://www.wviewweather.com/release-notes/wview-User-Manual.html#Installation-debian

Then installed via a standard "apt-get install wview" - this adds all the libraries too.

I then used "lsusb" command to identify my Weather Station (which was identified as "Dream Link WH1080 Weather Station") and showed it was on BUS 1 Device ID 4.

Code: Select all
pi@raspberrypi:/etc/init.d$ lsusb
Bus 001 Device 005: ID 1241:1603 Belkin Keyboard
Bus 001 Device 004: ID 1941:8021 Dream Link WH1080 Weather Station / USB Missile Launcher
Bus 001 Device 003: ID 0424:ec00 Standard Microsystems Corp.
Bus 001 Device 002: ID 0424:9512 Standard Microsystems Corp.
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

Caution it looks like the USB Device ID can change at each re-boot and so this needs to be re-checked and re-configured each boot.

Stop the wview app using:
Code: Select all
cd /etc/init.d
sudo ./wview stop


This usb device identification then related to the wview "STATION_DEV" setting when running "wviewconfig", the device was called "/dev/usbdev1.4" when I ran "ls /dev | grep usb":
Code: Select all
pi@raspberrypi:/etc/init.d$ ls /dev | grep usb
usbdev1.1
usbdev1.2
usbdev1.3
usbdev1.4
usbdev1.5

Code: Select all
Station type - one of Simulator, Virtual, VantagePro, WXT510, TWI, WS-2300, WMR918, WMRUSB, WH1080, TE923:
PARAMETER: STATION_TYPE
(WH1080):
-------------------------------------------------------------
Physical interface to the weather station - one of serial or ethernet (usb is considered serial):
PARAMETER: STATION_INTERFACE
(serial):
-------------------------------------------------------------
Weather station serial device (/dev/ttyS0, /dev/ttyUSB0, etc.):
PARAMETER: STATION_DEV
(/dev/usbdev1.6): /dev/usbdev1.4



Once this is configured, all should start up ok, at which point you can set up the communications to servers (mine sends the generated HTML and IMG files to an FTP server for display on a web site).

Hoping this helps some of you, not saying this is the answer to all the issues out there, but it's a view of the hurdles I overcame to get mine running!

cheers,
Terry.
Posts: 5
Joined: Mon Jun 11, 2012 8:58 am
by kenmc » Tue Jun 12, 2012 9:12 am
Jeez well spotted that it changes address every boot - that may explain why mine worked once, but then wviewd was stuck in the "booting" stage - even overnight.
Will try again.

How did you determine that it was 1.4? is it from the line
Code: Select all
pi@raspberrypi:/etc/init.d$ lsusb
//snip//
Bus 001 Device 004: ID 1941:8021 Dream Link WH1080 Weather Station / USB Missile Launcher

Does that mean 1.4?
Cheers
K
http://goatstownweather.hostoi.com
Posts: 52
Joined: Fri May 04, 2012 8:02 am
Location: Dublin, Ireland
by Chargenut » Tue Jun 12, 2012 10:10 am
kenmc wrote:Jeez well spotted that it changes address every boot - that may explain why mine worked once, but then wviewd was stuck in the "booting" stage - even overnight.
Will try again.

How did you determine that it was 1.4? is it from the line
Code: Select all
pi@raspberrypi:/etc/init.d$ lsusb
//snip//
Bus 001 Device 004: ID 1941:8021 Dream Link WH1080 Weather Station / USB Missile Launcher uhh

Does that mean 1.4?
Cheers
K


I kind of made the link that on my Pi there were 5 devices listed in lsusb and that there were 5 USB devices in the dev folder. Then I saw BUS 1 Device ID 4 and made the leap of faith to device 1.4

T
Posts: 5
Joined: Mon Jun 11, 2012 8:58 am
by kenmc » Tue Jun 12, 2012 10:12 am
Hmmm right. Wonder if it'd be possible to mod the init.d file to automagically work out which USB device it's to talk to and change the config somehow. Otherwise it becomes a bit pointless, having to go and do it manually.
http://goatstownweather.hostoi.com
Posts: 52
Joined: Fri May 04, 2012 8:02 am
Location: Dublin, Ireland
by Chargenut » Tue Jun 12, 2012 12:34 pm
Agreed that would make more sense.

I'm away on business till Wednesday evening, i'll take a look when I get back.

T
Posts: 5
Joined: Mon Jun 11, 2012 8:58 am
by kenmc » Tue Jun 12, 2012 3:00 pm
I might get a chance to play with it this evening, will see what I can find
http://goatstownweather.hostoi.com
Posts: 52
Joined: Fri May 04, 2012 8:02 am
Location: Dublin, Ireland
by kenmc » Tue Jun 12, 2012 10:15 pm
Interesting....
played with this for a couple of hours, always getting the failed to read block data lark.
just as i'm about to go to bed I try plugging it into the powered usb hub as a test
Reset the console and it reads the data absolutely fine first time up.
Looks like the pi doesn't have enough power for the console!
http://goatstownweather.hostoi.com
Posts: 52
Joined: Fri May 04, 2012 8:02 am
Location: Dublin, Ireland
by kenmc » Tue Jun 12, 2012 10:33 pm
spoke too soon. it read the data once. then didn't read any more data
stopping wview and starting it again i'm back to the bad block crap :(
http://goatstownweather.hostoi.com
Posts: 52
Joined: Fri May 04, 2012 8:02 am
Location: Dublin, Ireland
by Chargenut » Thu Jun 14, 2012 9:22 am
My Pi crashed while I was away...

I just rebooted it and of course wview wouldn't start up due to a list of "lock files" with a .pid extension left behind from the last run. These are in "/var/lib/wview", if these exist then it's a good indication that things went "pop" as on normal stop these files removed.

I cleared them out with:
Code: Select all
pi@raspberrypi:/etc/init.d$ cd /var/lib/wview
pi@raspberrypi:/var/lib/wview$ ls *.pid
htmlgend.pid    wvalarmd.pid  wvhttpd.pid  wviewftpd.pid  wvpmond.pid
radmrouted.pid  wvcwopd.pid   wviewd.pid   wviewsshd.pid
pi@raspberrypi:/var/lib/wview$ sudo rm *.pid

And restarted wview with:
Code: Select all
pi@raspberrypi:/var/lib/wview$ cd /etc/init.d
pi@raspberrypi:/etc/init.d$ sudo ./wview start

And everything started up (interestingly my weather station remained on USB Bus1 Device 004 for this re-boot.

Terry.
Posts: 5
Joined: Mon Jun 11, 2012 8:58 am
by kenmc » Thu Jun 14, 2012 10:10 pm
That's interesting
Are you straight into the PI or via a (powered?) hub? Which of the 2 USB ports on the PI are you connecting with, the upper or the lower? Might get to play with it again over the weekend.
Really don't like the WView interface though, much prefer cumulus.....
http://goatstownweather.hostoi.com
Posts: 52
Joined: Fri May 04, 2012 8:02 am
Location: Dublin, Ireland
by Chargenut » Fri Jun 15, 2012 10:37 am
kenmc wrote:That's interesting
Are you straight into the PI or via a (powered?) hub? Which of the 2 USB ports on the PI are you connecting with, the upper or the lower?

I am indeed straight into the Pi, I've setup mine with SSH console access so no mouse of keyboard plugged in, only the weather station. My WS is connected to the Upper USB.
kenmc wrote:Might get to play with it again over the weekend.
Really don't like the WView interface though, much prefer cumulus.....

Hmmm Cumulus... will have a look at that and see if I can get that running!

T
Posts: 5
Joined: Mon Jun 11, 2012 8:58 am
by kenmc » Fri Jun 15, 2012 4:08 pm
I'm same - ssh and vnc into the PI, and was using the upper port only until i went to the powered hub. which I *think* I actually had in the lower port.
I could only get the thing to work though using /dev/usbTTY0 (I think). The /dev/usbdev1.4 didn#t seem to work for me. But I need to do some more playing/

Cumulus is a windoze only app unfortunately, which is why I want to get the Pi to use something to talk to my weather station, to reduce the need to keep my windoze media center PC on 24/7

My cumulus weather site is customized if you're interested : goatstownweather.atwebpages.com
http://goatstownweather.hostoi.com
Posts: 52
Joined: Fri May 04, 2012 8:02 am
Location: Dublin, Ireland
by brimstone » Mon Jun 18, 2012 4:37 pm
Hi,
I have a Maplin N96FY weather station, receiver connected directly to upper USB port, lsusb shows:
Bus 001 Device 004: ID 1941:8021 Dream Link WH1080 Weather Station / USB Missile Launcher

wview installed and runs OK with simulator but stopped when I changed station to WH1080 as described above, stationInit failed although I'm struggling to get any useful log messages.

I wanted to try connecting with pywws (TestWeatherStation). I'm a bit confused by the USB dependency choices at http://pywws.googlecode.com/svn/trunk/d ... arted.html. What are the recommended choices and best way to install them?
Posts: 4
Joined: Sun Jun 17, 2012 12:54 pm
by jshuker » Tue Jun 19, 2012 2:25 pm
Success wview working on Pi with Debian Squeeze :D
Many thanks to the contributors and all their previous posts which have enabled a relative Linux newbie to get the Pi up and running, install a test web-server: Apache, MySQL, PHP & wview :)
The weather station parameters do need some tweaking (we had a lot of rain but not quite that much) but apart from that...
http://www.theshukers.co.uk/weather
Posts: 4
Joined: Wed Feb 15, 2012 3:11 pm
by brimstone » Tue Jun 19, 2012 4:33 pm
Well done, I'm envious as despite various approaches I'm still getting wview log records... WH1080: data block at index 56864 has bad sensor value, ignoring the record

What steps did you follow to get the success? Are you connected via powered hub? I'm not but voltage measured at the test points is 4.91 volts and doesn't vary when W1080 is connected so I don't think the receiver is taking too much power from the Pi. Have you installed any updates to the debian image?
Posts: 4
Joined: Sun Jun 17, 2012 12:54 pm
by kenmc » Wed Jun 20, 2012 10:21 am
jshuker wrote:Success wview working on Pi with Debian Squeeze :D
Many thanks to the contributors and all their previous posts which have enabled a relative Linux newbie to get the Pi up and running, install a test web-server: Apache, MySQL, PHP & wview :)
The weather station parameters do need some tweaking (we had a lot of rain but not quite that much) but apart from that...
http://www.theshukers.co.uk/weather


Have you taken it offline? Or has it stopped working?
Reason I ask is that the last updates I can see on it are from the 16th.
http://goatstownweather.hostoi.com
Posts: 52
Joined: Fri May 04, 2012 8:02 am
Location: Dublin, Ireland
by jshuker » Wed Jun 20, 2012 12:02 pm
Oh, short lived success :(
Pi seems to have crashed and a reboot hasn't brought wview back up in a working state. Log file is showing:
Jun 20 12:36:56 raspberrypi htmlgend[1163]: <1340192216983> : radsqliteQuery: database locked, retry...
Jun 20 12:36:57 raspberrypi htmlgend[1163]: <1340192217084> : radsqliteQuery: query failed: PRAGMA synchronous = NORMAL
Jun 20 12:36:57 raspberrypi htmlgend[1163]: <1340192217084> : htmlgend: recv unrecoverable signal 11: aborting!
Jun 20 12:37:26 raspberrypi radmrouted[1088]: <1340192246699> : radQueueSend: write failed on fd 9: Broken pipe
Jun 20 12:37:26 raspberrypi radmrouted[1088]: <1340192246700> : SendToClient: htmlgend: radProcessQueueSend failed!
Jun 20 12:37:26 raspberrypi radmrouted[1088]: <1340192246700> : QueueMsgHandler: htmlgend: SendToClient failed!
Jun 20 12:38:26 raspberrypi radmrouted[1088]: <1340192306700> : radQueueSend: write failed on fd 9: Broken pipe

I'll inspect and report back.
Posts: 4
Joined: Wed Feb 15, 2012 3:11 pm