Weewx

Tango-document-new.png

Tango-document-new.png

This article is a stub.

Notes: Need to update style to follow Help:Style. (Discuss in Talk:Weewx#)

Weewx is a free, open source, software program, written in Python, which interacts with your weather station to produce graphs, reports, and HTML pages.

Build and install

Install python2, python2-configobj, python2-cheetah and python2-pillow from the official repositories. You may be able to use python2-imagingAUR from the AUR instead of python2-pillow, but I have not tried this.

ln -s /usr/bin/python2 /usr/local/bin/python
./setup.py build
sudo ./setup.py install

Note that I have created a symlink so that "python" gives you python2 rather than python3. That is because weewx requires python2, but python3 is default on Arch. I do not like this approach, and I'm sure there must a better way. See the installation notes under Python.

You will also need PyUSB. I could not find a package for Arch, but it is easy enough to install from sourceforge.net/projects/pyusb. Make sure you get the 1.0 version, not the legacy 0.4. It uses setup.py, and installation instructions are included with the tarball.

After installation, weewx would not run because I did not have permissions on the weewx installation or the usb device. The weewx installation by default goes in /home/weewx and is owned by root. For the device, run lsusb and look for a line like this:

Bus 002 Device 002: ID 0fde:ca01  

The device name for this example is /dev/bus/usb/002/002; modify yours to match the Bus and Device in the lsusb output.

I gave myself permissions like this:

sudo usermod -a -G adm my_username
sudo chgrp adm /dev/bus/usb/002/002
sudo chgrp -R adm /home/weewx
sudo chmod -R g+w /home/weewx

In retrospect it might have been easier just to chown all the files to myself, since I ended up running the weewx daemon as me. You could also create a weewx user to own the files and run the daemon, which would be the more "unixy" way.

After this it was just a matter of following the configuration instructions from the weewx docs, then running the daemon. You could make a service for it but I just run it in a tmux window.

cd /home/weewx
./bin/weewxd weewx.conf

Getting graphs to work on Arch RaspberryPi

To get the graphs to work on the RaspberryPI (arm6) you will need to compile your own version of PIL (not pillow) and have the truetype2 headers installed. For some reason the pillow version in the arch arm6 repository is compiled without truetype fonts.

To install PIL download the source from here: http://www.pythonware.com/products/pil/

Then, after installing the arch developer tools:
pacman -S base-devel
Install the freetype2 tools:
pacman -S freetype2
You will then need to symbolic link the freetype2 directory to freetype because the PIL build looks for the freetype header files in the freetype directoy not in freetype2.:
ln -s /usr/include/freetype2 /usr/include/freetype
THEN you can build and install PIL from your build directory:
./setup.py install

Running Weewx with systemctl

Create a new file /etc/systemd/system/weewx.service containing:

[Unit]
Description=Daemon to control my Weewx weather station
After=ntpdate.service

[Service]
ExecStart=/home/weewx/bin/weewxd /home/weewx/weewx.conf  > /dev/null
Type=simple

[Install]
WantedBy=multi-user.target

This file is meant for the RaspberryPi - because the RPi has no system clock, systemctl will not start this service until after the ntp service has started, giving the system chance to sync the time before weewx starts up.

systemctl start weewx