mirror of
https://github.com/openhab/openhab-addons.git
synced 2025-01-26 15:21:41 +01:00
Signed-off-by: gael@lhopital.org <gael@lhopital.org>
This commit is contained in:
parent
ec5b511a81
commit
42af6d8b4f
@ -42,8 +42,14 @@ public class DoorTagChannelHelper extends ChannelHelper {
|
|||||||
protected @Nullable State internalGetProperty(String channelId, NAThing naThing, Configuration config) {
|
protected @Nullable State internalGetProperty(String channelId, NAThing naThing, Configuration config) {
|
||||||
if (naThing instanceof HomeStatusModule doorTag) {
|
if (naThing instanceof HomeStatusModule doorTag) {
|
||||||
if (CHANNEL_STATUS.equalsIgnoreCase(channelId)) {
|
if (CHANNEL_STATUS.equalsIgnoreCase(channelId)) {
|
||||||
return doorTag.getStatus().map(status -> (State) OpenClosedType.valueOf(status.toUpperCase()))
|
return doorTag.getStatus().map(status -> {
|
||||||
.orElse(UnDefType.UNDEF);
|
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;
|
return null;
|
||||||
|
Loading…
Reference in New Issue
Block a user