[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 <matt@pcmus.com>
This commit is contained in:
Matthew Skinner 2023-12-20 23:40:38 +11:00 committed by GitHub
parent 9872ca7789
commit 3e7162d69a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 11 deletions

View File

@ -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());
}
}

View File

@ -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">