]> git.basschouten.com Git - openhab-addons.git/commitdiff
[miio] allow all quantitytypes and units (#9959)
authorMarcel <marcel@verpaalen.com>
Tue, 26 Jan 2021 04:14:10 +0000 (05:14 +0100)
committerGitHub <noreply@github.com>
Tue, 26 Jan 2021 04:14:10 +0000 (20:14 -0800)
Signed-off-by: Marcel Verpaalen <marcel@verpaalen.com>
bundles/org.openhab.binding.miio/src/main/java/org/openhab/binding/miio/internal/handler/MiIoBasicHandler.java

index d5badf5fd06ef7ac3195ba760a9e64e979e3a74c..bb7731f477ef22c22bd775c8ca0765ef1e5d5a18 100644 (file)
@@ -595,11 +595,14 @@ public class MiIoBasicHandler extends MiIoAbstractHandler {
                 logger.debug("'{}' channel '{}' has unit '{}' with symbol '{}'.", getThing().getUID(),
                         basicChannel.getChannel(), basicChannel.getUnit(), unit);
                 updateState(basicChannel.getChannel(), new QuantityType<>(val.getAsBigDecimal(), unit));
-                return;
             } else {
-                logger.debug("Unit '{}' used by '{}' channel '{}' is not found.. using default unit.",
-                        getThing().getUID(), basicChannel.getUnit(), basicChannel.getChannel());
+                logger.debug(
+                        "Unit '{}' used by '{}' channel '{}' is not found in conversion table... Trying anyway to submit as the update.",
+                        basicChannel.getUnit(), getThing().getUID(), basicChannel.getChannel());
+                updateState(basicChannel.getChannel(),
+                        new QuantityType<>(val.getAsBigDecimal().toPlainString() + " " + basicChannel.getUnit()));
             }
+            return;
         }
         // if no unit is provided or unit not found use default units, these units have so far been seen for miio
         // devices