From c341c509b1e875cb356885488d687dd88cdc90ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Brings?= Date: Mon, 18 Jan 2021 08:35:11 +0100 Subject: [PATCH] [buienradar] Avoid to much log noise (#9804) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Björn Brings --- .../buienradar/internal/BuienradarHandler.java | 15 ++++++++++----- .../buienradarapi/BuienradarPredictionAPI.java | 2 +- .../main/resources/OH-INF/thing/thing-types.xml | 8 ++++---- 3 files changed, 15 insertions(+), 10 deletions(-) diff --git a/bundles/org.openhab.binding.buienradar/src/main/java/org/openhab/binding/buienradar/internal/BuienradarHandler.java b/bundles/org.openhab.binding.buienradar/src/main/java/org/openhab/binding/buienradar/internal/BuienradarHandler.java index 8d56f1dc48c..025e675bc88 100644 --- a/bundles/org.openhab.binding.buienradar/src/main/java/org/openhab/binding/buienradar/internal/BuienradarHandler.java +++ b/bundles/org.openhab.binding.buienradar/src/main/java/org/openhab/binding/buienradar/internal/BuienradarHandler.java @@ -76,7 +76,6 @@ public class BuienradarHandler extends BaseThingHandler { public void handleCommand(ChannelUID channelUID, Command command) { } - @SuppressWarnings("null") @Override public void initialize() { this.config = getConfigAs(BuienradarConfiguration.class); @@ -127,12 +126,19 @@ public class BuienradarHandler extends BaseThingHandler { return; } try { - @SuppressWarnings("null") final Optional> predictionsOpt = client.getPredictions(location); if (!predictionsOpt.isPresent()) { // Did not get a result, retry the retrieval. - logger.warn("Did not get a result from buienradar. Retrying. {} tries remaining, waiting {} seconds.", - tries, retryInSeconds); + // Buienradar is not a very stable source and returns nothing quite regular + if (tries <= 2) { + logger.warn( + "Did not get a result from buienradar. Retrying. {} tries remaining, waiting {} seconds.", + tries, retryInSeconds); + } else { + logger.debug( + "Did not get a result from buienradar. Retrying. {} tries remaining, waiting {} seconds.", + tries, retryInSeconds); + } scheduler.schedule(() -> refresh(tries - 1, nextRefresh, retryInSeconds * 2), retryInSeconds, TimeUnit.SECONDS); return; @@ -164,7 +170,6 @@ public class BuienradarHandler extends BaseThingHandler { } } - @SuppressWarnings("null") @Override public void dispose() { try { diff --git a/bundles/org.openhab.binding.buienradar/src/main/java/org/openhab/binding/buienradar/internal/buienradarapi/BuienradarPredictionAPI.java b/bundles/org.openhab.binding.buienradar/src/main/java/org/openhab/binding/buienradar/internal/buienradarapi/BuienradarPredictionAPI.java index 9347641c3d8..6a3cc2d0c57 100644 --- a/bundles/org.openhab.binding.buienradar/src/main/java/org/openhab/binding/buienradar/internal/buienradarapi/BuienradarPredictionAPI.java +++ b/bundles/org.openhab.binding.buienradar/src/main/java/org/openhab/binding/buienradar/internal/buienradarapi/BuienradarPredictionAPI.java @@ -143,7 +143,7 @@ public class BuienradarPredictionAPI implements PredictionAPI { try { result = HttpUtil.executeUrl("GET", address, TIMEOUT_MS); } catch (IOException e) { - logger.warn("IO Exception when trying to retrieve Buienradar results", e); + logger.debug("IO Exception when trying to retrieve Buienradar results: {}", e.getMessage()); return Optional.empty(); } diff --git a/bundles/org.openhab.binding.buienradar/src/main/resources/OH-INF/thing/thing-types.xml b/bundles/org.openhab.binding.buienradar/src/main/resources/OH-INF/thing/thing-types.xml index 1f869648c0e..2b4f2b6133b 100644 --- a/bundles/org.openhab.binding.buienradar/src/main/resources/OH-INF/thing/thing-types.xml +++ b/bundles/org.openhab.binding.buienradar/src/main/resources/OH-INF/thing/thing-types.xml @@ -60,10 +60,10 @@ - - Exponential back-off base value for retries in seconds. For example, when this is 2 seconds, will retry - at 2, 4, 8, 16, 32, 64 seconds. - 5 + + Doubling back-off base value for retries in seconds. For example, when this is 30 seconds, will retry + at 30, 60, 120, 240 seconds. + 30