diff --git a/CODEOWNERS b/CODEOWNERS
index 5e299a75cc4a4..9b9bf59650c17 100644
--- a/CODEOWNERS
+++ b/CODEOWNERS
@@ -208,6 +208,7 @@
/bundles/org.openhab.binding.vektiva/ @octa22
/bundles/org.openhab.binding.velbus/ @cedricboon
/bundles/org.openhab.binding.velux/ @gs4711
+/bundles/org.openhab.binding.vigicrues/ @clinique
/bundles/org.openhab.binding.vitotronic/ @steand
/bundles/org.openhab.binding.volvooncall/ @clinique
/bundles/org.openhab.binding.weathercompany/ @mhilbush
diff --git a/bom/openhab-addons/pom.xml b/bom/openhab-addons/pom.xml
index df3a28ecb3107..15e92b1609b7c 100644
--- a/bom/openhab-addons/pom.xml
+++ b/bom/openhab-addons/pom.xml
@@ -1036,6 +1036,11 @@
org.openhab.binding.velux
${project.version}
+
+ org.openhab.addons.bundles
+ org.openhab.binding.vigicrues
+ ${project.version}
+
org.openhab.addons.bundles
org.openhab.binding.vitotronic
diff --git a/bundles/org.openhab.binding.vigicrues/.classpath b/bundles/org.openhab.binding.vigicrues/.classpath
new file mode 100644
index 0000000000000..a5d95095ccaaf
--- /dev/null
+++ b/bundles/org.openhab.binding.vigicrues/.classpath
@@ -0,0 +1,32 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/bundles/org.openhab.binding.vigicrues/.project b/bundles/org.openhab.binding.vigicrues/.project
new file mode 100644
index 0000000000000..8bdaeaeb2f825
--- /dev/null
+++ b/bundles/org.openhab.binding.vigicrues/.project
@@ -0,0 +1,23 @@
+
+
+ org.openhab.binding.vigicrues
+
+
+
+
+
+ org.eclipse.jdt.core.javabuilder
+
+
+
+
+ org.eclipse.m2e.core.maven2Builder
+
+
+
+
+
+ org.eclipse.jdt.core.javanature
+ org.eclipse.m2e.core.maven2Nature
+
+
diff --git a/bundles/org.openhab.binding.vigicrues/NOTICE b/bundles/org.openhab.binding.vigicrues/NOTICE
new file mode 100644
index 0000000000000..38d625e349232
--- /dev/null
+++ b/bundles/org.openhab.binding.vigicrues/NOTICE
@@ -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
diff --git a/bundles/org.openhab.binding.vigicrues/README.md b/bundles/org.openhab.binding.vigicrues/README.md
new file mode 100644
index 0000000000000..744569a98129d
--- /dev/null
+++ b/bundles/org.openhab.binding.vigicrues/README.md
@@ -0,0 +1,81 @@
+# VigiCrues Binding
+
+This binding allows you to get data regarding water flow and water height on major French rivers.
+These data are made public through OpenDataSoft website.
+
+## Supported Things
+
+There is exactly one supported thing type, which represents a river level measurement station.
+It is identified by the `id`.
+
+To get your station id :
+
+1. open https://www.vigicrues.gouv.fr/
+
+2. Select your region on the France map
+
+3. Select the station nearest to your location
+
+4. In the 'Info Station' tab you'll get the id just near the station name (e.g. X9999999299)
+
+Of course, you can add multiple Things, e.g. for getting measures for different locations.
+
+
+## Discovery
+
+This binding does not handle auto-discovery.
+
+## Binding Configuration
+
+The binding has no configuration options, all configuration is done at Thing level.
+
+## Thing Configuration
+
+The thing has a few configuration parameters:
+
+| Parameter | Description |
+|-----------|-------------------------------------------------------------------------|
+| id | Id of the station. |
+| refresh | Refresh interval in minutes. Optional, the default value is 30 minutes. |
+
+
+## Channels
+
+The VigiCrues information that retrieved are made available with these channels:
+
+| Channel ID | Item Type | Description |
+|------------------|---------------------------|-------------------------------|
+| observation-time | DateTime | Date and time of measurement |
+| flow | Number:VolumetricFlowRate | Volume of water per time unit |
+| height | Number:Length | Water height of the river |
+
+
+## Full Example
+
+vigicrues.things:
+
+```
+Thing vigicrues:station:poissy "Station Poissy" @ "VigiCrues" [id="H300000201", refresh=30]
+Thing vigicrues:station:vernon "Station Vernon" @ "VigiCrues" [id="H320000104", refresh=30]
+```
+
+vigicrues.items:
+
+```
+Group gVigiCrues "VigiCrues"
+ Number:Length VC_hauteur "Hauteur Eau Poissy [%.2f %unit%]" (gVigiCrues) {channel="vigicrues:station:poissy:height"}
+ Number:VolumetricFlowRate VC_debit "Débit Eau Poissy [%.2f %unit%]" (gVigiCrues) {channel="vigicrues:station:poissy:flow"}
+ DateTime VC_ObservationPTS "Timestamp [%1$tH:%1$tM]" (gVigiCrues) {channel="vigicrues:station:poissy:observation-time" }
+```
+
+vigicrues.sitemap:
+
+```
+sitemap vigicrues label="VigiCrues" {
+ Frame {
+ Default item=VC_hauteur
+ Default item=VC_debit
+ Default item=VC_ObservationPTS
+ }
+}
+```
diff --git a/bundles/org.openhab.binding.vigicrues/pom.xml b/bundles/org.openhab.binding.vigicrues/pom.xml
new file mode 100644
index 0000000000000..9ec44633068b6
--- /dev/null
+++ b/bundles/org.openhab.binding.vigicrues/pom.xml
@@ -0,0 +1,15 @@
+
+
+ 4.0.0
+
+
+ org.openhab.addons.bundles
+ org.openhab.addons.reactor.bundles
+ 2.5.6-SNAPSHOT
+
+
+ org.openhab.binding.vigicrues
+
+ openHAB Add-ons :: Bundles :: VigiCrues Binding
+
+
diff --git a/bundles/org.openhab.binding.vigicrues/src/main/feature/feature.xml b/bundles/org.openhab.binding.vigicrues/src/main/feature/feature.xml
new file mode 100644
index 0000000000000..fb033bfbf39a5
--- /dev/null
+++ b/bundles/org.openhab.binding.vigicrues/src/main/feature/feature.xml
@@ -0,0 +1,9 @@
+
+
+ mvn:org.openhab.core.features.karaf/org.openhab.core.features.karaf.openhab-core/${ohc.version}/xml/features
+
+
+ openhab-runtime-base
+ mvn:org.openhab.addons.bundles/org.openhab.binding.vigicrues/${project.version}
+
+
diff --git a/bundles/org.openhab.binding.vigicrues/src/main/java/org/openhab/binding/vigicrues/internal/VigiCruesBindingConstants.java b/bundles/org.openhab.binding.vigicrues/src/main/java/org/openhab/binding/vigicrues/internal/VigiCruesBindingConstants.java
new file mode 100644
index 0000000000000..b0b7ef66a38ae
--- /dev/null
+++ b/bundles/org.openhab.binding.vigicrues/src/main/java/org/openhab/binding/vigicrues/internal/VigiCruesBindingConstants.java
@@ -0,0 +1,44 @@
+/**
+ * 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.vigicrues.internal;
+
+import java.util.Collections;
+import java.util.Set;
+
+import org.eclipse.jdt.annotation.NonNullByDefault;
+import org.eclipse.smarthome.core.thing.ThingTypeUID;
+
+/**
+ * The {@link VigiCruesBindingConstants} class defines common constants, which are
+ * used across the whole binding.
+ *
+ * @author Gaël L'hopital - Initial contribution
+ */
+@NonNullByDefault
+public class VigiCruesBindingConstants {
+
+ public static final String BINDING_ID = "vigicrues";
+ public static final String OPENDATASOFT_URL = "https://public.opendatasoft.com/api/records/1.0/search/";
+
+ // List of all Thing Type UIDs
+ public static final ThingTypeUID THING_TYPE_VIGI_CRUES = new ThingTypeUID(BINDING_ID, "station");
+
+ // List of all Channel id's
+ public static final String OBSERVATION_TIME = "observation-time";
+ public static final String HEIGHT = "height";
+ public static final String FLOW = "flow";
+
+ public static final String COMMENT = "comment";
+
+ public static final Set SUPPORTED_THING_TYPES_UIDS = Collections.singleton(THING_TYPE_VIGI_CRUES);
+}
diff --git a/bundles/org.openhab.binding.vigicrues/src/main/java/org/openhab/binding/vigicrues/internal/VigiCruesConfiguration.java b/bundles/org.openhab.binding.vigicrues/src/main/java/org/openhab/binding/vigicrues/internal/VigiCruesConfiguration.java
new file mode 100644
index 0000000000000..7148589fe518b
--- /dev/null
+++ b/bundles/org.openhab.binding.vigicrues/src/main/java/org/openhab/binding/vigicrues/internal/VigiCruesConfiguration.java
@@ -0,0 +1,27 @@
+/**
+ * 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.vigicrues.internal;
+
+import org.eclipse.jdt.annotation.NonNullByDefault;
+
+/**
+ * The {@link VigiCruesConfiguration} is the class used to match the
+ * thing configuration.
+ *
+ * @author Gaël L'hopital - Initial contribution
+ */
+@NonNullByDefault
+public class VigiCruesConfiguration {
+ public String id = "";
+ public int refresh = 30;
+}
diff --git a/bundles/org.openhab.binding.vigicrues/src/main/java/org/openhab/binding/vigicrues/internal/VigiCruesHandlerFactory.java b/bundles/org.openhab.binding.vigicrues/src/main/java/org/openhab/binding/vigicrues/internal/VigiCruesHandlerFactory.java
new file mode 100644
index 0000000000000..5718e57b83451
--- /dev/null
+++ b/bundles/org.openhab.binding.vigicrues/src/main/java/org/openhab/binding/vigicrues/internal/VigiCruesHandlerFactory.java
@@ -0,0 +1,74 @@
+/**
+ * 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.vigicrues.internal;
+
+import static org.openhab.binding.vigicrues.internal.VigiCruesBindingConstants.*;
+
+import java.time.ZonedDateTime;
+
+import org.eclipse.jdt.annotation.NonNullByDefault;
+import org.eclipse.jdt.annotation.Nullable;
+import org.eclipse.smarthome.core.i18n.TimeZoneProvider;
+import org.eclipse.smarthome.core.thing.Thing;
+import org.eclipse.smarthome.core.thing.ThingTypeUID;
+import org.eclipse.smarthome.core.thing.binding.BaseThingHandlerFactory;
+import org.eclipse.smarthome.core.thing.binding.ThingHandler;
+import org.eclipse.smarthome.core.thing.binding.ThingHandlerFactory;
+import org.openhab.binding.vigicrues.internal.handler.VigiCruesHandler;
+import org.osgi.service.component.annotations.Activate;
+import org.osgi.service.component.annotations.Component;
+import org.osgi.service.component.annotations.Reference;
+
+import com.google.gson.Gson;
+import com.google.gson.GsonBuilder;
+import com.google.gson.JsonDeserializer;
+
+/**
+ * The {@link VigiCruesHandlerFactory} is responsible for creating things and thing
+ * handlers.
+ *
+ * @author Gaël L'hopital - Initial contribution
+ */
+@Component(service = ThingHandlerFactory.class, configurationPid = "binding.vigicrues")
+@NonNullByDefault
+public class VigiCruesHandlerFactory extends BaseThingHandlerFactory {
+ private final Gson gson;
+ // Needed for converting UTC time to local time
+ private final TimeZoneProvider timeZoneProvider;
+
+ @Activate
+ public VigiCruesHandlerFactory(@Reference TimeZoneProvider timeZoneProvider) {
+ this.timeZoneProvider = timeZoneProvider;
+ this.gson = new GsonBuilder()
+ .registerTypeAdapter(ZonedDateTime.class, (JsonDeserializer) (json, type,
+ jsonDeserializationContext) -> ZonedDateTime.parse(json.getAsJsonPrimitive().getAsString()))
+ .create();
+ }
+
+ @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 (thingTypeUID.equals(THING_TYPE_VIGI_CRUES)) {
+ return new VigiCruesHandler(thing, timeZoneProvider, gson);
+ }
+
+ return null;
+ }
+
+}
diff --git a/bundles/org.openhab.binding.vigicrues/src/main/java/org/openhab/binding/vigicrues/internal/handler/VigiCruesHandler.java b/bundles/org.openhab.binding.vigicrues/src/main/java/org/openhab/binding/vigicrues/internal/handler/VigiCruesHandler.java
new file mode 100644
index 0000000000000..0ea2806c587bd
--- /dev/null
+++ b/bundles/org.openhab.binding.vigicrues/src/main/java/org/openhab/binding/vigicrues/internal/handler/VigiCruesHandler.java
@@ -0,0 +1,141 @@
+/**
+ * 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.vigicrues.internal.handler;
+
+import static org.eclipse.smarthome.core.library.unit.SmartHomeUnits.CUBICMETRE_PER_SECOND;
+import static org.openhab.binding.vigicrues.internal.VigiCruesBindingConstants.*;
+import static tec.uom.se.unit.Units.METRE;
+
+import java.io.IOException;
+import java.net.MalformedURLException;
+import java.time.ZonedDateTime;
+import java.util.Arrays;
+import java.util.concurrent.ScheduledFuture;
+import java.util.concurrent.TimeUnit;
+
+import javax.measure.Unit;
+
+import org.eclipse.jdt.annotation.NonNullByDefault;
+import org.eclipse.jdt.annotation.Nullable;
+import org.eclipse.smarthome.core.i18n.TimeZoneProvider;
+import org.eclipse.smarthome.core.library.types.DateTimeType;
+import org.eclipse.smarthome.core.library.types.QuantityType;
+import org.eclipse.smarthome.core.thing.ChannelUID;
+import org.eclipse.smarthome.core.thing.Thing;
+import org.eclipse.smarthome.core.thing.ThingStatus;
+import org.eclipse.smarthome.core.thing.ThingStatusDetail;
+import org.eclipse.smarthome.core.thing.binding.BaseThingHandler;
+import org.eclipse.smarthome.core.types.Command;
+import org.eclipse.smarthome.core.types.RefreshType;
+import org.eclipse.smarthome.io.net.http.HttpUtil;
+import org.openhab.binding.vigicrues.internal.VigiCruesConfiguration;
+import org.openhab.binding.vigicrues.internal.json.OpenDatasoftResponse;
+import org.openhab.binding.vigicrues.internal.json.Record;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.google.gson.Gson;
+
+/**
+ * The {@link VigiCruesHandler} is responsible for querying the API and
+ * updating channels
+ *
+ * @author Gaël L'hopital - Initial contribution
+ */
+@NonNullByDefault
+public class VigiCruesHandler extends BaseThingHandler {
+ private static final String URL = OPENDATASOFT_URL + "?dataset=vigicrues&sort=timestamp&q=";
+ private static final int TIMEOUT_MS = 30000;
+ private final Logger logger = LoggerFactory.getLogger(VigiCruesHandler.class);
+
+ // Time zone provider representing time zone configured in openHAB configuration
+ private final TimeZoneProvider timeZoneProvider;
+ private final Gson gson;
+ private @Nullable ScheduledFuture> refreshJob;
+ private @Nullable String queryUrl;
+
+ public VigiCruesHandler(Thing thing, TimeZoneProvider timeZoneProvider, Gson gson) {
+ super(thing);
+ this.timeZoneProvider = timeZoneProvider;
+ this.gson = gson;
+ }
+
+ @Override
+ public void initialize() {
+ logger.debug("Initializing VigiCrues handler.");
+
+ VigiCruesConfiguration config = getConfigAs(VigiCruesConfiguration.class);
+ logger.debug("config station = {}", config.id);
+ logger.debug("config refresh = {} min", config.refresh);
+
+ updateStatus(ThingStatus.UNKNOWN);
+ queryUrl = URL + config.id;
+ refreshJob = scheduler.scheduleWithFixedDelay(this::updateAndPublish, 0, config.refresh, TimeUnit.MINUTES);
+ }
+
+ @Override
+ public void dispose() {
+ logger.debug("Disposing the VigiCrues handler.");
+
+ ScheduledFuture> refreshJob = this.refreshJob;
+ if (refreshJob != null) {
+ refreshJob.cancel(true);
+ }
+ this.refreshJob = null;
+ }
+
+ @Override
+ public void handleCommand(ChannelUID channelUID, Command command) {
+ if (command instanceof RefreshType) {
+ updateAndPublish();
+ }
+ }
+
+ private void updateAndPublish() {
+ try {
+ if (queryUrl != null) {
+ String response = HttpUtil.executeUrl("GET", queryUrl, TIMEOUT_MS);
+ updateStatus(ThingStatus.ONLINE);
+ OpenDatasoftResponse apiResponse = gson.fromJson(response, OpenDatasoftResponse.class);
+ Arrays.stream(apiResponse.getRecords()).findFirst().flatMap(Record::getFields).ifPresent(field -> {
+ field.getHeight().ifPresent(height -> updateQuantity(HEIGHT, height, METRE));
+ field.getFlow().ifPresent(flow -> updateQuantity(FLOW, flow, CUBICMETRE_PER_SECOND));
+ field.getTimestamp().ifPresent(date -> updateDate(OBSERVATION_TIME, date));
+ });
+ } else {
+ updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.DISABLED,
+ "queryUrl should never be null, but it is !");
+ }
+ } catch (MalformedURLException e) {
+ updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.CONFIGURATION_ERROR,
+ String.format("Querying '%s' raised : %s", queryUrl, e.getMessage()));
+ } catch (IOException e) {
+ updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.COMMUNICATION_ERROR,
+ String.format("Error opening connection to VigiCrues webservice : {}", e.getMessage()));
+ }
+ }
+
+ private void updateQuantity(String channelId, Double value, Unit> unit) {
+ if (isLinked(channelId)) {
+ updateState(channelId, new QuantityType<>(value, unit));
+ }
+ }
+
+ public void updateDate(String channelId, ZonedDateTime zonedDateTime) {
+ if (isLinked(channelId)) {
+ ZonedDateTime localDateTime = zonedDateTime.withZoneSameInstant(timeZoneProvider.getTimeZone());
+ updateState(channelId, new DateTimeType(localDateTime));
+ }
+ }
+
+}
diff --git a/bundles/org.openhab.binding.vigicrues/src/main/java/org/openhab/binding/vigicrues/internal/json/OpenDatasoftResponse.java b/bundles/org.openhab.binding.vigicrues/src/main/java/org/openhab/binding/vigicrues/internal/json/OpenDatasoftResponse.java
new file mode 100644
index 0000000000000..0c59ed8142251
--- /dev/null
+++ b/bundles/org.openhab.binding.vigicrues/src/main/java/org/openhab/binding/vigicrues/internal/json/OpenDatasoftResponse.java
@@ -0,0 +1,50 @@
+/**
+ * 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.vigicrues.internal.json;
+
+import java.util.Optional;
+
+import org.eclipse.jdt.annotation.NonNullByDefault;
+import org.eclipse.jdt.annotation.Nullable;
+
+import com.google.gson.annotations.SerializedName;
+
+/**
+ * The {@link OpenDatasoftResponse} is the Java class used to map the JSON
+ * response to an opendatasoft endpoint request.
+ *
+ * @author Gaël L'hopital - Initial contribution
+ */
+@NonNullByDefault
+public class OpenDatasoftResponse {
+ @SerializedName("nhits")
+ private int nHits;
+ private @Nullable Parameters parameters;
+ private Record[] records = {};
+
+ public int getNHits() {
+ return nHits;
+ }
+
+ public Optional getParameters() {
+ Parameters parameters = this.parameters;
+ if (parameters != null) {
+ return Optional.of(parameters);
+ }
+ return Optional.empty();
+ }
+
+ public Record[] getRecords() {
+ return records;
+ }
+}
diff --git a/bundles/org.openhab.binding.vigicrues/src/main/java/org/openhab/binding/vigicrues/internal/json/Parameters.java b/bundles/org.openhab.binding.vigicrues/src/main/java/org/openhab/binding/vigicrues/internal/json/Parameters.java
new file mode 100644
index 0000000000000..6ffc2bd437cae
--- /dev/null
+++ b/bundles/org.openhab.binding.vigicrues/src/main/java/org/openhab/binding/vigicrues/internal/json/Parameters.java
@@ -0,0 +1,64 @@
+/**
+ * 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.vigicrues.internal.json;
+
+import java.time.ZoneId;
+import java.util.Arrays;
+import java.util.Optional;
+
+import org.eclipse.jdt.annotation.NonNullByDefault;
+import org.eclipse.jdt.annotation.Nullable;
+
+/**
+ * The {@link Parameters} is the Java class used to map the JSON
+ * response to the webservice request.
+ *
+ * @author Gaël L'hopital - Initial contribution
+ */
+@NonNullByDefault
+public class Parameters {
+ private String[] dataset = {};
+ private String timezone = "";
+ private int rows;
+ private String format = "";
+ private @Nullable Refine refine;
+ private String[] facet = {};
+
+ public Optional getDataset() {
+ return Arrays.stream(dataset).findFirst();
+ }
+
+ public ZoneId getTimezone() {
+ return ZoneId.of(timezone);
+ }
+
+ public int getRows() {
+ return rows;
+ }
+
+ public String getFormat() {
+ return format;
+ }
+
+ public Optional getRefine() {
+ Refine refine = this.refine;
+ if (refine != null) {
+ return Optional.of(refine);
+ }
+ return Optional.empty();
+ }
+
+ public String[] getFacets() {
+ return facet;
+ }
+}
diff --git a/bundles/org.openhab.binding.vigicrues/src/main/java/org/openhab/binding/vigicrues/internal/json/Record.java b/bundles/org.openhab.binding.vigicrues/src/main/java/org/openhab/binding/vigicrues/internal/json/Record.java
new file mode 100644
index 0000000000000..a7a2f8d4b2d02
--- /dev/null
+++ b/bundles/org.openhab.binding.vigicrues/src/main/java/org/openhab/binding/vigicrues/internal/json/Record.java
@@ -0,0 +1,57 @@
+/**
+ * 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.vigicrues.internal.json;
+
+import java.util.Optional;
+
+import org.eclipse.jdt.annotation.NonNullByDefault;
+import org.eclipse.jdt.annotation.Nullable;
+
+import com.google.gson.annotations.SerializedName;
+
+/**
+ * The {@link Record} is the Java class used to map the JSON
+ * response to the webservice request.
+ *
+ * @author Gaël L'hopital - Initial contribution
+ */
+@NonNullByDefault
+public class Record {
+ @SerializedName("datasetid")
+ private String datasetId = "";
+ @SerializedName("recordid")
+ private String recordId = "";
+ @SerializedName("record_timestamp")
+ private String recordTimestamp = "";
+ private @Nullable VigiCruesFields fields;
+
+ public String getDatasetId() {
+ return datasetId;
+ }
+
+ public String getRecordId() {
+ return recordId;
+ }
+
+ public String getRecordTimestamp() {
+ return recordTimestamp;
+ }
+
+ public Optional getFields() {
+ VigiCruesFields fields = this.fields;
+ if (fields != null) {
+ return Optional.of(fields);
+ }
+ return Optional.empty();
+ }
+}
diff --git a/bundles/org.openhab.binding.vigicrues/src/main/java/org/openhab/binding/vigicrues/internal/json/Refine.java b/bundles/org.openhab.binding.vigicrues/src/main/java/org/openhab/binding/vigicrues/internal/json/Refine.java
new file mode 100644
index 0000000000000..e98c8d938b554
--- /dev/null
+++ b/bundles/org.openhab.binding.vigicrues/src/main/java/org/openhab/binding/vigicrues/internal/json/Refine.java
@@ -0,0 +1,33 @@
+/**
+ * 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.vigicrues.internal.json;
+
+import org.eclipse.jdt.annotation.NonNullByDefault;
+
+import com.google.gson.annotations.SerializedName;
+
+/**
+ * The {@link Refine} is the Java class used to map the JSON
+ * response to the webservice request.
+ *
+ * @author Gaël L'hopital - Initial contribution
+ */
+@NonNullByDefault
+public class Refine {
+ @SerializedName("nom_dept")
+ private String departmentName = "";
+
+ public String getDepartmentName() {
+ return departmentName;
+ }
+}
diff --git a/bundles/org.openhab.binding.vigicrues/src/main/java/org/openhab/binding/vigicrues/internal/json/VigiCruesFields.java b/bundles/org.openhab.binding.vigicrues/src/main/java/org/openhab/binding/vigicrues/internal/json/VigiCruesFields.java
new file mode 100644
index 0000000000000..35e6964224738
--- /dev/null
+++ b/bundles/org.openhab.binding.vigicrues/src/main/java/org/openhab/binding/vigicrues/internal/json/VigiCruesFields.java
@@ -0,0 +1,61 @@
+/**
+ * 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.vigicrues.internal.json;
+
+import java.time.ZonedDateTime;
+import java.util.Optional;
+
+import org.eclipse.jdt.annotation.NonNullByDefault;
+import org.eclipse.jdt.annotation.Nullable;
+
+import com.google.gson.annotations.SerializedName;
+
+/**
+ * The {@link VigiCruesFields} is the Java class used to map the JSON
+ * response to the webservice request.
+ *
+ * @author Gaël L'hopital - Initial contribution
+ */
+@NonNullByDefault
+public class VigiCruesFields {
+ @SerializedName("debit")
+ private @Nullable Double flow;
+ @SerializedName("hauteur")
+ private @Nullable Double height;
+ private @Nullable ZonedDateTime timestamp;
+
+ public Optional getTimestamp() {
+ ZonedDateTime timestamp = this.timestamp;
+ if (timestamp != null) {
+ return Optional.of(timestamp);
+ }
+ return Optional.empty();
+ }
+
+ public Optional getFlow() {
+ Double flow = this.flow;
+ if (flow != null) {
+ return Optional.of(flow);
+ }
+ return Optional.empty();
+ }
+
+ public Optional getHeight() {
+ Double height = this.height;
+ if (height != null) {
+ return Optional.of(height);
+ }
+ return Optional.empty();
+ }
+
+}
diff --git a/bundles/org.openhab.binding.vigicrues/src/main/resources/ESH-INF/binding/binding.xml b/bundles/org.openhab.binding.vigicrues/src/main/resources/ESH-INF/binding/binding.xml
new file mode 100644
index 0000000000000..243daabd637b9
--- /dev/null
+++ b/bundles/org.openhab.binding.vigicrues/src/main/resources/ESH-INF/binding/binding.xml
@@ -0,0 +1,11 @@
+
+
+
+ VigiCrues Binding
+ Retrieves VigiCrues levels in France
+ Gaël L'hopital
+
+
diff --git a/bundles/org.openhab.binding.vigicrues/src/main/resources/ESH-INF/thing/thing-types.xml b/bundles/org.openhab.binding.vigicrues/src/main/resources/ESH-INF/thing/thing-types.xml
new file mode 100644
index 0000000000000..74e91612560f1
--- /dev/null
+++ b/bundles/org.openhab.binding.vigicrues/src/main/resources/ESH-INF/thing/thing-types.xml
@@ -0,0 +1,50 @@
+
+
+
+
+ Station
+
+ Provides river level informations for this station
+
+
+
+
+
+
+
+
+
+
+ Identifiant
+ Id of the station
+
+
+ Refresh Interval
+ Specifies the refresh interval in minutes.
+ 30
+
+
+
+
+
+ Number:VolumetricFlowRate
+ Current Flow
+
+
+
+
+ DateTime
+ Observation Time
+ Observation date and time
+
+
+
+
+ Number:Length
+ Height
+ Water level in the river
+
+
+
diff --git a/bundles/pom.xml b/bundles/pom.xml
index a5941fd5e237a..e8a0c60f11ed8 100644
--- a/bundles/pom.xml
+++ b/bundles/pom.xml
@@ -244,6 +244,7 @@
org.openhab.binding.vektiva
org.openhab.binding.velbus
org.openhab.binding.velux
+ org.openhab.binding.vigicrues
org.openhab.binding.vitotronic
org.openhab.binding.volvooncall
org.openhab.binding.weathercompany