Weewx on Rasp!

This was my backup installation for Weewx and a La Crosse WS2350 Weather Station on a Raspberry Pi (RPi) after I suffered Python library problems with our Synology box.   It is assumed  you are running headless (no mouse, keyboard or monitor on the RPi) and have installed an SSH client on your main machine.

Getting Started

I started by getting a fresh version of the Raspbian OS from the Raspberry Pi website and then used the dd tools on my Mac to image the card.  On the Weewx Google group there is a discussion on the life expectancy of card on the RPi and I would suggest taking an image of the card once you have everything set up should it fail.  It would also be worth setting up some form of scp/rsync to copy your databases to a remote backup.  You should also read the Raspberry Pi section of the Weewx website before starting.

Once you have plugged your RPi to the network and powered it up you will need to find it on your network.  If you are using a linux based computer as your main machine then you can use something like

sudo nmap -sP 192.168.1.*

but windows will need some software like Advanced IP Scanner (untested).

I started by creating a new user for Weewx and added them to the superusers group so I have greater control over what the weather station can do.

sudo su
adduser weewx
usermod -a -G sudo weewx

Installing the Prerequisites

next I, patiently, worked through installing all the prerequisites.

# required packages: 
sudo apt-get install python-configobj 
sudo apt-get install python-cheetah 
sudo apt-get install python-imaging 

# required if hardware is serial or USB: 
sudo apt-get install python-serial 
sudo apt-get install python-usb 

# required if using MySQL: 
sudo apt-get install mysql-client 
sudo apt-get install python-mysqldb 

# optional for extended almanac information: 
sudo apt-get install python-dev 
sudo apt-get install python-pip 
sudo pip install pyephem

If you are installing Weewx onto the latest version of Raspbian then NTP is already installed.  You can check this by checking the existence of the config file

more /etc/ntp.conf

and then checking that the correct time has been set with


if you get output that looks like Tue Dec 31 08:45:45 UTC 2013 then the time is set.

Installing and configuring Weewx.

Caveat from M:

Installation using the deb package is probably easier for most people with little linux experience.  when you install using a deb package, dpkg will prompt for the altitude, lat/lon, station type, and any other required parameters.  so there is little or no puzzling with config files when you install from deb package, at least for a generic installation.

However, for a manual or custom installation read on…


So download the latest version of Weewx onto your RPi and unzip it with

wget http://downloads.sourceforge.net/project/weewx/weewx-2.5.0.tar.gz
tar -xvf weewx-2.5.0.tar.gz
cd weewx-2-5.0

Next set the install path so weewx does not run in the home folder of the weewx user by opening the setup.cfg file with nano setup.cfg

# Set the following to the root directory where weewx should be installed
home = /home/weewx/system25

with this done we can build the install (checking for errors) before running the install itself.

python setup.py build
python setup.py install


If everything has gone to plan and Weewx has been installed into /homes/weewx/system25 we can now start configuring and running Weewx.  You will want to configure: location; latitude; longitude; altitude; and station_type.  This can all be done using vi or another text editor

vi weewx.conf

Notes on station configuration

At the time of writing my station type (Technoline branded La Cross WS2350) was in Beta so I had to add WS23xx support manually.   If you are working with version 2.5.1 or greater then you should be able to skip steps 1 to 3 and jump straight to 4.

1) download the ws23xx.py driver and the wee_config_ws23xx utility:


2) put the two files in the right place, set permissions on the utility:

cp ~/Downloads/ws23xx.py /home/weewx/bin/weewx/drivers
cp ~/Downloads/wee_config_ws23xx /home/weewx/bin
chmod 755 /home/weewx/bin/wee_config_ws23xx

3) add the ws23xx directives in weewx.conf:

    station_type = WS23xx

    port = /dev/ttyUSB0
    driver = weewx.drivers.ws23xx

4)  Check/ Update station interval.

When my reports first started to run I was getting dots and not lines as shown in the first part of the image.  This was due the station interval time being set at 60 minutes.

If you are seeing something similar then you can check the station configuration and the hardware archive interval (‘hi’) using:

