Skip to content

Commit

Permalink
replaced error() with warn()
Browse files Browse the repository at this point in the history
Signed-off-by: Sven Killig <sven@killig.de>
  • Loading branch information
sonic74 committed Dec 4, 2020
1 parent 5eb6723 commit 137027c
Showing 1 changed file with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1170,10 +1170,10 @@ public void smartHomeCommand(String entityId, String action, @Nullable String pr
JsonObject parameters = new JsonObject();
parameters.addProperty("action", action);
if (property != null) {
if (value instanceof QuantityType) {
parameters.addProperty(property + ".value", ((QuantityType) value).floatValue());
if (value instanceof QuantityType<?>) {
parameters.addProperty(property + ".value", ((QuantityType<?>) value).floatValue());
parameters.addProperty(property + ".scale",
((QuantityType) value).getUnit().equals(SIUnits.CELSIUS) ? "celsius" : "fahrenheit");
((QuantityType<?>) value).getUnit().equals(SIUnits.CELSIUS) ? "celsius" : "fahrenheit");
} else if (value instanceof Boolean) {
parameters.addProperty(property, (boolean) value);
} else if (value instanceof String) {
Expand All @@ -1200,18 +1200,18 @@ public void smartHomeCommand(String entityId, String action, @Nullable String pr
if (errors != null && errors.isJsonArray()) {
JsonArray errorList = errors.getAsJsonArray();
if (errorList.size() > 0) {
logger.error("Smart home device command failed.");
logger.error("Request:");
logger.error("{}", requestBody);
logger.error("Answer:");
logger.warn("Smart home device command failed.");
logger.warn("Request:");
logger.warn("{}", requestBody);
logger.warn("Answer:");
for (JsonElement error : errorList) {
logger.error("{}", error.toString());
logger.warn("{}", error.toString());
}
}
}
}
} catch (URISyntaxException e) {
logger.error("Wrong url {}", url, e);
logger.warn("Wrong url {}", url, e);
}
}

Expand Down

0 comments on commit 137027c

Please sign in to comment.