wfrog on a Raspberry Pi – visualize WH1080 weather station

weather_stationThis article describes how to install and run wfrog on a Raspberry Pi. It reads the data from a WH1080 weather station.

As always, you first should start to update Debian:

sudo apt-get update
sudo apt-get upgrade

Python software for USB Wireless WeatherStations (pywws)

pywws is used to read data from the WH1080 weather station via usb.

Installation of dependencies which we need:

sudo apt-get install git
sudo apt-get install python-dev
sudo apt-get install libudev-dev

Creation of a directory to download/install needed packages:

mkdir ~/src
cd ~/src

Installation of libusb:

wget http://sourceforge.net/projects/libusb/files/libusb-1.0/libusb-1.0.9/libusb-1.0.9.tar.bz2
tar xvjf libusb-1.0.9.tar.bz2
cd ~/src/libusb-1.0.9
./configure
make
sudo make install

Installation of Cyton:

wget http://pypi.python.org/packages/source/C/Cython/Cython-0.18.tar.gz
tar xvzf Cython-0.18.tar.gz
cd ~/src/Cython-0.18/
sudo python setup.py install

Installation of cython-hidapi:

cd ~/src
git clone https://github.com/gbishop/cython-hidapi.git

You need to update the correct path of libusb:

cd ~/src/cython-hidapi
vi setup.py

changing the path to libusb in setup.py

change line
os.environ['CFLAGS'] = "-I/usr/include/libusb-1.0"
to
os.environ['CFLAGS'] = "-I/usr/local/include/libusb-1.0"

Installation of pywws:

