espeak + weather-util + cron = a fun little talking weather program
“What’s the weather going to be like today?” – in Iowa this is an especially relevant question. The weather seems to change day to day. With this little setup, now have weather retrieved and spoken to us.
espeak
https://help.ubuntu.com/community/TextToSpeech
espeak is already installed on Ubuntu Linux.
weather-util
http://manpages.ubuntu.com/manpages/natty/en/man1/weather-util.1.html
So install weather-util:
> sudo apt-get install weather-util
Setup our bash shell script:
#!/bin/bash
## check out this list! http://weather.noaa.gov/pub/data/forecasts/
## http://aviationweather.gov/adds/metars/stations.txt Iowa City is KIOW, Cedar Rapids is KCID
CURRENTWEATHER=$(weather-util -i KCID)
# speak english with Scottish accent
espeak -s 110 -v en-sc "Todays weather is $CURRENTWEATHER"
espeak -s 110 -v en-sc "What! You want the Forecast too? This is only my first day! "
Save to a file , say ‘/home/gare/readWeather.sh’.
Make File Executable:
> chmod u+x /home/gare/readWeather.sh
Setup our crontab schedule for 6 am:
> crontab -e
# at 5 a.m every week with:
0 6 * * * /home/gare/readWeather.sh
Done!
For extra fun, set this up on a netbook , and set under your wife’s bed for a wakeup surprise!
If interest I can post a script that reads the current time as well.
modified for espeak from this thread : http://ubuntuforums.org/showthread.php?t=928060&page=2 and updated to use espeak