The Weather driver connects to the free prevision-meteo.ch API to retrieve weather forecast data for locations in Switzerland, France, and Belgium. It automatically creates addresses for all available weather parameters (temperature, humidity, wind, rain, cloud cover, etc.).
This is useful for:
Driver key:
previsionMeteo— listed as Weather (Switzerland, France, Belgium) under Other in Gateway driver. For a site outside these countries, or for parameters such as solar radiation, use Meteomatics. To choose between the two: Using weather data in routes and logics.
https://www.prevision-meteo.ch (outbound HTTPS, TCP port 443). No inbound port is needed.lausanne.At the first answer of the service, the driver creates one address per value, prefixed with %weather:. Open the address table of the gateway and check that %weather:current_condition_tmp shows the current temperature.
Name, Cluster ID and Description are common to all drivers: see Gateways.
| Label | JSON Key | Default | Description |
|---|---|---|---|
| Locality | json.locality |
(empty) | Key of the locality in prevision-meteo.ch. Use the search dialog to find your city by name, postal code (NPA) or region. |
{
"locality": "lausanne"
}
Addresses are automatically created and named %weather:<path>, where <path> is the position of the value in the prevision-meteo.ch answer, with levels joined by _. Examples: %weather:current_condition_tmp (current temperature), %weather:fcst_day_0_tmax (today's maximum). They cannot be manually inserted or removed. All weather parameters from the prevision-meteo.ch API are exposed as routable and loggable addresses.
Addresses are refreshed every 8 to 18 minutes (the interval is random and cannot be configured). An address whose value disappears from the answer of the service is deleted.
| Address | Content |
|---|---|
%weather:city_info_name, ..._country, ..._latitude, ..._longitude, ..._elevation |
Location. |
%weather:city_info_sunrise, %weather:city_info_sunset |
Sunrise and sunset time. |
%weather:current_condition_tmp |
Current temperature. |
%weather:current_condition_humidity, ..._pressure |
Current humidity and pressure. |
%weather:current_condition_wnd_spd, ..._wnd_gust, ..._wnd_dir |
Current wind speed, gusts and direction. |
%weather:current_condition_condition |
Current conditions as text (in French). |
%weather:fcst_day_<d>_tmin, ..._tmax, ..._condition, ..._date, ..._day_long |
Daily forecast; <d> is 0 for today, 1 for tomorrow, and so on. |
%weather:fcst_day_<d>_hourly_data_<h>H00_<FIELD> |
Hourly forecast, for example %weather:fcst_day_0_hourly_data_14H00_TMP2m. Fields: TMP2m (temperature, °C), DPT2m (dew point), WNDCHILL2m (wind chill), RH2m (relative humidity, %), PRMSL (pressure, hPa), APCPsfc (precipitation, mm), WNDSPD10m and WNDGUST10m (wind and gusts, km/h), WNDDIR10m (wind direction, degrees), ISSNOW (0 = rain, 1 = snow), HCDC / MCDC / LCDC (high, medium and low cloud cover), HGT0C, KINDEX, CAPE180_0, CIN180_0, CONDITION (text). |
Three kinds of addresses are computed by the gateway:
| Address | Content |
|---|---|
%weather:sunriseSunsetOffset |
Length of the day in minutes (sunset minus sunrise). |
%weather:fcst_day_<d>_sunshineAverage |
Estimated share of clear sky for the day, in %, derived from the three cloud layers. |
%weather:fcst_day_<d>_data_TMP2m, ..._data_RH2m, ..._data_APCPsfc |
The hourly values of the day as one array (index = hour). |
Log and Store value work the same way for every driver: see Log and Store value policies.
| Property | Value |
|---|---|
| Readable | No (values are pushed periodically from the API) |
| Writable | No |
| Created automatically | Yes, at each answer of the service |
| Routable | Yes |
| Loggable | Yes |
Create a route with %weather:current_condition_tmp as source and, as destination, an analog value of a BACnet gateway or a KNX group address of type temperature (DPT 9.001). The controller then receives the outdoor temperature at each refresh, every 8 to 18 minutes.
Route %weather:fcst_day_1_tmin (tomorrow's minimum) to an SMTP or SMS address with a routing function that returns a message only when the value is at or below 0 °C, and nothing otherwise. The function and more examples (sun protection, wind alert): Using weather data in routes and logics.
A forecast describes an area and is refreshed every few minutes: it does not replace a local sensor where safety is involved (wind alarm of blinds, frost protection of a plant). For a local weather station, see Thies Clima.
| Symptom | Cause | What to do |
|---|---|---|
No address is created; the log shows API response contains error field |
The Locality is not known by prevision-meteo.ch (typed by hand, or a key that no longer exists). | Choose the locality again with the search dialog. |
No address is created; the log shows request to ... failed (retry in 6s) |
The gateway cannot reach www.prevision-meteo.ch (no Internet access, DNS, firewall). |
Check the network settings of the device and allow outbound HTTPS. The driver retries every 6 seconds. |
| The search dialog of Locality shows an error or stays empty | Same cause: the list of localities is downloaded from the service. | As above. |
| A value does not change for several minutes | Normal: the forecast is refreshed every 8 to 18 minutes. | — |
| An address used in a route has disappeared | The service no longer returns this value, so the address was deleted. | Use another field, or recreate the route when the value comes back. |
To read the driver log, open the menu ☰ of the gateway and choose Logs (see Logs of a gateway). The request ... failed messages are warnings: raise the level to warn to see them.