[mqtt] fix UnDefType comparison in PercentageValue (#16639)

Signed-off-by: Cody Cutrer <cody@cutrer.us>
Signed-off-by: Ciprian Pascu <contact@ciprianpascu.ro>
This commit is contained in:
Cody Cutrer 2024-04-11 13:54:49 -06:00 committed by Ciprian Pascu
parent 93370fc51d
commit b2db309512

View 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;