Automatically analyze and compare weather forecasts from multiple APIs and public sources, generate a clean, insightful summary with ChatGPT, and send it daily via Pushover β fully automated with GitHub Actions.
The automation runs daily at 21:00 and consists of three main Python scripts:
- Purpose: Fetch forecast data from:
- OpenWeatherMap
- WeatherAPI
- Output:
- JSON summary β
docs/{city}_forecast.json - PNG comparison chart β
docs/{city}_comparison.png
- JSON summary β
- Includes:
- Average temperature & rain probability
- High/low temperatures
- Comparison between both APIs
-
Purpose:
- Reads each city's forecast JSON
- Scrapes forecast data from public sources:
- YR.no
- Meteoblue
- MΓ©tΓ©o France (for Paris) or MΓ©tΓ©o Belgique (for Brussels)
- Uses GPT-4 (OpenAI API) to:
- Compare forecasts only between 09:00β21:00
- Assess confidence in API predictions
- Add a human-readable, natural-language
gpt_comment - Classify alignment as:
full,partial, ordivergent - Comment intelligently avoids vague phrases like βmost forecasts agreeβ unless exceptions are made explicit
-
Output:
- Appends
gpt_commentandalignmentto each city's forecast JSON - Comments are short, optionally playful, and context-aware (e.g., βcozy Sundayβ, βgood start to the weekβ)
- Appends
- Purpose:
- Reads enriched forecast JSON + PNG chart
- Sends a clean and structured Pushover notification per city
- Includes:
- Summary (from JSON)
- GPT insight comment
- Attached PNG chart
- Title includes alignment emoji (β
,
β οΈ , β)
- Multi-user support: You can add multiple recipients by comma-separating user keys in the
PUSHOVER_USER_KEYsecret
- Trigger: Daily at 21:00 CET (19:00 UTC)
- Uses
main.ymlworkflow andGH_PATsecret to auto-commit outputs (not the defaultGITHUB_TOKEN)
- OpenWeatherMap
- WeatherAPI
- OpenAI GPT-4 API
- HTML scraping of YR.no, Meteoblue, MΓ©tΓ©o France, and MΓ©tΓ©o Belgique using BeautifulSoup
- Rate-limiting and errors are handled
- All outputs saved to
docs/folder - Publicly accessible via GitHub Pages for chart access if needed
- Uses Pushover for direct push alerts
- Image, text, and summaries are sent with rich formatting + emojis
- One message per city, combining summary + GPT insight + PNG chart
- GPT comment is parsed to detect forecast agreement level:
alignment = "full"β forecasts agreealignment = "partial"β minor differences or slight outlieralignment = "divergent"β major mismatch (e.g. rain vs no rain)
Forecast validation includes scraped data from trusted meteorological services, chosen for their reputation and accuracy:
- YR.no π³π΄ β From the Norwegian Meteorological Institute, widely praised for scientific rigor across Europe.
- MΓ©tΓ©o France / MΓ©tΓ©o Belgique π«π· π§πͺ β Official government agencies, known for high-resolution local accuracy.
- Meteoblue π β Swiss-based ensemble forecaster, known for clarity and consistency across Europe.
These sources form a "ground truth" to assess API forecasts.
- Temperature lines:
- π΄ OpenWeatherMap
- π WeatherAPI
- β« Average temp (thin dotted line)
- Rain lines (dashed bars):
- π΅ OWM
- πΉ WeatherAPI
- Grey Band: Fills the gap between the OWM and WeatherAPI temperature forecasts to show uncertainty/disagreement β clearly visible but not intrusive
- Heat Bands:
- Warm zone (24β29.9Β°C): light pink (
mistyrose,alpha=0.12) - Hot zone (30Β°C+): darker red (
lightcoral,alpha=0.2) - Deliberate alpha choices ensure the consensus band remains clearly visible even in hot or warm conditions
- Warm zone (24β29.9Β°C): light pink (
- Labels at 12:00 & 18:00
- Title format:
Paris Tomorrow β Day Forecast
- β Daily GitHub Action is live
- β JSON & PNG generated for Paris and Brussels
- β ChatGPT analysis integrated
- β Alignment detection working
- β Pushover notification fully automated π
scripts/
βββ weather_notify.py # Fetch APIs + generate chart
βββ compare_and_analyze.py # Scrapes + GPT + alignment tagging
βββ send_to_pushover.py # Push alert sender (final step)
docs/
βββ paris_forecast.json # JSON summary
βββ paris_comparison.png # Chart with annotated lines
βββ brussels_forecast.json
βββ brussels_comparison.png- Daily at 21:00 CET
Add these under GitHub β Settings β Actions β Secrets:
GH_PAT=your_personal_token
OPENWEATHER_API_KEY=your_openweather_key
WEATHERAPI_API_KEY=your_weatherapi_key
OPENAI_API_KEY=your_openai_key
PUSHOVER_API_TOKEN=your_app_token
PUSHOVER_USER_KEY=your_user_key[,your_boyfriends_key]You can add multiple user keys by comma-separating them. No spaces.
- Create a file
weather.env:
PUSHOVER_USER_KEY=your_user_key
PUSHOVER_API_TOKEN=your_pushover_token
OPENWEATHER_API_KEY=your_openweather_key
WEATHERAPI_API_KEY=your_weatherapi_key
OPENAI_API_KEY=your_openai_key- Install dependencies:
pip install -r requirements.txt- Run manually:
python scripts/weather_notify.py
python scripts/compare_and_analyze.py
python scripts/send_to_pushover.py- Expand to more cities (e.g., Amsterdam, Berlin)
- Weekend trends or weekly summaries
- Archive via GitHub Pages
- UI dashboard for review
Pushover Message:
Paris: βοΈ Avg 27.1Β°C (0Β°C range), 0% rain
High 31Β°C / Low 22Β°C
π€ GPT: Forecasts align well β looks like a warm, dry day. Perfect for a stroll by the Seine.
π Chart attached.Q: Can I add someone else to receive alerts?
A: Yes, just update your secret:
PUSHOVER_USER_KEY=your_key,partner_keyPushover will send to both recipients at once.
Built for curiosity, consistency, and comparing clouds βοΈ