This page is part of archived documentation for openHAB 3.0. Go to the current stable version

# DWD Unwetter Binding

Binding to retrieve the Weather Warnings of the "Deutscher Wetterdienstes" from the DWD Geoserver (opens new window). The DWD provides weather warnings for Germany. Regions outside of Germany are not supported.

# Supported Things

This binding supports one thing, the Weather Warning. Each Thing provides one or more warnings for a city.

# Thing Configuration

Property Default Required Description
cellId - Yes ID of the area to retrieve weather warnings. See this list (opens new window) of valid IDs. Using the percent sign (%) as a wildcard, it is possible to query multiple cells. For example, the value 8111% retrieves all cell IDs that start with 8111.
refresh 30 No Time between API requests in minutes. Minimum 15 minutes.
warningCount 1 No Number of warnings to provide.

The binding will deliver no warnings if the number of retrieved warnings for one Thing is too big. This can only happen if you select too many cell IDs (more than about 300) with the percent wildcard.

Example:

dwdunwetter:dwdwarnings:cologne "Warnings Cologne" [ cellId="105315000", refresh=15, warningCount=1 ]

# Channels

The are multiple channels for every weather warning. The channels are numbered, with channel names ending in 1 for the first warning, 2 for the second warning, and so on. The warnings will be sorted first by Severity and then by the Valid From date. This ensures that the channels for the first warning will always be the highest Severity. If the API returns more warnings than the configured number in the Thing, the warnings with the lowest Severity will be dropped.

Channel Type Description
warningN Switch ON if a warning is present
UpdatedN Trigger Channel Triggers NEW when a warning is sent the first time
severityN String Severity of the warning. Possible values are Minor, Moderate, Severe, and Extreme
headlineN String Headline of the warning (e.g. "Amtliche Warnung vor FROST")
descriptionN String Textual description of the warning
eventN String Type of the warning (e.g. FROST)
effectiveN DateTime Issued Date and Time
onsetN DateTime Start Date and Time for which the warning is valid
expiresN DateTime End Date and Time for which the warning is valid
altitudeN Number:Length Lower Height above sea level for which the warning is valid
ceilingN Number:Length Upper Height above sea level for which the warning is valid
urgencyN String Urgency of the warning. Possible values are Future and Immediate
instructionN String Additional instructions and safety information

All channels are readonly.

The main purpose of the channel warningN is to be used for controlling visibility in sitemaps. The channel can also be used in rules to check if there is a warning present. It should not be used for rules that need to fire if a new warning shows up. If a warning is replaced by another warning, that channel stays at ON, and there will be no state change. For rules that need to fire if a new warning occurs, there is the trigger channel updatedN. That trigger channel fires an event whenever a warning is sent for the first time. It also triggers if a warning is replaced by another.

More explanations about the specific values of the channels can be found in the documentation of the DWD at: CAP DWD Profile 1.2 (opens new window)

# Full Example

demo.things:

dwdunwetter:dwdwarnings:cologne "Warnings Cologne" [ cellId="105315000", refresh=15, warningCount=1 ]

demo.items:

Switch WarningCologne "Weather warning" { channel="dwdunwetter:dwdwarnings:cologne:warning1" }
String WarningCologneServerity "Severity[%s]" { channel="dwdunwetter:dwdwarnings:cologne:severity1" }
String WarningCologneBeschreibung "[%s]" { channel="dwdunwetter:dwdwarnings:cologne:description1" }
String WarningCologneAusgabedatum "Issued at [%s]" { channel="dwdunwetter:dwdwarnings:cologne:effective1" }
String WarningCologneGueltigAb "Valid from [%s]" { channel="dwdunwetter:dwdwarnings:cologne:onset1" }
String WarningCologneGueltigBis "Valid to [%s]" { channel="dwdunwetter:dwdwarnings:cologne:expires1" }
String WarningCologneTyp "Type [%s]" { channel="dwdunwetter:dwdwarnings:cologne:event1" }
String WarningCologneTitel "[%s]" { channel="dwdunwetter:dwdwarnings:cologne:headline1" }
String WarningCologneHoeheAb "Height from [%d m]" { channel="dwdunwetter:dwdwarnings:cologne:altitude1" }
String WarningCologneHoeheBis "Height to [%d m]" { channel="dwdunwetter:dwdwarnings:cologne:ceiling1" }
String WarningCologneUrgency "[%s]" { channel="dwdunwetter:dwdwarnings:cologne:urgency1" }
String WarningCologneInstruction "Additional information: [%s]" { channel="dwdunwetter:dwdwarnings:cologne:instruction1" }

demo.sitemap:

sitemap demo label="Main Menu"
{
    Frame {
        Text item=WarningCologneTitel visibility=[WarningCologne==ON]
        Text item=WarningCologneBeschreibung visibility=[WarningCologne==ON]
    }
}

demo.rules

rule "New Warnung"
when
     Channel 'dwdunwetter:dwdwarnings:cologne:updated1' triggered NEW
then
   // New Warning send a push notification to everyone
end