Various Python scripts that attempt to display weather data (either via Dark Sky or Open Weather Map) on various Raspberry Pi related HATs or pHATs including:
- A suitable HAT or pHAT and their accompanying libraries
- python-forecast.io
- dark-sky-python wrapper
- You'll need an API key for Dark Sky API or for Open Weather Map
Install the libraries for your HAT or pHAT:
Clone this repository:
git clone https://github.com/raspberrycoulis/weather-pi-data.git
Then, install the Dark Sky Python API wrapper:
git clone https://github.com/raspberrycoulis/dark-sky-python.git
cd dark-sky-python
sudo python setup.py install
Find your latitude and longitude here.
For simplicity, there is a config.ini
file inside the config
directory. Add your Dark Sky / Open Weather Map details there.
When running the darksky-dot3k.py
script, the Display-o-Tron 3000 does a number of things:
- Displays the temperature, humidity and chance of rain in a readable format
- The backlight of the display changes colour to reflect the UV index:
- Green = low UV index
- Yellow = moderate UV index
- Orange = high UV index
- Red = very high UV index
- Violet = extreme UV index
- The LED bar-graph will also show the chance of rain, with the more lights visible showing a higher chance
- Pressing the joystick button will exit the code and shut off the display.
The blinkt-uvindex.py
script will pull the current UV Index and changes the colour of the Blinkt accordingly:
- Green = low UV index
- Yellow = moderate UV index
- Orange = high UV index
- Red = very high UV index
- Violet = extreme UV index
It will also print out the UV index in the console. Exit with
CTRL+C
to exit cleanly. The Blinkt will be turned off.
The blinkt-rain.py
script works similar to the UV Index one, but shows the probability of rain in 1 hour and changes the colour of the Blinkt accordingly:
- Green = very low chance of rain
- Yellow = low chance of rain
- Orange = moderate chance or rain
- Red = high chance of rain
- Blue = extreme chance of rain
It will also print out the chance of rain in the console. Exit with
CTRL+C
to exit cleanly. The blinkt will be turned off.
The darksky-papirus.py
script is similar to the Display-o-Tron 3000, except it will simply display the current weather details on the screen. Exit with CTRL+C
which will also clear the PaPiRus after displaying a goodbye message.