This is a fork from the excellent repo created by caternuson
That includes the initial integration with the metoffice.gov.uk API, but I have since updated this version to include:
- New elements in ICON_MAP to cover all the numbers from 1 to 39 (to (potentially) cover the full extremes of the British weather)
- New elements in ICON_MAP to cover partially cloudy and foggy days, plus hail. Not the best, I admit, but will do for now...
- Alternating display between weather type for the day and maximum temperature using loops, so script can be started once on bootup then run continuously, rather than running via cron
- Night-time weather type and minimum temp display for the current day when current time goes past 6pm
- Logging to file rather than to console
- Alternating weather type/temperature display
- Numeric elements to ICON_MAP
- New weather type elements to ICON_MAP
- Night-time weather and minimum temp for current day
- Logging to file
- Negative numeric elements to ICON_MAP
- Set RPi up to automatically run script from start via init.d
- Full setup notes for going from a blank SD card to a fully working rpi-weather config (so should I brick it somehow I don't have to hunt around to set it all up again...)
- Wipe my SD card and try the notes below, to check if they are correct
- Install raspbian-lite
- Boot up and change pi user password from default raspberry -
passwd
- Create new user so can delete pi once happy all is in place -
sudo addusr xyz
- Add user to sudo -
sudo visudo
- Change default editor to vim -
sudo update-alternatives --set editor /usr/bin/vim.tiny
- Log on as new user xyz
- Update apt-get -
sudo apt-get update
- Install git to make it easy to get the repo in the RPi, and make/get changes as needed -
sudo apt-get install git
- Create non-sudo user to run script under, hopefully makes things more secure? -
sudo addusr abc
- Install normal vim -
sudo apt-get install vim
- Add support for wifi dongle -
sudo vim /etc/wpa_supplicant/wpa_supplicant.conf
- Update it to include the following (as seen here)-
network={ ssid="YOUR-SSID" psk="PASSWORD" }
- Shutdown the RPi, disconnect the ethernet cable and plug in the USB wifi dongle
- Restart the RPi, should now be on the wifi network
- Change the hostname (as detailed here) to something more unique:
*sudo vim /etc/hosts
*sudo vim /etc/hostname
*sudo /etc/init.d/hostename.sh
16. Restart the RPi - sudo shutdown -r now
17. Configure i2c to work on the RPi (as detailed here):
*sudo apt-get install python-smbus
*sudo apt-get install i2c-tools
*sudo raspi-config
18. Restart the RPi - sudo shutdown -r now
19. Connect up the LED matices and check i2c is up and running - sudo i2cdetect -y 0
(Using 256Mb Model A RPi so need 0
on end, rather than 1
for subsequent models)
20. Install the adafruit LED backpack library (as described here) :
*sudo apt-get update
*sudo apt-get install build-essential python-dev python-imaging
*Navigate to home directory for new non-sudo user account abc
*git clone https://github.com/adafruit/Adafruit_Python_LED_Backpack.git
*cd Adafruit_Python_LED_Backpack
*sudo python setup.py install
- Clone this repo into that same home directory for abc
- To get this script to run on startup edit rc.local -
sudo vim /etc/rc.local
- Add the following line before the
exit 0
line -python /home/weather/rpi-weather/weather_metoffice.py &
- Restart the RaspberryPi and the displays should start showing the weather automatically -
sudo shutdown -r now