./bin/wee_config_ws23xx /home/weewx/system25/weewx.conf --info

you can set this interval with

sudo ./bin/wee_config_ws23xx  /home/weewx/system25/weewx.conf   --set-interval=5

and now you should have a working station.

Another caveat from M:

Another way to deal with the dots is to change the line_gap_fraction in skin.conf.  some people might want to keep a long archive interval.  for example, a long interval makes it possible to do weekly synchronization to stations with little memory.  others simply do not need ‘live’ or even 5 minute updates of the data.  reducing the value of line_gap_fraction will connect the dots without increasing the number of samples.


Now plug your station in to the RPi and check that is has loaded ok with the following command and you should see a listing for ttyUSB0

ls -l /dev/ttyUSB*

Depending on which user you intend to run the station as you might need to change the permissions of this file.

sudo chmod 664 /dev/ttyUSB0

although sadly unless you set up udev rules you might have to repeat this every time you unplug/replug the weather station.

Finally you can get down to running the station with

./bin/weewxd weewx.conf

or if you want it to continue after you have logged off via SSH you will need to use nohup as shown below.

nohup ./bin/weewxd weewx.conf & echo $! > run.pid

this starts weewxd and then stores the pid in a file called run.pid for later when we would like to kill (stop) the weather station from running.  We can check that the station is still running with

ps -e | grep "weewxd"

and now kill/stop it with

kill -TERM $(cat run.pid)

Viewing the output

You will be able to view output created on the RPi first by listing the contents of the public_html folder which is created inside your weewx system folder at the correct interval.

ls -la public_html

If you are playing with templates and have problems seeing updates I have had success deleting the public_html and starting over.   Weewx will only create some first the first time so without the folder it starts over.

Assuming that folder exists you will want a web server to view those file.   If you already have web space available then the easiest solution is to refer to the FTP section of the standard reporting section of the weewx.conf.  You will need to restart weewxd if you make changes there.

If you want to install a webserver on the Raspberry Pi you start by getting the main apache package.  As we are only viewing static pages there is no need for php or anything else.

sudo apt-get install apache2

Once this installation has completed you should be able to browse to the ip address of the RPi and see the standard it works! webpage.  The easiest way to then view your actual weather pages is to create a link from the webroot to your weewx public_html folder:

cd /var/www
sudo ln -s /home/weewx/system25/public_html weather

and then it should work!

