mirror of
https://github.com/openhab/openhab-addons.git
synced 2025-01-10 15:11:59 +01:00
[mqtt] Treat incoming empty string as NULL for enum (#16641)
Treat incoming empty string as NULL for enum (#16641) Signed-off-by: Cody Cutrer <cody@cutrer.us> Signed-off-by: Ciprian Pascu <contact@ciprianpascu.ro>
This commit is contained in:
parent
39f91e7a7a
commit
ee9a0a31bf
@ -106,7 +106,11 @@ public class TextValue extends Value {
|
||||
final Set<String> states = this.states;
|
||||
String valueStr = command.toString();
|
||||
if (states != null && !states.contains(valueStr)) {
|
||||
throw new IllegalArgumentException("Value " + valueStr + " not within range");
|
||||
if (valueStr.isEmpty()) {
|
||||
return UnDefType.NULL;
|
||||
} else {
|
||||
throw new IllegalArgumentException("Value " + valueStr + " not within range");
|
||||
}
|
||||
}
|
||||
return new StringType(valueStr);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user