This script fetches real-time weather data for the specified latitude and longitude using the Open-Meteo API. It generates a two-frame animated GIF:
- Frame 1: Displays the current weather condition icon (e.g., sunny, cloudy, rainy) based on the weather code.
- Frame 2: Displays the current temperature in Celsius, rendered with a dynamic colour that corresponds to the temperature range (e.g., cooler tones for low temperatures, warmer tones for high temperatures).
The generated GIF is automatically sent to the connected dot-matrix display via the python3-idotmatrix-client
library. By default, the script updates the weather information every 30 minutes, but this interval can be customised in the configuration file (config.ini
).
Make sure the python3-idotmatrix-client
is installed or accessible in your Python environment. If it is not, navigate to the python3-idotmatrix-client
directory and install it using:
pip install .
Navigate to the idotmatrix-weather
directory in your console and run:
pip install requests pillow
Edit the config.ini
file to update the following parameters as needed:
-
latitude
: Your location's latitude -
longitude
: Your location's longitude -
timezone
: Your location's timezone using TZ format -
device_address
: Address of your display device gathered from the python3-idotmatrix-client with the--scan
command -
frame_duration
: Duration of each frame in milliseconds (eg.g, 1000 = 1 second) -
update_interval
: Update interval in seconds (e.g., 1800 = 30 minutes). Please respect the Open-Meteo API and don't set this to update too often.[settings] latitude = YOUR_LATTITUDE longitude = YOUR_LONGITUDE timezone = YOUR_TIMEZONE device_address = YOUR_DEVICE_ADDRESS frame_duration = 3000 update_interval = 1800
Execute the script to fetch weather data, generate a GIF, and send it to the display:
python weather_display.py
Check the console for debug messages and debug
directory for generated GIFs or rendered frames in case of issues.
Temperature Range (°C) | Colour Description | Example HEX Value |
---|---|---|
≤0 | White (Freezing or below) | #FFFFFF |
1-5 | Dark Blue | #0000CC |
6-10 | Medium Blue | #3333FF |
11-15 | Light Blue | #6699FF |
16-19 | Sky Blue | #99CCFF |
20-29 | Light Orange | #FFCC99 |
30-39 | Orange | #FFA500 |
40-50 | Bright Red | #FF4500 |
≥51 | Dark Red (Extreme Heat) | #990000 |
-
idotmatrix-weather script by:
- @artywah.bsky.social
- With a lot of help from ChatGPT
-
Weather data provided by:
- Open-Meteo
- License: Free for non-commercial use
-
Original weather icons:
- Source: Iconset: Weather Color
- Author: Sihan Liu
- License: Free for commercial use