30 Comments on “Weewx on Rasp!

  1. Pingback: Installing Weewx on #RaspberryPi | Raspberry PiPod

  2. Thanks for the useful advice, which has helped me set up weewx on my pi and view the webpage remotely.

    Just need to get the graphics working now…

  3. Having finally got weewx up and running on my pi, I would like to improve the webpages it generates.
    I really like your design. Did you make your own template/skin? If so, could you share it?

  4. Pingback: ZR6LU from Johannesburg: Weather Station on Raspberry Pi

      • Hello Chris! Sorry for the delay, I’ve been out of town on business. I did not write down my steps previously, but I have to do a fresh install onto another RasPi this weekend. Promise I will make detailed notes and post it here. Leon

  5. Hey, great write up! Ran into a few issues though, which could be my fault. I’m not super good at Unix operating systems. Anyways, I’m uploading to Weatherunderground and everything is showing up as -999. Any thoughts on that? I have the Lacrosse weather station from Costco which I believe is the C86234. Other question is I tried to setup the webpage following the steps you put up. When I try to go to it, I just get a forbidden page. Any ideas? Thank you!!

    • Do you have pages appearing in public_html and do they contain good data i.e. not -999. Check this first as we need to determine whether the station is producing valid data. You could check the databases using sql commands but will have to google how. There is something in the weewx google group.

      If you are getting correct data then not sure about Wunderground – ask on the group. As for the other problem check you followed all instructions – what user are you running weewx as and what permissions do the files have ls -la!

      • After some messing around I was able to get the page to show up. It is returning n/a for all values though, so I’m guessing that the weatherstation is not producing valid data. Am I correct is selecting the WS28xx driver for the station I have? I have a Lacrosse one that came from Costco which I think is the C86234. I also think that part of the problem is getting the weewxd program running and to stay running. I’ve tried using the nohup command, but I’m not positive that it stays running. It seems that I always have to use sudo and the command to keep things running. Let me know what you think. I’ll keep digging and maybe even start over if I need to.

          • Looks pretty good to me. You might have an interval issue but that’s the sort of thing Tom and the group would be able to help with more than I.

        • Hi Jeff,

          I’m not an expert at Weewx and the many different stations so you will get a better response on the Weewx Google Group – its likely that Tom will be able to guide you to a solution. Keeping the weewx program running – check it is not still running in the background with ps -e | grep “weewxd” and use kill xxxxx if there are more than one running. From memory you will need to use sudo because of the /dev/ttyUSB0 port permissions unless you chmod the port which I would not do at this stage. Have you got debug=1 in your weewx.conf? Check tail -f /var/log/messages and tail -f /var/log/syslog and see if anything suggests a problem.

          • Thank you for your assistance. I’ll do some more digging and head over to the support group there.

  6. A huge thank you to Chris for helping put the Weewx on my RP and get it all working with my Vantage Vue. It took a few wipes of the SDCARD but it was worth all the effort. Could not have done it without this guide.

    A happy man


  7. Thank you for the excellent tutorial.
    I have a small question: how is it possible to change the measure in Metric? And not US.
    Thank you very much

  8. Pingback: Weewx On Cubie Truck - Chris Davies-Barnard

  9. What version of WEEWX are you using? I was not able to generate any public_html files no matter how I installed it (via deb package or with python).

    • Never mind. I switched to simulator mode and everything generated. Turns out my serial cable from my console to my PC was bad. I was not getting any info for WEEWX to generate!

      Thanks for the tutorial.

  10. UPDATE…

    So – I wanted to start weewx (as installed above) when the RPi rebooted, etc. automatically… Here is what I did and it works…

    First – change the Debian script as follows… (weewx.debian in $WEEWX_ROOT/util/init.d/) – for this I used nano…


    NOTE the addition of the “system25” directory!

    I then followed instructions as per the weewx users guide…

    “cp /home/weewx/system25/util/init.d/weewx.debian /etc/init.d/weewx” (copies script to correct location)
    “chmod +x /etc/init.d/weewx”
    “update-rc.d weewx defaults 98”

    I then tried to run with “sudo /etc/init.d/weewx start” but then got an error regarding permissions on “weewx.pid”, so…

    I created the file (which didn’t seem to exist) “weewx.pid” in “var/run” using nano (just type “nano weewx.pid” while in that folder, then save, CTRL +0, then exit, CTRL +E). This creates an empty file

    He presto, it runs after boot.

    NOTE you may need to use the “chmod” command to change permissions on the “var/run/weewx.pid” file… If you type ‘sudo /etc/init.d/weewx start” and you get a permissions error on “var/run/weewx.pid’, then you will need to do this…

    Hope this helps…


  11. Does anyone have WeeWX preinstalled that can easily be copied onto a SD card? I.E. A quick starrt?

    • I’m no longer using a RPi but have a Cubie Truck with SATA drive. You could try the Weewx Google group?

  12. Hi Chris,

    Thanks a Lot!! Finally my raspberry Pi with Xbee and Vantage Vue up and running. I really didn’t know you could use wee_reports, this solved a lot for me. Do I need to install extra software to use your template Byteweather_ver003.zip? I followed all your recommedations and not all your backgrounds are vissible (see my website)

    Thanks in advanced


  13. Hi Chris,

    I successfull implemented your template …Thanks!! Because I have a xbee connected to the raspberry pi I edit weewx.conf to software because I do not have a datalogger. My log files seems ok and let me know everything is uploaded but when I check it wasn’t. Also it keeps getting archives from earlier dates and my website is not updated as well? see http://members.ziggo.nl/kanis01. Do you have any suggestions?

    Thanks Michiel

  14. Hi Chris,

    I’ve got it all working now with your template! Thanks. Could you let me know how to enable rsync to my synology NAS?

    Regards Michiel

  15. Pingback: Weewx On Cubie Truck

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.