Skip to content

Commit

Permalink
[mqtt] fix UnDefType comparison in PercentageValue
Browse files Browse the repository at this point in the history
Since openhab#16307, the state could get set to NULL, not just UNDEF, and
once it got in that state PercentageValue would throw an error every
time it received any other message or command, effectively rendering
the channel broken until openHAB restarted.

Signed-off-by: Cody Cutrer <[email protected]>
  • Loading branch information
ccutrer committed Apr 11, 2024
1 parent 4ac959d commit 010916e
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public PercentageValue(@Nullable BigDecimal min, @Nullable BigDecimal max, @Null

@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;
Expand Down

0 comments on commit 010916e

Please sign in to comment.