Skip to main content
Data Connectors · Weather

DWD Weather

The node downloads the MOSMIX point forecast of the German Weather Service (DWD) for one or more weather stations, interpolates the values to the current time and emits them as flat WeatherObserved and WeatherForecast objects. Stations are selected on a map with address search and radius filter.

  • Data source
  • Trigger-based
  • WeatherObserved
Node type
hypertegrity-dwd-weather
Package
@htag/node-red-contrib-hypertegrity-weather
Inputs / outputs
1 / 2
Data source
DWD Open Data, MOSMIX_L (KMZ per station)

When to use this node​

With MOSMIX, the DWD publishes hourly updated point forecasts for more than 5,000 stations worldwide free of charge. The DWD Weather node brings this data into a Node-RED flow without any KML processing on your side. It handles the download of the compressed file, the extraction, memory-efficient parsing and the conversion to metric units.

Typical use cases are:

  • Current weather for a municipality transferred into an NGSI-LD context broker as a WeatherObserved object.
  • Hourly forecasts for dashboards, irrigation control or energy forecasting.
  • Several stations bundled in one node, for example all stations of a district.
  • Specific MOSMIX elements such as wind gusts, sunshine duration or global radiation added to the output.

How the node works​

1

Trigger

An incoming message starts the fetch. The node never polls the DWD on its own.

2

Download and parse

For every configured station the MOSMIX_L_LATEST KMZ file is downloaded, extracted and read as a stream. The station catalog is refreshed once a day.

3

Interpolate

The hourly forecast values are interpolated linearly to the current time or to each forecast hour.

4

Emit

Output 1 receives one WeatherObserved object per station, output 2 an array of WeatherForecast objects.

Result: Flat weather objects in metric units that can be passed directly to the NGSI-LD Builder.

The node is trigger-based. Combine it with an Inject node that fires at a fixed interval. Since the DWD renews the MOSMIX_L files every hour, an interval of 60 minutes is appropriate. For every station the complete KMZ file is downloaded on each trigger; parallel downloads of the same station are not started.

For output 1 the node interpolates the MOSMIX values to the current time and emits the result as WeatherObserved.

Configuration​

The edit dialog is divided into three tabs. On the Weather Observed and Weather Forecast tabs you select stations on a map: search for an address or city, set a radius between 5 and 100 km, filter the list, click individual stations or select all visible ones. Alternatively, enter station IDs manually. The map loads the station list from the configured station catalog and uses the Nominatim service of OpenStreetMap for the address search.

Tab "Weather Observed"​

FieldTypeDefaultMeaning
NameTextemptyDisplay name of the node in the flow.
Manual ID(s) / station selection (mosmixStation)Text, comma-separatedempty, requiredDWD station IDs for output 1. The selection also applies to output 2 unless separate forecast stations are defined.

Tab "Weather Forecast"​

FieldTypeDefaultMeaning
Look-ahead (lookAheadHours)Number0Period for which hourly forecasts are generated. 0 means no forecast, current values only.
Unit (lookAheadUnit)Select Hours / DaysHoursUnit of the look-ahead. Days are multiplied by 24 internally.
Use specific stations for forecast (useForecastStation)CheckboxdisabledEnables a separate station selection for output 2.
Forecast station selection (forecastStation)Text, comma-separatedemptyStation IDs for output 2. Only effective when the checkbox is enabled.

Tab "Advanced"​

FieldTypeDefaultMeaning
Topic (topic)TextemptySet as msg.topic on both outputs.
Detailed forecast elements (detailedElements)Selection per station and role{}Additional MOSMIX elements appended to the output of a specific station. First choose "Station (weatherObserved)" or "Station (weatherForecast)", then tick elements from the list the node reads live from the MOSMIX file. Stored internally as JSON mapping STATION_observed or STATION_forecast to a list of element codes.
MOSMIX URL (mosmixUrl)TextDWD open data template, see belowURL template for the station files. The placeholder {$station} is replaced by the station ID.
Catalog URL (catalogUrl)TextDWD station catalog, see belowStation catalog with names and coordinates. Reloaded at most every 24 hours.

