]> git.basschouten.com Git - openhab-addons.git/commitdiff
[buienradar] Avoid to much log noise (#9804)
authorBjörn Brings <bjoernbrings@web.de>
Mon, 18 Jan 2021 07:35:11 +0000 (08:35 +0100)
committerGitHub <noreply@github.com>
Mon, 18 Jan 2021 07:35:11 +0000 (08:35 +0100)
Signed-off-by: Björn Brings <bjoernbrings@web.de>
bundles/org.openhab.binding.buienradar/src/main/java/org/openhab/binding/buienradar/internal/BuienradarHandler.java
bundles/org.openhab.binding.buienradar/src/main/java/org/openhab/binding/buienradar/internal/buienradarapi/BuienradarPredictionAPI.java
bundles/org.openhab.binding.buienradar/src/main/resources/OH-INF/thing/thing-types.xml

index 8d56f1dc48c9dce469a9980d3a80956c33ba5c37..025e675bc884ee4f97f5515dcab0c3f8079d29a3 100644 (file)
@@ -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<List<Prediction>> 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 {
index 9347641c3d8f951c835ed36a8c8ef0d74a919fc6..6a3cc2d0c57e8345e026b42e1dc5998225e50c71 100644 (file)
@@ -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();
         }
 
index 1f869648c0ed3cda02e67cbd3b03fab672b0260a..2b4f2b6133bc087c1eeebf29b3d1790b3f7808de 100644 (file)
                        </parameter>
 
                        <parameter name="exponentialBackoffRetryBaseInSeconds" type="integer" required="true" min="1" unit="s">
-                               <label>Exponential Backoff Base for Retries</label>
-                               <description>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.</description>
-                               <default>5</default>
+                               <label>Doubling Backoff Base for Retries</label>
+                               <description>Doubling back-off base value for retries in seconds. For example, when this is 30 seconds, will retry
+                                       at 30, 60, 120, 240 seconds.</description>
+                               <default>30</default>
                        </parameter>
                </config-description>