Blueprint: Météo France — Rainfall accumulation over the last N days (French weather API)
Hi everyone,
I’d like to share a blueprint I put together for anyone gardening, watering automatically, or generally caring about rainfall history: it pulls the cumulative precipitation (mm) over the last N days from Météo France’s official Climatologie - Données Publiques de Météo-France (DPClim) API and writes the result into an input_number.
Heads up for non-French users: this blueprint is written and documented in French, since it relies entirely on Météo France’s public API — it will only return useful data for stations located in France (metropolitan or overseas). If that’s not your situation, it probably won’t be directly useful to you, but feel free to take a look at the logic if you’re building something similar against another national weather API.
What it does
- Computes a date range (today minus N days) and requests a “commande” (production order) from Météo France’s climatology API for a given station.
- Polls a second endpoint until the resulting CSV file is ready (or a max retry count is reached).
- Parses the CSV, sums the
RR(rainfall) column, and writes the total (mm) to aninput_numberof your choice. - Logs a clear
errorentry (and stops cleanly) if either the initial request or the file download fails — no more silent failures on an invalid API key or an unavailable station.
Configurable inputs
- Station ID — a fixed value, or a template referencing an
input_text/input_numberhelper (e.g.{{ states('input_number.my_station') }}). Automatically zero-padded to 8 digits. - API key — passed through to your
rest_commandcalls (password-masked field). - Number of days to look back (default: 3).
- Target
input_numberentity to store the result. - rest_command names, in case you want several instances pointing at different
rest_commandpairs. - Max retry count for the file download step.
- Daily trigger time.
Requirements
You’ll need a free Météo France API key from portail-api.meteofrance.fr for “Données Climatologiques” API, and two rest_command entries in your configuration.yaml pointing at the DPClim v1 API (https://public-api.meteofrance.fr/public/DPClim/v1). The blueprint description includes a ready-to-paste example.
You’ll also need your station’s numeric ID, which you can find in Météo France’s station metadata dataset. I’d recommend sticking to station_type 0, 1, or 2 for reliable daily data.
Blueprint
Feedback and suggestions welcome — this is part of a larger automation I use to decide how long to water my tomatoes based on recent rainfall, happy to share that too if there’s interest.