Default values of the two URL fields:

MOSMIX URL: https://opendata.dwd.de/weather/local_forecasts/mos/MOSMIX_L/single_stations/{$station}/kml/MOSMIX_L_LATEST_{$station}.kmz
Catalog URL: https://www.dwd.de/DE/leistungen/met_verfahren_mosmix/mosmix_stationskatalog.cfg?view=nasPublication&nn=16102
Choosing the look-ahead

MOSMIX_L contains forecasts for about ten days. With a look-ahead of 24 hours the node produces 24 forecast objects per station. A value that is too large leads to the error "no predictions for any future dates found".

Input​

The input acts as trigger. Any message starts the fetch for all configured stations. In addition, the node evaluates two properties of the payload.

PropertyTypeMeaning
msg.payloadanyTriggers the fetch. If the payload is not an object it is ignored.
msg.payload.actionstringweatherObserved serves output 1 only, weatherForecast output 2 only. Without this property both outputs are served.
msg.payload.lookAheadHoursnumberOverrides the configured look-ahead for this run, in hours.

All other properties of the incoming message are copied to the outgoing messages; msg.topic is replaced by the configured topic.

Output​

For every station the node sends a separate message. Both payloads are flat objects modelled on the Smart Data Models WeatherObserved and WeatherForecast that can be handed to the NGSI-LD Builder without further transformation.

Output 1: WeatherObserved​

{
"id": "N5227",
"type": "WeatherObserved",
"location": {"type": "Point", "coordinates": [8.6821, 50.1109]},
"atmosphericPressure": 1013.2,
"temperature": 14.6,
"windDirection": 230,
"windSpeed": 3.4,
"relativeHumidity": 0.78,
"precipitation": 0.2,
"precipitationProbability": 0.35,
"observedAt": "2026-10-01T08:00:00.000Z",
"DD": 230,
"TTT": 287.75
}
FieldMeaning
idDWD station ID.
typeWeatherObserved.
locationGeoJSON point [longitude, latitude] from the station catalog. If the station is missing in the catalog, [0, 0] is used.
atmosphericPressureReduced air pressure in hPa (MOSMIX PPPP, one decimal).
temperatureAir temperature 2 m above ground in °C (MOSMIX TTT, one decimal).
windDirectionWind direction in degrees (MOSMIX DD).
windSpeedWind speed in m/s (MOSMIX FF).
relativeHumidityRelative humidity as a fraction 0–1, calculated from temperature and dew point (TTT, Td).
precipitationPrecipitation of the last hour in mm (MOSMIX RR1c, kg/m²). 0 if missing.
precipitationProbabilityProbability of precipitation as a fraction 0–1 (MOSMIX wwP). 0 if missing.
observedAtTime of the fetch in ISO 8601 format.
further fieldsMOSMIX elements selected under "Detailed forecast elements", named by their code. Percentages are emitted as a fraction 0–1, all other values in their MOSMIX unit (for example Kelvin for TTT, Pa for PPPP).

Output 2: WeatherForecast​

The payload is an array with one object per forecast hour, starting one hour after the fetch and ending at the look-ahead. The fields match output 1; instead of observedAt every object carries dateIssued with the time the forecast applies to.

[
{
"id": "N5227",
"type": "WeatherForecast",
"location": {"type": "Point", "coordinates": [8.6821, 50.1109]},
"atmosphericPressure": 1012.8,
"temperature": 15.9,
"windDirection": 235,
"windSpeed": 3.9,
"relativeHumidity": 0.71,
"precipitation": 0,
"precipitationProbability": 0.12,
"dateIssued": "2026-10-01T09:00:00.000Z"
}
]

If the look-ahead is 0 and not overridden via msg.payload.lookAheadHours, output 2 sends nothing.

Example flow​

The package ships with an example flow. Import it in Node-RED via Menu → Import → Examples → @htag/node-red-contrib-hypertegrity-weather → dwd-weather. Alternatively download dwd-weather.json and import it via Menu → Import.

Step 1

Inject

