From 1f03b8179c7d941274b99dbca0672568f5ccee68 Mon Sep 17 00:00:00 2001 From: Dominik Meyer Date: Sun, 18 Feb 2024 21:27:49 +0100 Subject: [PATCH] FIX: only update error on subscriptions if really on error --- FHEM/98_NTFY_CLIENT.pm | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/FHEM/98_NTFY_CLIENT.pm b/FHEM/98_NTFY_CLIENT.pm index 5d257ba..94bc0e0 100644 --- a/FHEM/98_NTFY_CLIENT.pm +++ b/FHEM/98_NTFY_CLIENT.pm @@ -238,10 +238,13 @@ sub NTFY_WS_CB my $name = $hash->{NAME}; - readingsBeginUpdate($hash); - readingsBulkUpdate($hash, "state", "error"); - readingsBulkUpdate($hash, "error", $error); - readingsEndUpdate($hash,1); + if ($error) + { + readingsBeginUpdate($hash); + readingsBulkUpdate($hash, "state", "error"); + readingsBulkUpdate($hash, "error", $error); + readingsEndUpdate($hash,1); + } NTFY_LOG(LOG_ERROR, "error while connecting to websocket: $error ") if $error; NTFY_LOG(LOG_DEBUG, "websocket callback called");