Resolves issue #16629 (#16640)

Signed-off-by: gael@lhopital.org <gael@lhopital.org>
Signed-off-by: Ciprian Pascu <contact@ciprianpascu.ro>
This commit is contained in:
Gaël L'hopital 2024-04-13 10:36:14 +02:00 committed by Ciprian Pascu
parent c6aad8f2c0
commit 3d74224025

View File

@ -42,8 +42,14 @@ public class DoorTagChannelHelper extends ChannelHelper {
protected @Nullable State internalGetProperty(String channelId, NAThing naThing, Configuration config) {
if (naThing instanceof HomeStatusModule doorTag) {
if (CHANNEL_STATUS.equalsIgnoreCase(channelId)) {
return doorTag.getStatus().map(status -> (State) OpenClosedType.valueOf(status.toUpperCase()))
.orElse(UnDefType.UNDEF);
return doorTag.getStatus().map(status -> {
try {
return (State) OpenClosedType.valueOf(status.toUpperCase());
} catch (IllegalArgumentException e) {
// Issue #16629 tag can also return 'no_news'
return UnDefType.UNDEF;
}
}).orElse(UnDefType.UNDEF);
}
}
return null;