From 42af6d8b4f3abdd947692b05af011dc8a5011014 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=ABl=20L=27hopital?= Date: Sat, 13 Apr 2024 10:36:14 +0200 Subject: [PATCH] Resolves issue #16629 (#16640) Signed-off-by: gael@lhopital.org --- .../handler/channelhelper/DoorTagChannelHelper.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/bundles/org.openhab.binding.netatmo/src/main/java/org/openhab/binding/netatmo/internal/handler/channelhelper/DoorTagChannelHelper.java b/bundles/org.openhab.binding.netatmo/src/main/java/org/openhab/binding/netatmo/internal/handler/channelhelper/DoorTagChannelHelper.java index 916b9f3bcf0..87c47775bfb 100644 --- a/bundles/org.openhab.binding.netatmo/src/main/java/org/openhab/binding/netatmo/internal/handler/channelhelper/DoorTagChannelHelper.java +++ b/bundles/org.openhab.binding.netatmo/src/main/java/org/openhab/binding/netatmo/internal/handler/channelhelper/DoorTagChannelHelper.java @@ -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;