diff --git a/FHEM/98_monitoring.pm b/FHEM/98_monitoring.pm
index be1999555..f2f973392 100644
--- a/FHEM/98_monitoring.pm
+++ b/FHEM/98_monitoring.pm
@@ -315,7 +315,7 @@ sub monitoring_Notify($$) {
Log3($SELF, 4 , "$TYPE ($SELF) triggered by \"$name $event\"");
- foreach my $list ("warning", "error"){
+ foreach my $list ("error", "warning"){
my $listFuncAdd = AttrVal($SELF, $list."FuncAdd", "preset");
my $listFuncRemove = AttrVal($SELF, $list."FuncRemove", "preset");
my $listWait = eval(AttrVal($SELF, $list."Wait", 0));
@@ -429,7 +429,11 @@ sub monitoring_modify($) {
);
if($operation eq "add"){
- return if($readings{$value});
+ return if(
+ $readings{$value} ||
+ ReadingsVal($SELF, "error", "") =~ m/(?:^|,)$value(?:,|$)/
+ );
+
if($at){
return if($hash->{READINGS}{$reading});
@@ -455,10 +459,16 @@ sub monitoring_modify($) {
return unless(@change || $operation eq "add");
+ my $allCount =
+ int(keys %readings) +
+ ReadingsNum($SELF, ($list eq "warning" ? "error" : "warning")."Count", 0)
+ ;
+
readingsBeginUpdate($hash);
readingsBulkUpdate($hash, "state", "$list $operation: $value");
readingsBulkUpdate($hash, $list, join(",", sort(keys %readings)));
readingsBulkUpdate($hash, $list."Count", int(keys %readings));
+ readingsBulkUpdate($hash, "allCount", $allCount);
readingsEndUpdate($hash, 1);
return;
@@ -509,7 +519,7 @@ sub monitoring_setActive($) {
readingsSingleUpdate($hash, "state", "active", 0);
Log3($SELF, 3, "$TYPE ($SELF) set $SELF active");
- foreach my $reading (sort(keys %{$hash->{READINGS}})){
+ foreach my $reading (reverse sort(keys %{$hash->{READINGS}})){
if($reading =~ m/(error|warning)Add_(.+)/){
my $wait = time_str2num(ReadingsVal($SELF, $reading, ""));
@@ -666,6 +676,10 @@ sub monitoring_setActive($) {
Readings
allCount
error
errorCount
state
warningCount
allCount
error
errorCount
state
warningCount