From 0f8961d9b63f551454a8b0cb9f0d36fba0e6f1ea Mon Sep 17 00:00:00 2001 From: Dominik Meyer Date: Fri, 1 Mar 2024 21:05:38 +0100 Subject: [PATCH] ADD: Track number pf published messages CLOSES: #28 TIME: 5m --- FHEM/98_NTFY_CLIENT.pm | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/FHEM/98_NTFY_CLIENT.pm b/FHEM/98_NTFY_CLIENT.pm index 1023bf2..0871f41 100644 --- a/FHEM/98_NTFY_CLIENT.pm +++ b/FHEM/98_NTFY_CLIENT.pm @@ -247,7 +247,11 @@ sub NTFY_Publish_Msg return; } + my $nrPublishedMessages = ReadingsVal($hash->{NAME}, "nrPublishedMessages", 0); + $nrPublishedMessages++; + readingsBeginUpdate($hash); + readingsBulkUpdateIfChanged($hash, "nrPublishedMessages", $nrPublishedMessages); readingsBulkUpdateIfChanged($hash, "lastUsedTopic", $msg->{topic}); readingsBulkUpdateIfChanged($hash, "lastMessageSend", $msg->{text}); readingsBulkUpdateIfChanged($hash, "lastRawMessage", to_json($message));