forked from openhab/openhab-addons
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[dwdpollenflug] Initial Contribution (openhab#7298)
* [DWDPollenflug] New Binding retry Signed-off-by: Johannes DerOetzi Ott <[email protected]>
- Loading branch information
1 parent
f956211
commit 5d5c16d
Showing
24 changed files
with
1,349 additions
and
0 deletions.
There are no files selected for viewing
Validating CODEOWNERS rules …
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<classpath> | ||
<classpathentry kind="src" path="target/generated-sources/annotations"> | ||
<attributes> | ||
<attribute name="optional" value="true"/> | ||
<attribute name="maven.pomderived" value="true"/> | ||
<attribute name="ignore_optional_problems" value="true"/> | ||
<attribute name="m2e-apt" value="true"/> | ||
</attributes> | ||
</classpathentry> | ||
<classpathentry kind="src" output="target/classes" path="src/main/java"> | ||
<attributes> | ||
<attribute name="optional" value="true"/> | ||
<attribute name="maven.pomderived" value="true"/> | ||
</attributes> | ||
</classpathentry> | ||
<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources"> | ||
<attributes> | ||
<attribute name="maven.pomderived" value="true"/> | ||
</attributes> | ||
</classpathentry> | ||
<classpathentry kind="src" output="target/test-classes" path="src/test/java"> | ||
<attributes> | ||
<attribute name="optional" value="true"/> | ||
<attribute name="maven.pomderived" value="true"/> | ||
<attribute name="test" value="true"/> | ||
</attributes> | ||
</classpathentry> | ||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"> | ||
<attributes> | ||
<attribute name="maven.pomderived" value="true"/> | ||
</attributes> | ||
</classpathentry> | ||
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER"> | ||
<attributes> | ||
<attribute name="maven.pomderived" value="true"/> | ||
</attributes> | ||
</classpathentry> | ||
<classpathentry kind="src" output="target/test-classes" path="target/generated-test-sources/test-annotations"> | ||
<attributes> | ||
<attribute name="optional" value="true"/> | ||
<attribute name="maven.pomderived" value="true"/> | ||
<attribute name="ignore_optional_problems" value="true"/> | ||
<attribute name="m2e-apt" value="true"/> | ||
<attribute name="test" value="true"/> | ||
</attributes> | ||
</classpathentry> | ||
<classpathentry kind="output" path="target/classes"/> | ||
</classpath> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<projectDescription> | ||
<name>org.openhab.binding.dwdpollenflug</name> | ||
<comment></comment> | ||
<projects> | ||
</projects> | ||
<buildSpec> | ||
<buildCommand> | ||
<name>org.eclipse.jdt.core.javabuilder</name> | ||
<arguments> | ||
</arguments> | ||
</buildCommand> | ||
<buildCommand> | ||
<name>org.eclipse.m2e.core.maven2Builder</name> | ||
<arguments> | ||
</arguments> | ||
</buildCommand> | ||
</buildSpec> | ||
<natures> | ||
<nature>org.eclipse.jdt.core.javanature</nature> | ||
<nature>org.eclipse.m2e.core.maven2Nature</nature> | ||
</natures> | ||
</projectDescription> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
This content is produced and maintained by the openHAB project. | ||
|
||
* Project home: https://www.openhab.org | ||
|
||
== Declared Project Licenses | ||
|
||
This program and the accompanying materials are made available under the terms | ||
of the Eclipse Public License 2.0 which is available at | ||
https://www.eclipse.org/legal/epl-2.0/. | ||
|
||
== Source Code | ||
|
||
https://github.com/openhab/openhab-addons |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,198 @@ | ||
# DWDPollenflug Binding | ||
|
||
The "Deutsche Wetterdienst" (DWD) reports the current pollen count index for Germany on a daily base and a forecast for tomorrow and the day after tomorrow. | ||
This binding allows you to retrieve this data for your region or partregion. You can find a map of the data here: | ||
|
||
https://isabel.dwd.de/DE/leistungen/gefahrenindizespollen/gefahrenindexpollen.html | ||
|
||
|
||
## Supported Things | ||
|
||
This binding supports a bridge thing (`bridge`), which polls the dataset for Germany in an adjustable interval. | ||
And it supports a region thing (`region`), representing the data for all pollen types of a region or partregion. | ||
|
||
## Thing Configuration | ||
|
||
### Bridge | ||
|
||
| Property | Default | Required | Description | | ||
| --------- | :-----: | :------: | ------------------------------------------------------------------------------------ | | ||
| `refresh` | 30 | no | Define the interval for polling the data from DWD in minutes. Minimum is 15 minutes. | | ||
|
||
### Region | ||
|
||
| Property | Default | Required | Description | | ||
| ---------- | :-----: | :------: | -------------------------------------------------------------------------------------------------------- | | ||
| `regionID` | - | yes | In PaperUI just select the region you want to display data for. For files-configuration see table below. | | ||
|
||
#### Manual region or partregion selection #### | ||
|
||
The region ID is the partregion_id or if there is no partregion the region_id from this [json](https://opendata.dwd.de/climate_environment/health/alerts/s31fg.json) of DWD. | ||
You can refer to the following table. | ||
|
||
| regionID | Region | Partregion | | ||
| -------- | ------------------------------ | -------------------------------------------------- | | ||
| 11 | Schleswig-Holstein und Hamburg | Inseln und Marschen | | ||
| 12 | Schleswig-Holstein und Hamburg | Geest, Schleswig-Holstein und Hamburg | | ||
| 20 | Mecklenburg-Vorpommern | - | | ||
| 31 | Niedersachsen und Bremen | Westl. Niedersachsen/Bremen | | ||
| 32 | Niedersachsen und Bremen | Östl. Niedersachsen | | ||
| 41 | Nordrhein-Westfalen | Rhein.-Westfäl. Tiefland | | ||
| 42 | Nordrhein-Westfalen | Ostwestfalen | | ||
| 43 | Nordrhein-Westfalen | Mittelgebirge NRW | | ||
| 50 | Brandenburg und Berlin | - | | ||
| 61 | Sachsen-Anhalt | Tiefland Sachsen-Anhalt | | ||
| 62 | Sachsen-Anhalt | Harz | | ||
| 71 | Thüringen | Tiefland Thüringen | | ||
| 72 | Thüringen | Mittelgebirge Thüringen | | ||
| 81 | Sachsen | Tiefland Sachsen | | ||
| 82 | Sachsen | Mittelgebirge Sachsen | | ||
| 91 | Hessen | Nordhessen und hess. Mittelgebirge | | ||
| 92 | Hessen | Rhein-Main | | ||
| 101 | Rheinland-Pfalz und Saarland | Rhein, Pfalz, Nahe und Mosel | | ||
| 102 | Rheinland-Pfalz und Saarland | Mittelgebirgsbereich Rheinland-Pfalz | | ||
| 103 | Rheinland-Pfalz und Saarland | Saarland | | ||
| 111 | Baden-Württemberg | Oberrhein und unteres Neckartal | | ||
| 112 | Baden-Württemberg | Hohenlohe/mittlerer Neckar/Oberschwaben | | ||
| 113 | Baden-Württemberg | Mittelgebirge Baden-Württemberg | | ||
| 121 | Bayern | Allgäu/Oberbayern/Bay. Wald | | ||
| 122 | Bayern | Donauniederungen | | ||
| 123 | Bayern | Bayern n. der Donau, o. Bayr. Wald, o. Mainfranken | | ||
| 124 | Bayern | Mainfranken | | ||
|
||
## Channels | ||
|
||
The bridge thing has following channels: | ||
|
||
| channel | description | | ||
| --------------------- | ---------------------------------------------- | | ||
| `updates#refreshed` | Hold the time of the bridge's last refresh | | ||
| `updates#last_update` | The time when data was last updated by DWD | | ||
| `updates#next_update` | The time when data will be updated next by DWD | | ||
|
||
For each of the eight pollen types reported by DWD the region thing has three channels for today, tomorrow and the day after tomorrow. | ||
|
||
| channels | pollen type | german name | | ||
| ---------------------- | ----------- | ----------- | | ||
| `alder#today` | alder | Erle | | ||
| `alder#tomorrow` | | | | ||
| `alder#dayafter_to` | | | | ||
| `ambrosia#today` | ambrosia | Ambrosia | | ||
| `ambrosia#tomorrow` | | | | ||
| `ambrosia#dayafter_to` | | | | ||
| `ash#today` | ash-tree | Esche | | ||
| `ash#tomorrow` | | | | ||
| `ash#dayafter_to` | | | | ||
| `birch#today` | birch | Birke | | ||
| `birch#tomorrow` | | | | ||
| `birch#dayafter_to` | | | | ||
| `grasses#today` | grasses | Gräser | | ||
| `grasses#tomorrow` | | | | ||
| `grasses#dayafter_to` | | | | ||
| `hazel#today` | hazel | Hasel | | ||
| `hazel#tomorrow` | | | | ||
| `hazel#dayafter_to` | | | | ||
| `mugwort#today` | mugwort | Beifuß | | ||
| `mugwort#tomorrow` | | | | ||
| `mugwort#dayafter_to` | | | | ||
| `rye#today` | rye | Roggen | | ||
| `rye#tomorrow` | | | | ||
| `rye#dayafter_to` | | | | ||
|
||
There are the following possible string values: | ||
|
||
| value | description | | ||
| ----- | --------------------------- | | ||
| -1 | not specified | | ||
| 0 | no pollen pollution | | ||
| 0-1 | no to low pollen count | | ||
| 1 | low pollen count | | ||
| 1-2 | low to medium pollen count | | ||
| 2 | medium pollen count | | ||
| 2-3 | medium to high pollen count | | ||
| 3 | high pollen count | | ||
|
||
## Full Example | ||
|
||
### Things file for region "Brandenburg und Berlin" and partregion "Bayern - Mainfranken" ### | ||
|
||
``` | ||
Bridge dwdpollenflug:bridge:dwd "DWD pollen count Bridge" [refresh="15"] { | ||
Thing region region50 "DWD pollen count region" @ "APIS" [regionID="50"] | ||
Thing region partregion124 "DWD pollen count partregion" @ "APIS" [regionID="124"] | ||
} | ||
``` | ||
|
||
### Items example for region "Brandenburg und Berlin" and pollen type ash-tree ### | ||
|
||
``` | ||
String pollenTodayEsche | ||
"Esche [MAP(pollen.map):%s]" | ||
{channel="dwdpollenflug:region:dwd:region50:ash#today"} | ||
String pollenTomorrowEsche | ||
"Esche morgen [MAP(pollen.map):%s]" | ||
{channel="dwdpollenflug:region:dwd:region50:ash#tomorrow"} | ||
String pollenDayAfterTomorrowEsche | ||
"Esche übermorgen [MAP(pollen.map):%s]" | ||
{channel="dwdpollenflug:region:dwd:region50:ash#dayafter_to"} | ||
``` | ||
|
||
### Transform map file pollen.map ### | ||
|
||
``` | ||
0=keine (0) | ||
0-1=keine bis gering (0-1) | ||
1=gering (1) | ||
1-2=gering bis mittel (1-2) | ||
2=mittel (2) | ||
2-3=mittel bis hoch (2-3) | ||
3=hoch (3) | ||
-1=keine Daten | ||
-=keine Daten | ||
NULL=keine Daten | ||
``` | ||
|
||
### Sitemap example for region "Brandenburg und Berlin" and pollen type ash-tree ### | ||
|
||
``` | ||
Text label="Pollenflugindex" { | ||
Frame { | ||
Text item=pollenTodayEsche | ||
valuecolor=[=="3"="#f00014", | ||
=="2-3"="#f00014", | ||
=="2"="#ff9900", | ||
=="1-2"="#ff9900", | ||
=="1"="#ffff00", | ||
=="0-1"="#00c83c"] { | ||
Frame { | ||
Text item=pollenTodayEsche | ||
valuecolor=[=="3"="#f00014", | ||
=="2-3"="#f00014", | ||
=="2"="#ff9900", | ||
=="1-2"="#ff9900", | ||
=="1"="#ffff00", | ||
=="0-1"="#00c83c"] | ||
Text item=pollenTomorrowEsche | ||
valuecolor=[=="3"="#f00014", | ||
=="2-3"="#f00014", | ||
=="2"="#ff9900", | ||
=="1-2"="#ff9900", | ||
=="1"="#ffff00", | ||
=="0-1"="#00c83c"] | ||
Text item=pollenDayAfterTomorrowEsche | ||
valuecolor=[=="3"="#f00014", | ||
=="2-3"="#f00014", | ||
=="2"="#ff9900", | ||
=="1-2"="#ff9900", | ||
=="1"="#ffff00", | ||
=="0-1"="#00c83c"] | ||
} | ||
} | ||
} | ||
} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
|
||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<parent> | ||
<groupId>org.openhab.addons.bundles</groupId> | ||
<artifactId>org.openhab.addons.reactor.bundles</artifactId> | ||
<version>2.5.4-SNAPSHOT</version> | ||
</parent> | ||
|
||
<artifactId>org.openhab.binding.dwdpollenflug</artifactId> | ||
|
||
<name>openHAB Add-ons :: Bundles :: DWDPollenflug Binding</name> | ||
|
||
</project> |
9 changes: 9 additions & 0 deletions
9
bundles/org.openhab.binding.dwdpollenflug/src/main/feature/feature.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<features name="org.openhab.binding.dwdpollenflug-${project.version}" xmlns="http://karaf.apache.org/xmlns/features/v1.4.0"> | ||
<repository>mvn:org.openhab.core.features.karaf/org.openhab.core.features.karaf.openhab-core/${ohc.version}/xml/features</repository> | ||
|
||
<feature name="openhab-binding-dwdpollenflug" description="DWD Pollenflug Binding" version="${project.version}"> | ||
<feature>openhab-runtime-base</feature> | ||
<bundle start-level="80">mvn:org.openhab.addons.bundles/org.openhab.binding.dwdpollenflug/${project.version}</bundle> | ||
</feature> | ||
</features> |
62 changes: 62 additions & 0 deletions
62
...c/main/java/org/openhab/binding/dwdpollenflug/internal/DWDPollenflugBindingConstants.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
/** | ||
* Copyright (c) 2010-2020 Contributors to the openHAB project | ||
* | ||
* See the NOTICE file(s) distributed with this work for additional | ||
* information. | ||
* | ||
* This program and the accompanying materials are made available under the | ||
* terms of the Eclipse Public License 2.0 which is available at | ||
* http://www.eclipse.org/legal/epl-2.0 | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
*/ | ||
package org.openhab.binding.dwdpollenflug.internal; | ||
|
||
import org.eclipse.jdt.annotation.NonNullByDefault; | ||
import org.eclipse.smarthome.core.thing.ThingTypeUID; | ||
|
||
/** | ||
* The {@link DWDPollenflugBindingConstants} class defines common constants, which are | ||
* used across the whole binding. | ||
* | ||
* @author Johannes Ott - Initial contribution | ||
*/ | ||
@NonNullByDefault | ||
public class DWDPollenflugBindingConstants { | ||
|
||
private static final String BINDING_ID = "dwdpollenflug"; | ||
|
||
// bridge | ||
public static final ThingTypeUID THING_TYPE_BRIDGE = new ThingTypeUID(BINDING_ID, "bridge"); | ||
|
||
// List of all Thing Type UIDs | ||
public static final ThingTypeUID THING_TYPE_REGION = new ThingTypeUID(BINDING_ID, "region"); | ||
|
||
// Channels of pollen groups | ||
public static final String CHANNEL_TODAY = "today"; | ||
public static final String CHANNEL_TOMORROW = "tomorrow"; | ||
public static final String CHANNEL_DAYAFTER_TO = "dayafter_to"; | ||
|
||
// Channels of region update | ||
public static final String CHANNEL_UPDATES = "updates"; | ||
public static final String CHANNEL_REFRESHED = "refreshed"; | ||
public static final String CHANNEL_NEXT_UPDATE = "next_update"; | ||
public static final String CHANNEL_LAST_UPDATE = "last_update"; | ||
public static final String CHANNEL_UPDATED = "updated"; | ||
|
||
public static final String TRIGGER_REFRESHED = "REFRESHED"; | ||
|
||
// Bridge config properties | ||
public static final String REFRESH = "refresh"; | ||
|
||
// Bridge properties | ||
public static final String PROPERTY_SENDER = "sender"; | ||
public static final String PROPERTY_NAME = "name"; | ||
|
||
// Region config properties | ||
public static final String REGION_ID = "regionID"; | ||
|
||
// Region properties | ||
public static final String PROPERTY_REGION_NAME = "region_name"; | ||
public static final String PROPERTY_PARTREGION_NAME = "partregion_name"; | ||
} |
Oops, something went wrong.