From 3e7162d69a758555175143cd22402ed2d345d1ef Mon Sep 17 00:00:00 2001 From: Matthew Skinner Date: Wed, 20 Dec 2023 23:40:38 +1100 Subject: [PATCH] [opensprinkler] Fix excessive WARN in logs due to wifi dropouts, and current displays as 0 (#16080) * Fix 300mA current draw will display as 0 due to rounding. * Remove WARN logs when retries have not yet expired. Signed-off-by: Matthew Skinner --- .../internal/api/OpenSprinklerHttpApiV100.java | 12 ++---------- .../src/main/resources/OH-INF/thing/thing-types.xml | 2 +- 2 files changed, 3 insertions(+), 11 deletions(-) diff --git a/bundles/org.openhab.binding.opensprinkler/src/main/java/org/openhab/binding/opensprinkler/internal/api/OpenSprinklerHttpApiV100.java b/bundles/org.openhab.binding.opensprinkler/src/main/java/org/openhab/binding/opensprinkler/internal/api/OpenSprinklerHttpApiV100.java index afba8e367..0c8f68f79 100644 --- a/bundles/org.openhab.binding.opensprinkler/src/main/java/org/openhab/binding/opensprinkler/internal/api/OpenSprinklerHttpApiV100.java +++ b/bundles/org.openhab.binding.opensprinkler/src/main/java/org/openhab/binding/opensprinkler/internal/api/OpenSprinklerHttpApiV100.java @@ -12,15 +12,7 @@ */ package org.openhab.binding.opensprinkler.internal.api; -import static org.openhab.binding.opensprinkler.internal.OpenSprinklerBindingConstants.CMD_DISABLE_MANUAL_MODE; -import static org.openhab.binding.opensprinkler.internal.OpenSprinklerBindingConstants.CMD_ENABLE_MANUAL_MODE; -import static org.openhab.binding.opensprinkler.internal.OpenSprinklerBindingConstants.CMD_OPTIONS_INFO; -import static org.openhab.binding.opensprinkler.internal.OpenSprinklerBindingConstants.CMD_PASSWORD; -import static org.openhab.binding.opensprinkler.internal.OpenSprinklerBindingConstants.CMD_STATION_INFO; -import static org.openhab.binding.opensprinkler.internal.OpenSprinklerBindingConstants.CMD_STATUS_INFO; -import static org.openhab.binding.opensprinkler.internal.OpenSprinklerBindingConstants.DEFAULT_STATION_COUNT; -import static org.openhab.binding.opensprinkler.internal.OpenSprinklerBindingConstants.HTTPS_REQUEST_URL_PREFIX; -import static org.openhab.binding.opensprinkler.internal.OpenSprinklerBindingConstants.HTTP_REQUEST_URL_PREFIX; +import static org.openhab.binding.opensprinkler.internal.OpenSprinklerBindingConstants.*; import java.math.BigDecimal; import java.nio.charset.StandardCharsets; @@ -397,7 +389,7 @@ class OpenSprinklerHttpApiV100 implements OpenSprinklerApi { .timeout(config.timeout, TimeUnit.SECONDS).method(HttpMethod.GET).send(); connectionSuccess = true; } catch (InterruptedException | TimeoutException | ExecutionException e) { - logger.warn("Request to OpenSprinkler device failed (retries left: {}): {}", retriesLeft, + logger.debug("Request to OpenSprinkler device failed (retries left: {}): {}", retriesLeft, e.getMessage()); } } diff --git a/bundles/org.openhab.binding.opensprinkler/src/main/resources/OH-INF/thing/thing-types.xml b/bundles/org.openhab.binding.opensprinkler/src/main/resources/OH-INF/thing/thing-types.xml index 4d9f36115..41a66755c 100644 --- a/bundles/org.openhab.binding.opensprinkler/src/main/resources/OH-INF/thing/thing-types.xml +++ b/bundles/org.openhab.binding.opensprinkler/src/main/resources/OH-INF/thing/thing-types.xml @@ -163,7 +163,7 @@ The current draw in mA Energy - +