From ac8486d150cfa45de55374cf3e2acf1a45f28106 Mon Sep 17 00:00:00 2001 From: Thomas Vogl Date: Sat, 2 Mar 2024 21:53:38 +0100 Subject: [PATCH] ... --- .../servlets/AbstractEcowittServlet.java | 2 +- .../servlets/EcowittGW1000Servlet.java | 26 +++++++++---------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/bundles/org.openhab.binding.ecowitt/src/main/java/org/openhab/binding/ecowitt/internal/servlets/AbstractEcowittServlet.java b/bundles/org.openhab.binding.ecowitt/src/main/java/org/openhab/binding/ecowitt/internal/servlets/AbstractEcowittServlet.java index 75158587e..48be63796 100644 --- a/bundles/org.openhab.binding.ecowitt/src/main/java/org/openhab/binding/ecowitt/internal/servlets/AbstractEcowittServlet.java +++ b/bundles/org.openhab.binding.ecowitt/src/main/java/org/openhab/binding/ecowitt/internal/servlets/AbstractEcowittServlet.java @@ -39,7 +39,7 @@ public abstract class AbstractEcowittServlet extends HttpServlet { @Nullable protected StateUpdater stateUpdater = null; - private final Logger logger = LoggerFactory.getLogger(AbstractEcowittServlet.class); + protected final Logger logger = LoggerFactory.getLogger(AbstractEcowittServlet.class); protected void doPost(HttpServletRequest request, HttpServletResponse response) { for (Map.Entry stringEntry : request.getParameterMap().entrySet()) { diff --git a/bundles/org.openhab.binding.ecowitt/src/main/java/org/openhab/binding/ecowitt/internal/servlets/EcowittGW1000Servlet.java b/bundles/org.openhab.binding.ecowitt/src/main/java/org/openhab/binding/ecowitt/internal/servlets/EcowittGW1000Servlet.java index b7557ba15..aab492be1 100644 --- a/bundles/org.openhab.binding.ecowitt/src/main/java/org/openhab/binding/ecowitt/internal/servlets/EcowittGW1000Servlet.java +++ b/bundles/org.openhab.binding.ecowitt/src/main/java/org/openhab/binding/ecowitt/internal/servlets/EcowittGW1000Servlet.java @@ -57,53 +57,53 @@ public class EcowittGW1000Servlet extends AbstractEcowittServlet { } String type = channelUID.getId(); - float value; + Float value; switch (type) { case "humidity": case "atmospheric-humidity": case "moisture": - value = Float.parseFloat(strValue); + value = new Float(Float.parseFloat(strValue)); stateUpdater.updateState(ch.getUID(), new QuantityType<>(value, Units.PERCENT)); break; case "temperature": case "outdoor-temperature": - value = Float.parseFloat(strValue); + value = new Float(Float.parseFloat(strValue)); stateUpdater.updateState(ch.getUID(), new QuantityType<>(value, ImperialUnits.FAHRENHEIT)); break; case "uv-index": case "lightning-num": - value = Float.parseFloat(strValue); + value = new Float(Float.parseFloat(strValue)); stateUpdater.updateState(ch.getUID(), new DecimalType(value)); break; case "rain-amount": - value = Float.parseFloat(strValue); + value = new Float(Float.parseFloat(strValue)); stateUpdater.updateState(ch.getUID(), new QuantityType<>(value, ImperialUnits.INCH)); break; case "rain-rate": - value = Float.parseFloat(strValue); + value = new Float(Float.parseFloat(strValue)); stateUpdater.updateState(ch.getUID(), new QuantityType<>(value, Units.INCHES_PER_HOUR)); break; case "wind-speed": - value = Float.parseFloat(strValue); + value = new Float(Float.parseFloat(strValue)); stateUpdater.updateState(ch.getUID(), new QuantityType<>(value, ImperialUnits.MILES_PER_HOUR)); break; case "wind-direction": - value = Float.parseFloat(strValue); + value = new Float(Float.parseFloat(strValue)); stateUpdater.updateState(ch.getUID(), new QuantityType<>(value, Units.DEGREE_ANGLE)); break; case "barometric-pressure": - value = Float.parseFloat(strValue); + value = new Float(Float.parseFloat(strValue)); stateUpdater.updateState(ch.getUID(), new QuantityType<>(value, ImperialUnits.INCH_OF_MERCURY)); break; case "solar-radiation": - value = Float.parseFloat(strValue); + value = new Float(Float.parseFloat(strValue)); stateUpdater.updateState(ch.getUID(), new QuantityType<>(value, Units.IRRADIANCE)); break; case "lightning-distance": - value = Float.parseFloat(strValue); + value = new Float(Float.parseFloat(strValue)); stateUpdater.updateState(ch.getUID(), new QuantityType<>(value, MetricPrefix.KILO(SIUnits.METRE))); break; @@ -113,12 +113,12 @@ public class EcowittGW1000Servlet extends AbstractEcowittServlet { break; case "pm25-particles": - value = Float.parseFloat(strValue); + value = new Float(Float.parseFloat(strValue)); stateUpdater.updateState(ch.getUID(), new QuantityType<>(value, Units.MICROGRAM_PER_CUBICMETRE)); break; case "battery-level": - value = Float.parseFloat(strValue); + value = new Float(Float.parseFloat(strValue)); int batLevel = 0; switch (id) { case "pm25batt1":