ADD: provide last used priority as reading

This commit is contained in:
Dominik Meyer 2024-03-01 22:04:42 +01:00
parent 0fd9b594b6
commit 3e2944594f
Signed by: byterazor
GPG Key ID: EABDA0FD5981BC97

View File

@ -257,6 +257,26 @@ sub NTFY_Publish_Msg
readingsBulkUpdateIfChanged($hash, "lastUsedTopic", join(",", @{$msg->{topics}})); 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);