From b2db3095128412f4787fe0825ef66d38a550daae Mon Sep 17 00:00:00 2001 From: Cody Cutrer Date: Thu, 11 Apr 2024 13:54:49 -0600 Subject: [PATCH] [mqtt] fix UnDefType comparison in PercentageValue (#16639) Signed-off-by: Cody Cutrer Signed-off-by: Ciprian Pascu --- .../openhab/binding/mqtt/generic/values/PercentageValue.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bundles/org.openhab.binding.mqtt.generic/src/main/java/org/openhab/binding/mqtt/generic/values/PercentageValue.java b/bundles/org.openhab.binding.mqtt.generic/src/main/java/org/openhab/binding/mqtt/generic/values/PercentageValue.java index 8bcd75526ed..00c4af0ad8e 100644 --- a/bundles/org.openhab.binding.mqtt.generic/src/main/java/org/openhab/binding/mqtt/generic/values/PercentageValue.java +++ b/bundles/org.openhab.binding.mqtt.generic/src/main/java/org/openhab/binding/mqtt/generic/values/PercentageValue.java @@ -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;