]> git.basschouten.com Git - openhab-addons.git/commitdiff
[mqtt] fix UnDefType comparison in PercentageValue (#16639)
authorCody Cutrer <cody@cutrer.us>
Thu, 11 Apr 2024 19:54:49 +0000 (13:54 -0600)
committerGitHub <noreply@github.com>
Thu, 11 Apr 2024 19:54:49 +0000 (21:54 +0200)
Signed-off-by: Cody Cutrer <cody@cutrer.us>
bundles/org.openhab.binding.mqtt.generic/src/main/java/org/openhab/binding/mqtt/generic/values/PercentageValue.java

index 8bcd75526edce2938a799e25e43e1f2b8e072750..00c4af0ad8e0e79971bfcb3860ff68cb79d8175f 100644 (file)
@@ -73,7 +73,7 @@ public class PercentageValue extends Value {
 
     @Override
     public PercentType parseCommand(Command command) throws IllegalArgumentException {
-        PercentType oldvalue = (state == UnDefType.UNDEF) ? new PercentType() : (PercentType) state;
+        PercentType oldvalue = (state instanceof UnDefType) ? new PercentType() : (PercentType) state;
         // Nothing do to -> We have received a percentage
         if (command instanceof PercentType percent) {
             return percent;