Compare commits

..

2 Commits

Author SHA1 Message Date
3e2944594f
ADD: provide last used priority as reading 2024-03-01 22:04:42 +01:00
0fd9b594b6
FIX: undefined value
FIXES: #20
2024-03-01 22:03:18 +01:00

View File

@ -254,9 +254,29 @@ sub NTFY_Publish_Msg
readingsBeginUpdate($hash); readingsBeginUpdate($hash);
readingsBulkUpdateIfChanged($hash, "nrPublishedMessages", $nrPublishedMessages); readingsBulkUpdateIfChanged($hash, "nrPublishedMessages", $nrPublishedMessages);
readingsBulkUpdateIfChanged($hash, "lastUsedTopic", $msg->{topic}); readingsBulkUpdateIfChanged($hash, "lastUsedTopic", join(",", @{$msg->{topics}}));
readingsBulkUpdateIfChanged($hash, "lastMessageSend", $msg->{text}); readingsBulkUpdateIfChanged($hash, "lastMessageSend", $msg->{text});
readingsBulkUpdateIfChanged($hash, "lastRawMessage", to_json($message)); readingsBulkUpdateIfChanged($hash, "lastRawMessage", to_json($message));
if ($msg->{priority} == PRIO_MAX)
{
readingsBulkUpdateIfChanged($hash, "lastUsedPriority", "max");
}
elsif ($msg->{priority} == PRIO_HIGH)
{
readingsBulkUpdateIfChanged($hash, "lastUsedPriority", "high");
}
elsif ($msg->{priority} == PRIO_DEFAULT)
{
readingsBulkUpdateIfChanged($hash, "lastUsedPriority", "default");
}
elsif ($msg->{priority} == PRIO_LOW)
{
readingsBulkUpdateIfChanged($hash, "lastUsedPriority", "low");
}
elsif ($msg->{priority} == PRIO_MIN)
{
readingsBulkUpdateIfChanged($hash, "lastUsedPriority", "min");
}
readingsBulkUpdateIfChanged($hash, "lastEror", ""); readingsBulkUpdateIfChanged($hash, "lastEror", "");
readingsEndUpdate($hash,1); readingsEndUpdate($hash,1);