Projects‎ > ‎

Current weather

The idea is that we are going to retrieve a weather forecast from yr.no and a computer will generate an audio file using Espeak(text-to-speech software), that contains a forecast for the next 12 hours. The computer will then play the audio file, every morning, using a cron job.

I will be installing the espeak software on a computer that use Debian:

# sudo apt-get install espeak

To be able to get the forecast every morning must we fist collect before the forecast before 06:00:
50 05 * * 0-6 /home/robert/projekt/current_weather/grab-forecast

and we must also add a cron-job to be able to get a speaking weather alarm clock:
10 06 * * 0-6 /home/robert/projekt/current_weather/play-forecast

The actual handling of the weather forecast is done in the python-script: get_current_weather.py.
We will be using a simple Python scripts that parses the xml-fle, that is retrieved from yr.no



The script will generate the following weather report, based on the xml-file above:
Weather forecast for March  05. Before midday: It will be Cloudy and the temperature will be -6 degrees. Wind: Light air  from East-northeast. Afternoon: It will be Fair and the temperature will be 1 degrees. Wind: Gentle breeze from East.


Ć
forecast.wav
(885k)
Robert Eklund,
Mar 4, 2012, 7:58 AM
ċ
get_current_weather.py
(2k)
Robert Eklund,
Mar 4, 2012, 8:10 AM
ċ
grab-forecast
(0k)
Robert Eklund,
Mar 4, 2012, 7:59 AM
ċ
play-forecast
(0k)
Robert Eklund,
Mar 4, 2012, 7:59 AM
Comments