Skip to content

Commit

Permalink
[opensprinkler] Fix excessive WARN in logs due to wifi dropouts, and …
Browse files Browse the repository at this point in the history
…current displays as 0 (openhab#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 <[email protected]>
  • Loading branch information
Skinah authored Dec 20, 2023
1 parent 9872ca7 commit 3e7162d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -397,7 +389,7 @@ public String sendHttpGet(String url, @Nullable String urlParameters)
.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());
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@
<label>Current Draw</label>
<description>The current draw in mA</description>
<category>Energy</category>
<state readOnly="true"/>
<state readOnly="true" pattern="%.1f %unit%"/>
</channel-type>

<channel-type id="stationState">
Expand Down

0 comments on commit 3e7162d

Please sign in to comment.