This is a time and weather station for your Raspberry Pi. It displays the current time and weather conditions with beautiful, AI-generated wallpapers that change based on the time of day and weather.
- Time × Weather combinations: Loops through every entry in both JSON maps.
- Time examples:
sunrise,morning,midday,afternoon,sunset,dusk,evening,night - Weather examples:
CLEAR,PARTLY_CLOUDY,RAIN,SNOW,THUNDERSTORM, etc.
- Time examples:
- Style packs: Choose from multiple art directions (e.g., minimal-gradient, flat-illustration, neon-glow).
- Prompt saving: Each generated image has its prompt stored in
_prompts/for audit/re-use. - Auto-resize/crop: Images are automatically resized to match your configured window dimensions (default: 1000x600).
- CLI options: Control style, size, backoff timing, output directories, etc.
- Raspberry Pi OS (Bookworm/Bullseye) on a Pi 4 or Pi 5
- Python 3.11+ recommended 3.13
- OpenAI API key
- Dependencies:
openai,pillow,PyQt5
Update your Raspberry Pi system and install basic dependencies:
sudo apt update
sudo apt upgrade -y
sudo apt install -y git python3 python3-pip python3-venv
python3 --version✅ Recommended: Python 3.13
Navigate to your preferred project directory and clone the repository:
cd ~/repos # or your preferred location
git clone mobjack/weatherPi
cd weatherPiCreate and activate a Python virtual environment:
cd <to path where clone was downloaded>
python3 -m venv .venv
source .venv/bin/activate
pip install --upgrade pip wheelConfirm it's active:
python -VThis project uses PyQt5 for the on-screen user interface. Choose one of these options:
This installs the prebuilt Qt and PyQt5 packages for Raspberry Pi OS:
sudo apt install -y python3-pyqt5 pyqt5-dev-tools qtbase5-dev qt5-qmakeIf you want the apt-installed PyQt5 accessible inside your virtual environment, recreate it with system packages visible:
deactivate # if your venv is active
python3 -m venv .venv --system-site-packages
source .venv/bin/activateTest that PyQt5 works:
python -c "from PyQt5 import QtCore; print(QtCore.QT_VERSION_STR)"This is the fastest and most reliable option on Raspberry Pi.
If you prefer PyQt5 isolated inside the virtual environment, you can build from source:
-
Install the Qt development headers and required libraries:
sudo apt update sudo apt install -y build-essential python3-dev qtbase5-dev qtbase5-dev-tools qtchooser qt5-qmake libgl1-mesa-dev libxkbcommon-x11-0 libxcb-xinerama0
-
Activate your venv and install PyQt5:
source .venv/bin/activate pip install --upgrade pip wheel sip pip install PyQt5>=5.15.11
-
Verify
qmakeexists if build errors occur:which qmake || echo "qmake missing" qmake -v
⚠️ Building may take several minutes. For Python 3.13, consider using Option A.
Install the remaining project dependencies:
If your project has a requirements.txt file:
pip install -r requirements.txtOtherwise install manually:
pip install openai pillowCopy the example configuration file and update it with your settings:
cp conf/weather.conf.example conf/weather.confEdit conf/weather.conf and update these required settings:
Required API Keys:
OPENAI_API_KEY- Your OpenAI API key for AI-generated wallpapersOPENWEATHER_API_KEY- Your OpenWeatherMap API key for weather data
Location Settings:
LOCATION_ZIP_CODE- Your zip code for weather dataLOCATION_NAME- Your city and state name
Optional Settings (defaults work fine):
USE_TEXT_ICONS/USE_IMAGE_ICONS- Choose between text or image weather iconsTIME_UPDATE_INTERVAL- How often time display updates (default: 1 minute)WEATHER_UPDATE_INTERVAL- How often weather data refreshes (default: 30 minutes)WINDOW_WIDTH/WINDOW_HEIGHT- Window dimensions in pixels (default: 1000x600)MOTION_SENSOR_PIN- GPIO pin for motion sensor (default: 18)DISPLAY_TIMEOUT- How long display stays on after motion (default: 60 seconds)MOTION_TEST_MODE- Set totruefor testing without hardware
Window Configuration:
The application window size can be customized to match your display or preferences:
# Window Configuration
# Window dimensions (width x height)
WINDOW_WIDTH=1000
WINDOW_HEIGHT=600Common display sizes:
- Raspberry Pi 7" Touchscreen:
WINDOW_WIDTH=800WINDOW_HEIGHT=480 - Standard Desktop:
WINDOW_WIDTH=1000WINDOW_HEIGHT=600 - Wide Display:
WINDOW_WIDTH=1200WINDOW_HEIGHT=800 - Full HD:
WINDOW_WIDTH=1920WINDOW_HEIGHT=1080
The wallpaper generator will automatically use these same dimensions to ensure perfect fit.
Run your application to confirm everything works:
source .venv/bin/activate
python bin/weather_ui.pyYou should see your PyQt5 interface display without errors.
| Problem | Fix |
|---|---|
qmake not found |
sudo apt install -y qt5-qmake |
| "xcb plugin" error | sudo apt install -y libxcb-xinerama0 |
| No PyQt5 wheel for Python 3.13 | Use Option A (apt) or downgrade to Python 3.11 |
| GUI fails under Wayland | Install X11: sudo apt install -y xserver-xorg |
| Wrong Python version | python3 -m venv --upgrade .venv && source .venv/bin/activate |
| API key not found | Ensure OPENAI_API_KEY environment variable is set |
Once setup is complete, you can run the application:
# Activate virtual environment
source .venv/bin/activate
# Run the main weather application
python bin/weather_app.py
# Or run the wallpaper generator
python bin/generate_wallpapers.pyThis setup ensures consistent behavior across macOS (development) and Raspberry Pi (deployment) environments using PyQt5.