Configuring weather.ini

You should really be following the instructions by Jim Easterbrook, but here I describe the setup on my standard image.
I assume you have already completed the first 2 tutorials and the weather station can talk to the pi

The Objective

The objective is to configure the weather.ini file so that it writes example data to files on the Raspberry Pi. This does not require a web site setting up, but it is then quite easy to redirect the output to your web site instead.

Step 1 - Downloading the data

Connect your weather station and run the Logdata command to create create a dummy weather.ini file in ~/weather/data using

  • python -m pywws.LogData -vvv ~/weather/data

You can now edit this file using Jim Easterbook's instructions or if you are using a Maplin Weather station, download one I created earlier using

  • wget http://weather.dragontail.co.uk/custom_download/weather.ini -O ~/weather/data/weather.ini

Run the logdata command again to download stored weather information from the station. This can take some time.

  • python -m pywws.LogData -vvv ~/weather/data

You should now have some data files in the data directory
Check using

  • ls ~/weather/data/raw

These are just the raw data files and they need to be processed using

  • python -m pywws.Process ~/weather/data

Step 2 - Outputing the data

The supplied weather.ini file is designed to output text and graphics to the directory ~/webdata
The ini file specifies which templates are used and at what intervals.

In order to produce some output the Hourly command needs to be run at regular intervals.
Try the command manually first

  • python -m pywws.Hourly -vvv ~/weather/data

This should produce a number of output files in ~/webdata directory. To see them type

  • ls ~/webdata

These are the files that could go to your web site for publication to the world.
In order to do this the ~/weather/data/weather.ini file needs to be edited and the ftp section changed
[ftp]
local site = False
secure = False
site = ftp.your_isp.co.uk
user = username
password = userpassword

Step 3 - Automating the data

In order to run the Hourly command at regular intervals, a crontab needs to be setup.
This is achieved using

  • crontab -e

Then edit the file to include the line

  • 5 * * * * python -m pywws.Hourly ~/weather/data >> /home/pi/weather.log 2>&1

Save this and the pywws program will access your weather station every 10 mins and output html code or graphics to your web site or to ~/webdata

Next - Using a prebuilt image