added migrated 2.x add-ons
Signed-off-by: Kai Kreuzer <kai@openhab.org>
This commit is contained in:
@@ -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>
|
||||
@@ -0,0 +1,77 @@
|
||||
/**
|
||||
* 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 java.util.Collections;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||
import org.openhab.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");
|
||||
public static final String DWD = "dwd";
|
||||
public static final String BRIDGE_LABEL = "DWD Pollen Count Index (Bridge)";
|
||||
|
||||
// List of all Thing Type UIDs
|
||||
public static final ThingTypeUID THING_TYPE_REGION = new ThingTypeUID(BINDING_ID, "region");
|
||||
|
||||
// @formatter:off
|
||||
public static final Set<ThingTypeUID> SUPPORTED_THING_TYPES_UIDS =
|
||||
Collections.unmodifiableSet(Stream
|
||||
.of(THING_TYPE_BRIDGE, THING_TYPE_REGION)
|
||||
.collect(Collectors.toSet())
|
||||
);
|
||||
// @formatter:on
|
||||
|
||||
// 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";
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
/**
|
||||
* 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 static org.openhab.binding.dwdpollenflug.internal.DWDPollenflugBindingConstants.*;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||
import org.eclipse.jdt.annotation.Nullable;
|
||||
import org.eclipse.jetty.client.HttpClient;
|
||||
import org.openhab.binding.dwdpollenflug.internal.handler.DWDPollenflugBridgeHandler;
|
||||
import org.openhab.binding.dwdpollenflug.internal.handler.DWDPollenflugRegionHandler;
|
||||
import org.openhab.core.io.net.http.HttpClientFactory;
|
||||
import org.openhab.core.thing.Bridge;
|
||||
import org.openhab.core.thing.Thing;
|
||||
import org.openhab.core.thing.ThingTypeUID;
|
||||
import org.openhab.core.thing.binding.BaseThingHandlerFactory;
|
||||
import org.openhab.core.thing.binding.ThingHandler;
|
||||
import org.openhab.core.thing.binding.ThingHandlerFactory;
|
||||
import org.osgi.service.component.annotations.Activate;
|
||||
import org.osgi.service.component.annotations.Component;
|
||||
import org.osgi.service.component.annotations.Reference;
|
||||
|
||||
/**
|
||||
* The {@link DWDPollenflugHandlerFactory} is responsible for creating things and thing
|
||||
* handlers.
|
||||
*
|
||||
* @author Johannes Ott - Initial contribution
|
||||
*/
|
||||
@NonNullByDefault
|
||||
@Component(configurationPid = "binding.dwdpollenflug", service = ThingHandlerFactory.class)
|
||||
public class DWDPollenflugHandlerFactory extends BaseThingHandlerFactory {
|
||||
private final HttpClient httpClient;
|
||||
|
||||
@Activate
|
||||
public DWDPollenflugHandlerFactory(final @Reference HttpClientFactory httpClientFactory) {
|
||||
this.httpClient = httpClientFactory.getCommonHttpClient();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean supportsThingType(ThingTypeUID thingTypeUID) {
|
||||
return SUPPORTED_THING_TYPES_UIDS.contains(thingTypeUID);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected @Nullable ThingHandler createHandler(Thing thing) {
|
||||
ThingTypeUID thingTypeUID = thing.getThingTypeUID();
|
||||
|
||||
if (THING_TYPE_BRIDGE.equals(thingTypeUID)) {
|
||||
return new DWDPollenflugBridgeHandler((Bridge) thing, httpClient);
|
||||
} else if (THING_TYPE_REGION.equals(thingTypeUID)) {
|
||||
return new DWDPollenflugRegionHandler(thing);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
/**
|
||||
* 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;
|
||||
|
||||
/**
|
||||
* The {@link DWDPollingException} class is the exception for all polling errors.
|
||||
*
|
||||
* @author Johannes Ott - Initial contribution
|
||||
*/
|
||||
@NonNullByDefault
|
||||
public class DWDPollingException extends Exception {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public DWDPollingException(String message) {
|
||||
super(message);
|
||||
}
|
||||
|
||||
public DWDPollingException(String message, Throwable throwable) {
|
||||
super(message, throwable);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
/**
|
||||
* 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.config;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||
|
||||
/**
|
||||
* Configuration for the {@link DWDPollenflugBridgeHandler}
|
||||
*
|
||||
* @author Johannes Ott - Initial contribution
|
||||
*/
|
||||
@NonNullByDefault
|
||||
public class DWDPollenflugBridgeConfiguration {
|
||||
public int refresh = 30;
|
||||
|
||||
public boolean isValid() {
|
||||
return refresh >= 15;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
/**
|
||||
* 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.config;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||
|
||||
/**
|
||||
* Configuration for the {@link DWDPollenflugRegionHandler}
|
||||
*
|
||||
* @author Johannes Ott - Initial contribution
|
||||
*/
|
||||
@NonNullByDefault
|
||||
public class DWDPollenflugRegionConfiguration {
|
||||
public int regionID;
|
||||
|
||||
public boolean isValid() {
|
||||
return regionID > 0;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
/**
|
||||
* 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.discovery;
|
||||
|
||||
import static org.openhab.binding.dwdpollenflug.internal.DWDPollenflugBindingConstants.*;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||
import org.openhab.core.config.discovery.AbstractDiscoveryService;
|
||||
import org.openhab.core.config.discovery.DiscoveryResult;
|
||||
import org.openhab.core.config.discovery.DiscoveryResultBuilder;
|
||||
import org.openhab.core.config.discovery.DiscoveryService;
|
||||
import org.openhab.core.thing.ThingUID;
|
||||
import org.osgi.service.component.annotations.Component;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
* The {@link DWDPollenflugDiscoveryService} create a default bridge thing.
|
||||
*
|
||||
* @author Johannes Ott - Initial contribution
|
||||
*/
|
||||
@NonNullByDefault
|
||||
@Component(service = DiscoveryService.class, immediate = true, configurationPid = "discovery.dwdpollenflug")
|
||||
public class DWDPollenflugDiscoveryService extends AbstractDiscoveryService {
|
||||
private static final ThingUID BRIDGE_THING_UID = new ThingUID(THING_TYPE_BRIDGE, DWD);
|
||||
private static final int DISCOVER_TIMEOUT_SECONDS = 2;
|
||||
|
||||
private final Logger logger = LoggerFactory.getLogger(DWDPollenflugDiscoveryService.class);
|
||||
|
||||
public DWDPollenflugDiscoveryService() throws IllegalArgumentException {
|
||||
super(SUPPORTED_THING_TYPES_UIDS, DISCOVER_TIMEOUT_SECONDS, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void startScan() {
|
||||
logger.debug("Manual DWDPollenflug discovery scan.");
|
||||
addBridge();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void startBackgroundDiscovery() {
|
||||
logger.debug("Background DWDPollenflug discovery scan.");
|
||||
addBridge();
|
||||
}
|
||||
|
||||
private void addBridge() {
|
||||
// @formatter:off
|
||||
DiscoveryResult bridge = DiscoveryResultBuilder
|
||||
.create(BRIDGE_THING_UID)
|
||||
.withLabel(BRIDGE_LABEL)
|
||||
.build();
|
||||
// @formatter:on
|
||||
|
||||
thingDiscovered(bridge);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,111 @@
|
||||
/**
|
||||
* 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.dto;
|
||||
|
||||
import static org.openhab.binding.dwdpollenflug.internal.DWDPollenflugBindingConstants.*;
|
||||
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.ZoneId;
|
||||
import java.time.ZonedDateTime;
|
||||
import java.util.Collections;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||
import org.eclipse.jdt.annotation.Nullable;
|
||||
import org.openhab.core.library.types.DateTimeType;
|
||||
import org.openhab.core.types.State;
|
||||
import org.openhab.core.types.UnDefType;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
/**
|
||||
* The {@link DWDPollenflug} class is internal DWD data structure.
|
||||
*
|
||||
* @author Johannes Ott - Initial contribution
|
||||
*/
|
||||
@NonNullByDefault
|
||||
public class DWDPollenflug {
|
||||
private String sender = "";
|
||||
|
||||
private String name = "";
|
||||
|
||||
private final Date created = new Date();
|
||||
|
||||
@SerializedName("next_update")
|
||||
private @Nullable String nextUpdate;
|
||||
|
||||
@SerializedName("last_update")
|
||||
private @Nullable String lastUpdate;
|
||||
|
||||
@SerializedName("content")
|
||||
private @Nullable Set<DWDRegion> regions;
|
||||
|
||||
public Map<String, String> getProperties() {
|
||||
Map<String, String> map = new HashMap<>();
|
||||
|
||||
map.put(PROPERTY_NAME, name);
|
||||
map.put(PROPERTY_SENDER, sender);
|
||||
|
||||
return Collections.unmodifiableMap(map);
|
||||
}
|
||||
|
||||
public Map<String, State> getChannelsStateMap() {
|
||||
Map<String, State> map = new HashMap<>();
|
||||
|
||||
map.put(CHANNEL_UPDATES + "#" + CHANNEL_REFRESHED, parseDate(created));
|
||||
map.put(CHANNEL_UPDATES + "#" + CHANNEL_LAST_UPDATE, parseDate(lastUpdate));
|
||||
map.put(CHANNEL_UPDATES + "#" + CHANNEL_NEXT_UPDATE, parseDate(nextUpdate));
|
||||
|
||||
return Collections.unmodifiableMap(map);
|
||||
}
|
||||
|
||||
private State parseDate(final @Nullable String dateString) {
|
||||
try {
|
||||
if (dateString != null) {
|
||||
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm");
|
||||
Date date = formatter.parse(dateString.replace("Uhr", "").trim());
|
||||
return parseDate(date);
|
||||
}
|
||||
|
||||
return UnDefType.NULL;
|
||||
} catch (ParseException e) {
|
||||
return UnDefType.NULL;
|
||||
}
|
||||
}
|
||||
|
||||
private State parseDate(final @Nullable Date date) {
|
||||
if (date == null) {
|
||||
return UnDefType.NULL;
|
||||
} else {
|
||||
ZonedDateTime zoned = ZonedDateTime.ofInstant(date.toInstant(), ZoneId.systemDefault());
|
||||
return new DateTimeType(zoned);
|
||||
}
|
||||
}
|
||||
|
||||
public @Nullable DWDRegion getRegion(int key) {
|
||||
final Set<DWDRegion> localRegions = regions;
|
||||
if (localRegions != null) {
|
||||
for (DWDRegion region : localRegions) {
|
||||
if (region.getRegionID() == key) {
|
||||
return region;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
/**
|
||||
* 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.dto;
|
||||
|
||||
/**
|
||||
* The {@link DWDPollenflug} class is internal DWD data structure.
|
||||
*
|
||||
* @author Johannes Ott - Initial contribution
|
||||
*/
|
||||
public enum DWDPollenflugPollen {
|
||||
AMBROSIA("ambrosia"),
|
||||
BEIFUSS("mugwort"),
|
||||
BIRKE("birch"),
|
||||
ERLE("alder"),
|
||||
ESCHE("ash"),
|
||||
GRAESER("grasses"),
|
||||
HASEL("hazel"),
|
||||
ROGGEN("rye");
|
||||
|
||||
private final String channelName;
|
||||
|
||||
private DWDPollenflugPollen(String channelName) {
|
||||
this.channelName = channelName;
|
||||
}
|
||||
|
||||
public String getChannelName() {
|
||||
return channelName;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
/**
|
||||
* 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.dto;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
/**
|
||||
* DTO for data per pollen type
|
||||
*
|
||||
* @author Johannes Ott - Initial contribution
|
||||
*/
|
||||
@NonNullByDefault
|
||||
public class DWDPollentypeJSON {
|
||||
public String today = "-1";
|
||||
|
||||
public String tomorrow = "-1";
|
||||
|
||||
@SerializedName("dayafter_to")
|
||||
public String dayAfterTomorrow = "-1";
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
/**
|
||||
* 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.dto;
|
||||
|
||||
import static org.openhab.binding.dwdpollenflug.internal.DWDPollenflugBindingConstants.*;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||
import org.eclipse.jdt.annotation.Nullable;
|
||||
import org.openhab.core.library.types.StringType;
|
||||
import org.openhab.core.types.State;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
/**
|
||||
* The {@link DWDRegion} class holds the internal data representation of each Region
|
||||
*
|
||||
* @author Johannes Ott - Initial contribution
|
||||
*/
|
||||
@NonNullByDefault
|
||||
public class DWDRegion {
|
||||
@SerializedName("region_id")
|
||||
public int regionID = 0;
|
||||
|
||||
@SerializedName("region_name")
|
||||
public String regionName = "";
|
||||
|
||||
@SerializedName("partregion_id")
|
||||
public int partRegionID = 0;
|
||||
|
||||
@SerializedName("partregion_name")
|
||||
public String partRegionName = "";
|
||||
|
||||
@SerializedName("Pollen")
|
||||
private @Nullable Map<String, DWDPollentypeJSON> pollen;
|
||||
|
||||
public Map<String, String> getProperties() {
|
||||
Map<String, String> map = new HashMap<>();
|
||||
map.put(PROPERTY_REGION_NAME, regionName);
|
||||
map.put(PROPERTY_PARTREGION_NAME, partRegionName);
|
||||
return Collections.unmodifiableMap(map);
|
||||
}
|
||||
|
||||
public int getRegionID() {
|
||||
if (partRegionID > 0) {
|
||||
return partRegionID;
|
||||
}
|
||||
return regionID;
|
||||
}
|
||||
|
||||
public Map<String, State> getChannelsStateMap() {
|
||||
final Map<String, DWDPollentypeJSON> localPollen = pollen;
|
||||
if (localPollen != null) {
|
||||
Map<String, State> map = new HashMap<>();
|
||||
localPollen.forEach((k, jsonType) -> {
|
||||
final String pollenType = DWDPollenflugPollen.valueOf(k.toUpperCase()).getChannelName();
|
||||
map.put(pollenType + "#" + CHANNEL_TODAY, new StringType(jsonType.today));
|
||||
map.put(pollenType + "#" + CHANNEL_TOMORROW, new StringType(jsonType.tomorrow));
|
||||
map.put(pollenType + "#" + CHANNEL_DAYAFTER_TO, new StringType(jsonType.dayAfterTomorrow));
|
||||
});
|
||||
|
||||
return Collections.unmodifiableMap(map);
|
||||
}
|
||||
|
||||
return Collections.emptyMap();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,211 @@
|
||||
/**
|
||||
* 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.handler;
|
||||
|
||||
import java.net.SocketTimeoutException;
|
||||
import java.net.URI;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.ScheduledFuture;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.TimeoutException;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||
import org.eclipse.jdt.annotation.Nullable;
|
||||
import org.eclipse.jetty.client.HttpClient;
|
||||
import org.eclipse.jetty.client.HttpResponse;
|
||||
import org.eclipse.jetty.client.api.Request;
|
||||
import org.eclipse.jetty.client.api.Result;
|
||||
import org.eclipse.jetty.client.util.BufferingResponseListener;
|
||||
import org.eclipse.jetty.http.HttpMethod;
|
||||
import org.openhab.binding.dwdpollenflug.internal.DWDPollingException;
|
||||
import org.openhab.binding.dwdpollenflug.internal.config.DWDPollenflugBridgeConfiguration;
|
||||
import org.openhab.binding.dwdpollenflug.internal.dto.DWDPollenflug;
|
||||
import org.openhab.core.thing.Bridge;
|
||||
import org.openhab.core.thing.ChannelUID;
|
||||
import org.openhab.core.thing.Thing;
|
||||
import org.openhab.core.thing.ThingStatus;
|
||||
import org.openhab.core.thing.ThingStatusDetail;
|
||||
import org.openhab.core.thing.binding.BaseBridgeHandler;
|
||||
import org.openhab.core.thing.binding.ThingHandler;
|
||||
import org.openhab.core.types.Command;
|
||||
import org.openhab.core.types.RefreshType;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.JsonSyntaxException;
|
||||
|
||||
/**
|
||||
* The {@link DWDPollenflugBridgeHandler} is the handler for bridge thing
|
||||
*
|
||||
* @author Johannes Ott - Initial contribution
|
||||
*/
|
||||
@NonNullByDefault
|
||||
public class DWDPollenflugBridgeHandler extends BaseBridgeHandler {
|
||||
private static final String DWD_URL = "https://opendata.dwd.de/climate_environment/health/alerts/s31fg.json";
|
||||
|
||||
private final Logger logger = LoggerFactory.getLogger(DWDPollenflugBridgeHandler.class);
|
||||
|
||||
private DWDPollenflugBridgeConfiguration bridgeConfig = new DWDPollenflugBridgeConfiguration();
|
||||
private @Nullable ScheduledFuture<?> pollingJob;
|
||||
private @Nullable DWDPollenflug pollenflug;
|
||||
private final Set<DWDPollenflugRegionHandler> regionListeners = ConcurrentHashMap.newKeySet();
|
||||
private final HttpClient client;
|
||||
private final Gson gson = new Gson();
|
||||
|
||||
public DWDPollenflugBridgeHandler(Bridge bridge, HttpClient client) {
|
||||
super(bridge);
|
||||
this.client = client;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleCommand(ChannelUID channelUID, Command command) {
|
||||
if (command instanceof RefreshType) {
|
||||
final DWDPollenflug localPollenflug = pollenflug;
|
||||
if (localPollenflug != null) {
|
||||
notifyOnUpdate(localPollenflug);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initialize() {
|
||||
logger.debug("Initializing DWD Pollenflug bridge handler");
|
||||
bridgeConfig = getConfigAs(DWDPollenflugBridgeConfiguration.class);
|
||||
|
||||
if (bridgeConfig.isValid()) {
|
||||
updateStatus(ThingStatus.UNKNOWN);
|
||||
startPolling();
|
||||
} else {
|
||||
updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.CONFIGURATION_ERROR,
|
||||
"Refresh interval has to be at least 15 minutes.");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dispose() {
|
||||
logger.debug("Handler disposed.");
|
||||
stopPolling();
|
||||
}
|
||||
|
||||
private void startPolling() {
|
||||
final ScheduledFuture<?> localPollingJob = this.pollingJob;
|
||||
if (localPollingJob == null || localPollingJob.isCancelled()) {
|
||||
logger.debug("Start polling.");
|
||||
pollingJob = scheduler.scheduleWithFixedDelay(this::poll, 0, bridgeConfig.refresh, TimeUnit.MINUTES);
|
||||
}
|
||||
}
|
||||
|
||||
private void stopPolling() {
|
||||
final ScheduledFuture<?> localPollingJob = this.pollingJob;
|
||||
if (localPollingJob != null && !localPollingJob.isCancelled()) {
|
||||
logger.debug("Stop polling.");
|
||||
localPollingJob.cancel(true);
|
||||
pollingJob = null;
|
||||
}
|
||||
}
|
||||
|
||||
private void poll() {
|
||||
logger.debug("Polling");
|
||||
requestRefresh().handle((resultPollenflug, pollException) -> {
|
||||
if (resultPollenflug == null) {
|
||||
if (pollException == null) {
|
||||
updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.COMMUNICATION_ERROR);
|
||||
} else {
|
||||
updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.COMMUNICATION_ERROR,
|
||||
pollException.getMessage());
|
||||
}
|
||||
} else {
|
||||
updateStatus(ThingStatus.ONLINE);
|
||||
notifyOnUpdate(resultPollenflug);
|
||||
}
|
||||
|
||||
return null;
|
||||
});
|
||||
}
|
||||
|
||||
private CompletableFuture<@Nullable DWDPollenflug> requestRefresh() {
|
||||
CompletableFuture<@Nullable DWDPollenflug> f = new CompletableFuture<>();
|
||||
Request request = client.newRequest(URI.create(DWD_URL));
|
||||
|
||||
request.method(HttpMethod.GET).timeout(2000, TimeUnit.SECONDS).send(new BufferingResponseListener() {
|
||||
@NonNullByDefault({})
|
||||
@Override
|
||||
public void onComplete(Result result) {
|
||||
final HttpResponse response = (HttpResponse) result.getResponse();
|
||||
if (result.getFailure() != null) {
|
||||
Throwable e = result.getFailure();
|
||||
if (e instanceof SocketTimeoutException || e instanceof TimeoutException) {
|
||||
f.completeExceptionally(new DWDPollingException("Request timeout", e));
|
||||
} else {
|
||||
f.completeExceptionally(new DWDPollingException("Request failed", e));
|
||||
}
|
||||
} else if (response.getStatus() != 200) {
|
||||
f.completeExceptionally(new DWDPollingException(getContentAsString()));
|
||||
} else {
|
||||
try {
|
||||
DWDPollenflug pollenflugJSON = gson.fromJson(getContentAsString(), DWDPollenflug.class);
|
||||
f.complete(pollenflugJSON);
|
||||
} catch (JsonSyntaxException ex2) {
|
||||
f.completeExceptionally(new DWDPollingException("Parsing of response failed"));
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return f;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void childHandlerInitialized(ThingHandler childHandler, Thing childThing) {
|
||||
if (childHandler instanceof DWDPollenflugRegionHandler) {
|
||||
logger.debug("Register region listener.");
|
||||
final DWDPollenflugRegionHandler regionListener = (DWDPollenflugRegionHandler) childHandler;
|
||||
if (regionListeners.add(regionListener)) {
|
||||
final DWDPollenflug localPollenflug = pollenflug;
|
||||
if (localPollenflug != null) {
|
||||
regionListener.notifyOnUpdate(localPollenflug);
|
||||
}
|
||||
} else {
|
||||
logger.warn("Tried to add listener {} but it was already present. This is probably an error.",
|
||||
childHandler);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void childHandlerDisposed(ThingHandler childHandler, Thing childThing) {
|
||||
if (childHandler instanceof DWDPollenflugRegionHandler) {
|
||||
logger.debug("Unregister region listener.");
|
||||
if (!regionListeners.remove((DWDPollenflugRegionHandler) childHandler)) {
|
||||
logger.warn("Tried to remove listener {} but it was not registered. This is probably an error.",
|
||||
childHandler);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void notifyOnUpdate(@Nullable DWDPollenflug newPollenflug) {
|
||||
if (newPollenflug != null) {
|
||||
pollenflug = newPollenflug;
|
||||
updateProperties(newPollenflug.getProperties());
|
||||
regionListeners.forEach(listener -> listener.notifyOnUpdate(newPollenflug));
|
||||
newPollenflug.getChannelsStateMap().forEach(this::updateState);
|
||||
}
|
||||
}
|
||||
|
||||
public @Nullable DWDPollenflug getPollenflug() {
|
||||
return pollenflug;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,112 @@
|
||||
/**
|
||||
* 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.handler;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||
import org.eclipse.jdt.annotation.Nullable;
|
||||
import org.openhab.binding.dwdpollenflug.internal.config.DWDPollenflugRegionConfiguration;
|
||||
import org.openhab.binding.dwdpollenflug.internal.dto.DWDPollenflug;
|
||||
import org.openhab.binding.dwdpollenflug.internal.dto.DWDRegion;
|
||||
import org.openhab.core.thing.Bridge;
|
||||
import org.openhab.core.thing.ChannelUID;
|
||||
import org.openhab.core.thing.Thing;
|
||||
import org.openhab.core.thing.ThingStatus;
|
||||
import org.openhab.core.thing.ThingStatusDetail;
|
||||
import org.openhab.core.thing.binding.BaseThingHandler;
|
||||
import org.openhab.core.thing.binding.ThingHandler;
|
||||
import org.openhab.core.types.Command;
|
||||
import org.openhab.core.types.RefreshType;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
* The {@link DWDPollenflugRegionHandler} is the handler for bridge thing
|
||||
*
|
||||
* @author Johannes Ott - Initial contribution
|
||||
*/
|
||||
@NonNullByDefault
|
||||
public class DWDPollenflugRegionHandler extends BaseThingHandler {
|
||||
|
||||
private final Logger logger = LoggerFactory.getLogger(DWDPollenflugRegionHandler.class);
|
||||
|
||||
private DWDPollenflugRegionConfiguration thingConfig = new DWDPollenflugRegionConfiguration();
|
||||
|
||||
public DWDPollenflugRegionHandler(Thing thing) {
|
||||
super(thing);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initialize() {
|
||||
logger.debug("Initializing DWD Pollenflug region handler");
|
||||
thingConfig = getConfigAs(DWDPollenflugRegionConfiguration.class);
|
||||
|
||||
if (thingConfig.isValid()) {
|
||||
DWDPollenflugBridgeHandler handler = getBridgeHandler();
|
||||
if (handler == null) {
|
||||
updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.CONFIGURATION_ERROR, "Bridge handler missing");
|
||||
} else {
|
||||
updateStatus(ThingStatus.ONLINE);
|
||||
}
|
||||
} else {
|
||||
updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.CONFIGURATION_ERROR, "No valid region id given.");
|
||||
}
|
||||
}
|
||||
|
||||
private @Nullable DWDPollenflugBridgeHandler getBridgeHandler() {
|
||||
Bridge bridge = getBridge();
|
||||
if (bridge != null) {
|
||||
ThingHandler handler = bridge.getHandler();
|
||||
if (handler instanceof DWDPollenflugBridgeHandler) {
|
||||
DWDPollenflugBridgeHandler bridgeHandler = (DWDPollenflugBridgeHandler) handler;
|
||||
return bridgeHandler;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dispose() {
|
||||
logger.debug("DWDPollenflug region handler disposes.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleCommand(ChannelUID channelUID, Command command) {
|
||||
if (command instanceof RefreshType) {
|
||||
refresh();
|
||||
}
|
||||
}
|
||||
|
||||
private void refresh() {
|
||||
DWDPollenflugBridgeHandler handler = getBridgeHandler();
|
||||
if (handler != null) {
|
||||
DWDPollenflug pollenflug = handler.getPollenflug();
|
||||
if (pollenflug != null) {
|
||||
notifyOnUpdate(pollenflug);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void notifyOnUpdate(DWDPollenflug pollenflug) {
|
||||
DWDRegion region = pollenflug.getRegion(thingConfig.regionID);
|
||||
if (region == null) {
|
||||
updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.CONFIGURATION_ERROR, "Region not found");
|
||||
return;
|
||||
}
|
||||
|
||||
updateStatus(ThingStatus.ONLINE);
|
||||
updateProperties(region.getProperties());
|
||||
|
||||
region.getChannelsStateMap().forEach(this::updateState);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<binding:binding id="dwdpollenflug" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:binding="https://openhab.org/schemas/binding/v1.0.0"
|
||||
xsi:schemaLocation="https://openhab.org/schemas/binding/v1.0.0 https://openhab.org/schemas/binding-1.0.0.xsd">
|
||||
|
||||
<name>DWD Pollenflug Binding</name>
|
||||
<description>This is the binding for DWDPollenflug.</description>
|
||||
<author>Johannes Ott</author>
|
||||
|
||||
</binding:binding>
|
||||
@@ -0,0 +1,46 @@
|
||||
#binding
|
||||
binding.dwdpollenflug.name = DWD Pollenflugindex
|
||||
binding.dwdpollenflug.description = Binding um den Pollenflugindex des deutschen Wetterdienstes anzuzeigen
|
||||
|
||||
#bridge
|
||||
thing-type.dwdpollenflug.bridge.label = DWD Pollenflugindex (Bridge)
|
||||
thing-type.dwdpollenflug.bridge.description = Bridge um den Pollenflugindex des DWDs abzurufen.
|
||||
|
||||
#bridge config
|
||||
thing-type.config.dwdpollenflug.bridge.refresh.label = Aktualisierungsinterval
|
||||
thing-type.config.dwdpollenflug.bridge.refresh.description = Zeit zwischen zwei API-Anfragen in Minuten. Minimum 15 Minuten.
|
||||
|
||||
#thing types
|
||||
thing-type.dwdpollenflug.region.label = DWD Pollenflugindex (Region)
|
||||
thing-type.dwdpollenflug.region.description = Pollenflugindex f\u00FCr eine bestimmte Region oder Teilregion
|
||||
thing-type.dwdpollenflug.region.group.updates.label = Aktualisierung
|
||||
thing-type.dwdpollenflug.region.group.updates.description = Informationen zur Aktualisierung
|
||||
thing-type.dwdpollenflug.region.group.alder.label=Erle
|
||||
thing-type.dwdpollenflug.region.group.alder.description=Informationen f\u00FCr Erle
|
||||
thing-type.dwdpollenflug.region.group.ambrosia.label=Ambrosia
|
||||
thing-type.dwdpollenflug.region.group.ambrosia.description=Informationen f\u00FCr Ambrosia
|
||||
thing-type.dwdpollenflug.region.group.ash.label=Esche
|
||||
thing-type.dwdpollenflug.region.group.ash.description=Informationen f\u00FCr Esche
|
||||
thing-type.dwdpollenflug.region.group.birch.label=Birke
|
||||
thing-type.dwdpollenflug.region.group.birch.description=Informationen f\u00FCr Birke
|
||||
thing-type.dwdpollenflug.region.group.grasses.label=Gr\u00E4sser
|
||||
thing-type.dwdpollenflug.region.group.grasses.description=Informationen f\u00FCr Gr\u00E4sser
|
||||
thing-type.dwdpollenflug.region.group.hazel.label=Hasel
|
||||
thing-type.dwdpollenflug.region.group.hazel.description=Informationen f\u00FCr Hasel
|
||||
thing-type.dwdpollenflug.region.group.mugwort.label=Beifu\u00DF
|
||||
thing-type.dwdpollenflug.region.group.mugwort.description=Informationen f\u00FCr Beifu\u00DF
|
||||
thing-type.dwdpollenflug.region.group.rye.label=Roggen
|
||||
thing-type.dwdpollenflug.region.group.rye.description=Informationen f\u00FCr Roggen
|
||||
|
||||
#thing region config
|
||||
thing-type.config.dwdpollenflug.region.regionID.label = Region
|
||||
thing-type.config.dwdpollenflug.region.regionID.description = Die Teilregion oder Region die angezeigt werden soll.
|
||||
|
||||
#channel-group-type
|
||||
channel-group-type.dwdpollenflug.pollentype.channel.today.label = Heute
|
||||
channel-group-type.dwdpollenflug.pollentype.channel.tomorrow.label = Morgen
|
||||
channel-group-type.dwdpollenflug.pollentype.channel.dayafter_to.label = \u00DCbermorgen
|
||||
|
||||
channel-group-type.dwdpollenflug.updates.channel.refreshed.label = Letzte Aktualisierung Bridge
|
||||
channel-group-type.dwdpollenflug.updates.channel.last_update.label = Letzte Aktualisierung DWD
|
||||
channel-group-type.dwdpollenflug.updates.channel.next_update.label = N\u00E4chste Aktualisierung DWD
|
||||
@@ -0,0 +1,51 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<thing:thing-descriptions bindingId="dwdpollenflug"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:thing="https://openhab.org/schemas/thing-description/v1.0.0"
|
||||
xsi:schemaLocation="https://openhab.org/schemas/thing-description/v1.0.0 https://openhab.org/schemas/thing-description-1.0.0.xsd">
|
||||
|
||||
<bridge-type id="bridge">
|
||||
<label>DWD Pollen Count Index (Bridge)</label>
|
||||
<description>Bridge for accessing pollen count index data of the DWD</description>
|
||||
|
||||
<channel-groups>
|
||||
<channel-group id="updates" typeId="updates"/>
|
||||
</channel-groups>
|
||||
|
||||
<properties>
|
||||
<property name="sender"/>
|
||||
<property name="name"/>
|
||||
</properties>
|
||||
|
||||
<config-description>
|
||||
<parameter name="refresh" type="integer" unit="min" min="15">
|
||||
<default>30</default>
|
||||
<label>Refresh Interval</label>
|
||||
<description>Time between two API requests in minutes. Minimum 15 minutes.</description>
|
||||
</parameter>
|
||||
</config-description>
|
||||
|
||||
</bridge-type>
|
||||
|
||||
<channel-group-type id="updates">
|
||||
<label>Updates</label>
|
||||
<description>Information about data state</description>
|
||||
<channels>
|
||||
<channel id="refreshed" typeId="update">
|
||||
<label>Bridge Refreshed</label>
|
||||
</channel>
|
||||
<channel id="last_update" typeId="update">
|
||||
<label>Last Update From DWD</label>
|
||||
</channel>
|
||||
<channel id="next_update" typeId="update">
|
||||
<label>Next Update From DWD</label>
|
||||
</channel>
|
||||
</channels>
|
||||
</channel-group-type>
|
||||
|
||||
<channel-type id="update">
|
||||
<item-type>DateTime</item-type>
|
||||
<label>Update Time</label>
|
||||
<state readOnly="true"/>
|
||||
</channel-type>
|
||||
</thing:thing-descriptions>
|
||||
@@ -0,0 +1,113 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<thing:thing-descriptions bindingId="dwdpollenflug"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:thing="https://openhab.org/schemas/thing-description/v1.0.0"
|
||||
xsi:schemaLocation="https://openhab.org/schemas/thing-description/v1.0.0 https://openhab.org/schemas/thing-description-1.0.0.xsd">
|
||||
|
||||
<thing-type id="region">
|
||||
<supported-bridge-type-refs>
|
||||
<bridge-type-ref id="bridge"/>
|
||||
</supported-bridge-type-refs>
|
||||
|
||||
<label>DWD Pollen Count Index (Region)</label>
|
||||
<description>Pollen count index for a region or partregion</description>
|
||||
|
||||
<channel-groups>
|
||||
<channel-group id="alder" typeId="pollentype">
|
||||
<label>Alder</label>
|
||||
<description>Information for alder</description>
|
||||
</channel-group>
|
||||
<channel-group id="ambrosia" typeId="pollentype">
|
||||
<label>Ambrosia</label>
|
||||
<description>Information for ambrosia</description>
|
||||
</channel-group>
|
||||
<channel-group id="ash" typeId="pollentype">
|
||||
<label>Ash tree</label>
|
||||
<description>Information for ash tree</description>
|
||||
</channel-group>
|
||||
<channel-group id="birch" typeId="pollentype">
|
||||
<label>Birch</label>
|
||||
<description>Information for birch</description>
|
||||
</channel-group>
|
||||
<channel-group id="grasses" typeId="pollentype">
|
||||
<label>Grasses</label>
|
||||
<description>Information for grasses</description>
|
||||
</channel-group>
|
||||
<channel-group id="hazel" typeId="pollentype">
|
||||
<label>Hazel</label>
|
||||
<description>Information for hazel</description>
|
||||
</channel-group>
|
||||
<channel-group id="mugwort" typeId="pollentype">
|
||||
<label>Mugwort</label>
|
||||
<description>Information for mugwort</description>
|
||||
</channel-group>
|
||||
<channel-group id="rye" typeId="pollentype">
|
||||
<label>Rye</label>
|
||||
<description>Information for rye</description>
|
||||
</channel-group>
|
||||
</channel-groups>
|
||||
|
||||
<properties>
|
||||
<property name="region_name"/>
|
||||
<property name="partregion_name"/>
|
||||
</properties>
|
||||
|
||||
<config-description>
|
||||
<parameter name="regionID" type="integer" required="true">
|
||||
<label>Region</label>
|
||||
<description>The partregion or region that should be reported.</description>
|
||||
<options>
|
||||
<option value="11">Inseln und Marschen</option>
|
||||
<option value="12">Geest, Schleswig-Holstein und Hamburg</option>
|
||||
<option value="20">Mecklenburg-Vorpommern</option>
|
||||
<option value="31">Westl. Niedersachsen/Bremen</option>
|
||||
<option value="32">Östl. Niedersachsen</option>
|
||||
<option value="41">Rhein.-Westfäl. Tiefland</option>
|
||||
<option value="42">Ostwestfalen</option>
|
||||
<option value="43">Mittelgebirge NRW</option>
|
||||
<option value="50">Brandenburg und Berlin</option>
|
||||
<option value="61">Tiefland Sachsen-Anhalt</option>
|
||||
<option value="62">Harz</option>
|
||||
<option value="71">Tiefland Thüringen</option>
|
||||
<option value="72">Mittelgebirge Thüringen</option>
|
||||
<option value="81">Tiefland Sachsen</option>
|
||||
<option value="82">Mittelgebirge Sachsen</option>
|
||||
<option value="91">Nordhessen und hess. Mittelgebirge</option>
|
||||
<option value="92">Rhein-Main</option>
|
||||
<option value="101">Rhein, Pfalz, Nahe und Mosel</option>
|
||||
<option value="102">Mittelgebirgsbereich Rheinland-Pfalz</option>
|
||||
<option value="103">Saarland</option>
|
||||
<option value="111">Oberrhein und unteres Neckartal</option>
|
||||
<option value="112">Hohenlohe/mittlerer Neckar/Oberschwaben</option>
|
||||
<option value="113">Mittelgebirge Baden-Württemberg</option>
|
||||
<option value="121">Allgäu/Oberbayern/Bay. Wald</option>
|
||||
<option value="122">Donauniederungen</option>
|
||||
<option value="123">Bayern n. der Donau, o. Bayr. Wald, o. Mainfranken</option>
|
||||
<option value="124">Mainfranken</option>
|
||||
</options>
|
||||
</parameter>
|
||||
</config-description>
|
||||
</thing-type>
|
||||
|
||||
<channel-group-type id="pollentype">
|
||||
<label>Pollen Type Group</label>
|
||||
<description>For each pollen type there are three channels for today, tomorrow and day after tomorrow</description>
|
||||
<channels>
|
||||
<channel id="today" typeId="pollencount">
|
||||
<label>Today</label>
|
||||
</channel>
|
||||
<channel id="tomorrow" typeId="pollencount">
|
||||
<label>Tomorrow</label>
|
||||
</channel>
|
||||
<channel id="dayafter_to" typeId="pollencount">
|
||||
<label>Day After Tomorrow</label>
|
||||
</channel>
|
||||
</channels>
|
||||
</channel-group-type>
|
||||
|
||||
<channel-type id="pollencount">
|
||||
<item-type>String</item-type>
|
||||
<label>Pollen Count</label>
|
||||
<state readOnly="true"/>
|
||||
</channel-type>
|
||||
</thing:thing-descriptions>
|
||||
Reference in New Issue
Block a user