FIX: only update error on subscriptions if really on error

This commit is contained in:
Dominik Meyer 2024-02-18 21:27:49 +01:00
parent b696bff31e
commit 1f03b8179c
Signed by: byterazor
GPG Key ID: EABDA0FD5981BC97

View File

@ -238,10 +238,13 @@ sub NTFY_WS_CB
my $name = $hash->{NAME}; my $name = $hash->{NAME};
readingsBeginUpdate($hash); if ($error)
readingsBulkUpdate($hash, "state", "error"); {
readingsBulkUpdate($hash, "error", $error); readingsBeginUpdate($hash);
readingsEndUpdate($hash,1); 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_ERROR, "error while connecting to websocket: $error ") if $error;
NTFY_LOG(LOG_DEBUG, "websocket callback called"); NTFY_LOG(LOG_DEBUG, "websocket callback called");