An Inject node triggers the fetch manually or at a fixed interval.

Step 2

DWD Weather

The node downloads the MOSMIX file of station N5227 and additionally emits the elements DD and TTT.

Step 3

Debug

Two Debug nodes show WeatherObserved and WeatherForecast in the sidebar.

Show example flow as JSON
[
{"id": "tab1", "type": "tab", "label": "dwd-weather", "disabled": false, "info": ""},
{"id": "inject1", "type": "inject", "z": "tab1", "name": "", "props": [{"p": "payload"}, {"p": "topic", "vt": "str"}], "repeat": "", "crontab": "", "once": false, "onceDelay": 0.1, "topic": "", "payload": "", "payloadType": "date", "x": 180, "y": 220, "wires": [["dwd1"]]},
{"id": "dwd1", "type": "hypertegrity-dwd-weather", "z": "tab1", "name": "", "mosmixStation": "N5227", "useForecastStation": false, "forecastStation": "", "lookAheadHours": "0", "lookAheadUnit": "hours", "topic": "", "mosmixUrl": "https://opendata.dwd.de/weather/local_forecasts/mos/MOSMIX_L/single_stations/{$station}/kml/MOSMIX_L_LATEST_{$station}.kmz", "catalogUrl": "https://www.dwd.de/DE/leistungen/met_verfahren_mosmix/mosmix_stationskatalog.cfg?view=nasPublication&nn=16102", "detailedElements": "{\"N5227_observed\":[\"DD\",\"TTT\"]}", "x": 380, "y": 220, "wires": [["debug1"], ["debug2"]]},
{"id": "debug1", "type": "debug", "z": "tab1", "name": "WeatherObserved", "active": true, "tosidebar": true, "console": false, "tostatus": false, "complete": "payload", "targetType": "msg", "x": 650, "y": 200, "wires": []},
{"id": "debug2", "type": "debug", "z": "tab1", "name": "WeatherForecast", "active": true, "tosidebar": true, "console": false, "tostatus": false, "complete": "payload", "targetType": "msg", "x": 650, "y": 240, "wires": []}
]

In the example the look-ahead is 0; output 2 therefore stays empty until you enter a look-ahead.

Status and errors​

After a successful fetch the status indicator is cleared.

IndicatorMeaning
Red ring "Download failed"The KMZ file could not be extracted.
Red ring "Parsing failed"The contained KML file is not valid XML.
Red ring "HTTP request failed"The DWD server returned an error or was unreachable.
Warning "MOSMIX request failed for …: …"The fetch of one station failed. For HTTP 404 the cause reads "MOSMIX returned no data (404) for …"; check the station ID. The remaining stations are still processed.
Error "Failed to create weather data for …: …"The values could not be calculated, for example "no predictions for any future dates found" when the file is too old or the look-ahead too large.

Warnings appear via node.warn in the debug sidebar; errors are reported via node.error and can be handled with a Catch node. In the edit dialog, notices such as "Failed to load DWD stations" or "Location not found" indicate problems of the map interface.

Notes​

  • Terms of use: MOSMIX data is published under the Data licence Germany – attribution – version 2.0 (DL-DE/BY-2-0). Name the DWD as source when you publish the data.
  • Polling frequency: Per station and trigger a KMZ file of typically several hundred kilobytes is downloaded. An interval of 60 minutes is sufficient because the DWD updates the files hourly.
  • No API key required: DWD Open Data is freely accessible. There is no separate proxy setting; axios honours the environment variables HTTP_PROXY and HTTPS_PROXY.
  • Context storage: The node keeps forecast data and station catalog in memory only. After a restart or deploy they are reloaded.
  • Units: All main fields are metric (°C, hPa, m/s, mm). Additional MOSMIX elements keep their original unit, so temperatures are in Kelvin. The DWD MOSMIX element definition lists all elements.
  • External services in the editor: The map view loads tiles from OpenStreetMap and uses Nominatim for the address search. The browser running the Node-RED editor needs internet access for this.
  • Personal data: The output contains only station IDs, coordinates and weather values.

References​