From dd790741a0498ff7082a8abf9830df2a71504432 Mon Sep 17 00:00:00 2001
From: lsiepel
Date: Sat, 21 Jan 2023 09:50:09 +0100
Subject: [PATCH] [jeelink] Fixed wrong TX22 rain value (#14224)
* Divide instead of multiply
* Remove apache.commons
Signed-off-by: lsiepel
---
.../LaCrosseTemperatureSensorHandler.java | 2 +-
.../internal/lacrosse/LgwSensorHandler.java | 2 +-
.../lacrosse/Tx22ReadingConverter.java | 2 +-
.../jeelink/internal/util/StringUtils.java | 48 +++++++++++++++++++
4 files changed, 51 insertions(+), 3 deletions(-)
create mode 100644 bundles/org.openhab.binding.jeelink/src/main/java/org/openhab/binding/jeelink/internal/util/StringUtils.java
diff --git a/bundles/org.openhab.binding.jeelink/src/main/java/org/openhab/binding/jeelink/internal/lacrosse/LaCrosseTemperatureSensorHandler.java b/bundles/org.openhab.binding.jeelink/src/main/java/org/openhab/binding/jeelink/internal/lacrosse/LaCrosseTemperatureSensorHandler.java
index d4b6cfe37..91d54179f 100644
--- a/bundles/org.openhab.binding.jeelink/src/main/java/org/openhab/binding/jeelink/internal/lacrosse/LaCrosseTemperatureSensorHandler.java
+++ b/bundles/org.openhab.binding.jeelink/src/main/java/org/openhab/binding/jeelink/internal/lacrosse/LaCrosseTemperatureSensorHandler.java
@@ -21,12 +21,12 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
-import org.apache.commons.lang3.StringUtils;
import org.openhab.binding.jeelink.internal.JeeLinkSensorHandler;
import org.openhab.binding.jeelink.internal.ReadingPublisher;
import org.openhab.binding.jeelink.internal.RollingAveragePublisher;
import org.openhab.binding.jeelink.internal.RollingReadingAverage;
import org.openhab.binding.jeelink.internal.config.LaCrosseTemperatureSensorConfig;
+import org.openhab.binding.jeelink.internal.util.StringUtils;
import org.openhab.core.library.types.OnOffType;
import org.openhab.core.library.types.QuantityType;
import org.openhab.core.library.unit.SIUnits;
diff --git a/bundles/org.openhab.binding.jeelink/src/main/java/org/openhab/binding/jeelink/internal/lacrosse/LgwSensorHandler.java b/bundles/org.openhab.binding.jeelink/src/main/java/org/openhab/binding/jeelink/internal/lacrosse/LgwSensorHandler.java
index e059c80a0..c6422ed6c 100644
--- a/bundles/org.openhab.binding.jeelink/src/main/java/org/openhab/binding/jeelink/internal/lacrosse/LgwSensorHandler.java
+++ b/bundles/org.openhab.binding.jeelink/src/main/java/org/openhab/binding/jeelink/internal/lacrosse/LgwSensorHandler.java
@@ -18,10 +18,10 @@ import static org.openhab.core.library.unit.MetricPrefix.*;
import java.math.BigDecimal;
import java.math.RoundingMode;
-import org.apache.commons.lang3.StringUtils;
import org.eclipse.jdt.annotation.NonNullByDefault;
import org.openhab.binding.jeelink.internal.JeeLinkSensorHandler;
import org.openhab.binding.jeelink.internal.ReadingPublisher;
+import org.openhab.binding.jeelink.internal.util.StringUtils;
import org.openhab.core.library.types.QuantityType;
import org.openhab.core.library.unit.SIUnits;
import org.openhab.core.library.unit.Units;
diff --git a/bundles/org.openhab.binding.jeelink/src/main/java/org/openhab/binding/jeelink/internal/lacrosse/Tx22ReadingConverter.java b/bundles/org.openhab.binding.jeelink/src/main/java/org/openhab/binding/jeelink/internal/lacrosse/Tx22ReadingConverter.java
index 5d464865a..dff632e46 100644
--- a/bundles/org.openhab.binding.jeelink/src/main/java/org/openhab/binding/jeelink/internal/lacrosse/Tx22ReadingConverter.java
+++ b/bundles/org.openhab.binding.jeelink/src/main/java/org/openhab/binding/jeelink/internal/lacrosse/Tx22ReadingConverter.java
@@ -83,7 +83,7 @@ public class Tx22ReadingConverter implements JeeLinkReadingConverter
+ * Capitalizes a String changing the first character to title case.
+ * No other characters are changed.
+ *
+ *
+ *
+ * StringUtils.capitalize(null) = null
+ * StringUtils.capitalize("") = ""
+ * StringUtils.capitalize("cat") = "Cat"
+ * StringUtils.capitalize("cAt") = "CAt"
+ * StringUtils.capitalize("'cat'") = "'cat'"
+ *
+ *
+ * @param val the String to capitalize, may not be null
+ * @return the capitalized String
+ */
+ public static String capitalize(String val) {
+ if (val.length() == 0) {
+ return val;
+ }
+ return val.substring(0, 1).toUpperCase() + val.substring(1);
+ }
+}