cd ~/src/
wget https://pywws.googlecode.com/files/pywws-12.10_r547.tar.gz
gunzip pywws-12.10_r547.tar.gz
tar -xvf pywws-12.10_r547.tar
mkdir ~/weather
cd ~/weather
cp -Rf ~/src/pywws-12.10_r547/* ~/weather/
cd ~/weather

Testing access to the WH1080 weather station:

sudo python TestWeatherStation.py

It should show a dump like:

0000 55 aa ff ff ff ff ff ff ff ff ff ff ff ff ff ff 05 20 02 31 81 00 00 00 00 00 00 83 02 00 20 29
0020 de 27 c3 26 00 00 00 00 00 00 00 13 02 21 01 11 41 23 c8 00 00 00 46 2d 2c 01 64 80 c8 00 00 00
0040 64 00 64 80 a0 28 81 25 a0 28 81 25 00 b4 00 00 68 01 0e 00 00 ef 01 12 00 00 00 00 00 00 00 00
0060 00 00 3a 19 61 1c f7 00 c5 00 f4 00 74 80 f4 00 74 80 91 00 96 80 49 27 90 25 0c 28 ab 26 41 00
0080 66 00 a8 00 05 01 14 01 80 01 80 01 00 12 12 31 13 15 13 02 08 19 58 13 01 21 06 09 13 01 10 16
00a0 31 10 01 01 11 33 13 02 09 01 03 12 12 28 12 43 13 01 27 05 04 12 12 28 12 43 13 01 27 05 04 12
00c0 12 28 12 43 13 01 27 05 04 12 12 28 23 06 13 02 02 06 45 13 02 13 23 59 13 02 02 06 45 13 01 30
00e0 23 27 13 01 30 23 35 12 12 28 15 14 12 12 28 20 48 12 12 31 12 49 13 01 10 16 34 13 01 10 16 34

If it doesn’t work, check if the usb cable is plugged in

You can use this command with differnt options.
e.g. show history data:

sudo python TestWeatherStation.py -d -h 5

wfrog

Installation of dependencies:

sudo apt-get install python-setuptools
sudo apt-get install python-cheetah
sudo apt-get install python-lxml
sudo apt-get install pyyaml

Note: I had to force the installation because of other dependencies with:

sudo apt-get -f install

Download wfrog debian package:

cd ~/src
wget http://wfrog.googlecode.com/files/wfrog_0.8.2-1_all.deb
sudo dpkg -i wfrog_0.8.2-1_all.deb

Since there is a problem with wfrog 0.8.2-1 regarding python 2.7 (see http://code.google.com/p/wfrog/issues/detail?id=85#c11), you need to modify the file /usr/lib/wfrog/wfcommon/config/fileloghandler.yaml

sudo vi /usr/lib/wfrog/wfcommon/config/fileloghandler.yaml


change line
handler: !!python/object/new:logging.handlers.RotatingFileHandler
to
handler: !!python/object/new:logging.NullHandler

Starting wfrog

Per default you need to start wfrog as root user (“sudo wfrog” is not enough!):

sudo su
export PYTHONPATH=$PYTHONPATH:/home/pi/weather/
wfrog

Note: If you start it the first time you need to answer some questions to configure wfrog.
Later you should start wfrog with “wfrog &” to run it in the background.

Wfrog is running per default on port 7680.
You can access it via webbrowser: http://:7680/

Check the web to get further information:
pywws: http://code.google.com/p/pywws/
wfrog: http://code.google.com/p/wfrog/

 

 

16 thoughts on “wfrog on a Raspberry Pi – visualize WH1080 weather station

  1. Experienced an error following your great guide. The gunzip pywws-12.10_r547.tar.gz command creates a .tar file and needs to be extracted with tar -xvf pywws-12.10_r547.tar to work.

    Can I suggest you add a cd ~/src just before your:

    Installation of cython-hidapi:

    git clone https://github.com/gbishop/cython-hidapi.git

    From the previous command the user will still be in the ~/src/Cython-0.18/ directory. Otherwise, thank you for a great source of inspiration

  2. When I run “sudo apt-get install pyyaml”
    I get the following error:
    “E: Unable to locate package pyyaml”
    Please advise (yes, I have updated and upgraded, everything up to date today May 5th 2013)

      • Thanks, that did the trick, but I had to be root to run the setup (sudo python setup.py install). A probably silly question (since I am not a linux guy): How could pyyaml be added to apt-get? Running apt-get update would never check for a newer version of pyyaml, right?

        • “Running apt-get update would never check for a newer version of pyyaml, right?”

          Yes, you are right, because you compiled it by yourself. However, you should be able to install a newer version again by compiling it like explained above / what you already did.
          The question would be, why you would like to upgrade? Maybe for security reasons? But I also think “never touch a running system” makes sometimes sense. Almost, if the system is not reachable for anybody.

          I am not sure why it was not possible for you to install it via apt-get, maybe it is broken in the current raspbian version or something like that and they removed it? Which raspbian version did you use?

          • When I login I get:
            Linux raspberrypi 3.6.11+ #371 PREEMPT Thu Feb 7 16:31:35 GMT 2013 armv6l
            and running “cat /etc/*-release”
            returns:
            PRETTY_NAME=”Debian GNU/Linux 7.0 (wheezy)”
            NAME=”Debian GNU/Linux”
            VERSION_ID=”7.0″
            VERSION=”7.0 (wheezy)”
            ID=debian

          • hmm, it seems it is not possible anymore to install it via the (default) debian packet manager.
            It would be interessting which version I have used, but the installation was for a friend and he switched in the meantime from wfrog to wviewweather with a fresh installed debian.

  3. I can only get error “No module names usb” when I run TestWeatherStation.py

    Also should Cython-0.18 be in src or libusb-1.0.9 as the instruction indicate.

    Thanks

  4. Pingback: Daniel Beaulieu

  5. Hello,
    the indroduction is very pretty but, when i test the connection to my weatherstation, then i get follow error:
    sudo python TestWeatherStation.py
    Traceback (most recent call last):
    File “TestWeatherStation.py”, line 145, in
    sys.exit(main())
    File “TestWeatherStation.py”, line 90, in main
    ws = WeatherStation.weather_station()
    File “/home/pi/weather/pywws/WeatherStation.py”, line 353, in __init__
    self.cusb = CUSBDrive(library)
    File “/home/pi/weather/pywws/WeatherStation.py”, line 279, in __init__
    from device_pyusb import USBDevice
    File “/home/pi/weather/pywws/device_pyusb.py”, line 64, in
    import usb
    ImportError: No module named usb

    i do my best, and flash my PI SD Card again. From first step i do all steps with root, but there is always the same error. Connetion Weatherstation Windows are okay.
    I hope you can help me
    thx

  6. Hi, followed your guide but ‘wfrog’ returns ‘No handlers could be found for logger “config”‘.
    Any idea?

Leave a Reply

Your email address will not be published. Required fields are marked *

SPAM protection. Please complete: *