← /research

Open-Meteo Weather API

Processing · Reading Notes Created Jan 4, 2025

Source

Open-Meteo Documentation — Open-Meteo (Article)
View source →
Project: eink-training-display
apiweatherpython

Weather data source for the eink training display spec. Free, no API key, open source.

Why Open-Meteo

  • Free for non-commercial use
  • No API key required
  • Multiple weather models (ECMWF, GFS, etc.)
  • Historical data available
  • FlatBuffers format for efficient data transfer

Python Client

pip install openmeteo-requests requests-cache retry-requests
import openmeteo_requests
import requests_cache
from retry_requests import retry

# Setup cached session (recommended)
cache_session = requests_cache.CachedSession('.cache', expire_after=3600)
retry_session = retry(cache_session, retries=3, backoff_factor=0.5)
client = openmeteo_requests.Client(session=retry_session)

# Query
params = {
    "latitude": 37.7749,
    "longitude": -122.4194,
    "current": ["temperature_2m", "weather_code"],
    "daily": ["temperature_2m_max", "temperature_2m_min"],
    "timezone": "auto"
}

responses = client.weather_api(
    "https://api.open-meteo.com/v1/forecast",
    params=params
)
response = responses[0]

# Access data
current = response.Current()
temp = current.Variables(0).Value()  # temperature_2m
code = current.Variables(1).Value()  # weather_code

WMO Weather Codes

The API returns WMO standard weather codes:

CodeDescription
0Clear sky
1-3Mainly clear → Overcast
45, 48Fog
51-55Drizzle
61-65Rain (light → heavy)
71-75Snow (light → heavy)
80-82Rain showers
95-99Thunderstorm

Caching Strategy

For an e-ink display updating every 15-30 minutes:

# Cache for 30 minutes
cache_session = requests_cache.CachedSession(
    'data/cache/weather',
    expire_after=1800  # 30 min
)

This avoids hammering the API and provides offline resilience.

Available Variables

Current: temperature, humidity, weather_code, wind_speed, precipitation

Daily: max/min temp, precipitation probability, sunrise/sunset

Hourly: Full forecast data (not needed for dashboard)

Rate Limits

No hard limits for reasonable usage. The caching approach keeps requests minimal.