diff --git a/fhem/CHANGED b/fhem/CHANGED index d7c208ccf..4c386daae 100644 --- a/fhem/CHANGED +++ b/fhem/CHANGED @@ -1,5 +1,9 @@ # Add changes at the top of the list. Keep it in ASCII, and 80-char wide. - SVN + - change: The DBLOG propagated Attribute DbLogExclude will work as + regexp to exclude defined readings to log. + If a MinInterval is set, the logentry is dropped if the + defined interval is not reached and value vs. lastvalue is eqal - change: readingsGroup added valueFormat - feature: new modules JeeLink and PCA301 and for the ELV PCA 301 power meter with a JeeLabs JeeLink as RF modem. The matching JeeNode @@ -11,7 +15,7 @@ from one or more devices. this will replace weblink readings. (by justme1968) - feature: setreading command added - - change: DbLog: by using DbLog a new Attribute DbLogExclude will be + - feature: DbLog: by using DbLog a new Attribute DbLogExclude will be propagated to all Devices. DbLogExclue will work as regexp to exclude defined readings to log - change: loglevel attribute deprecated/replaced by the verbose attribute diff --git a/fhem/FHEM/93_DbLog.pm b/fhem/FHEM/93_DbLog.pm index 3fad3a6b5..c33adb785 100644 --- a/fhem/FHEM/93_DbLog.pm +++ b/fhem/FHEM/93_DbLog.pm @@ -362,8 +362,9 @@ DbLog_Log($$) my $re = $log->{REGEXP}; my $max = int(@{$dev->{CHANGED}}); my $ts_0 = TimeNow(); + my $now = gettimeofday(); # get timestamp in seconds since epoch my $DbLogExclude = AttrVal($dev->{NAME}, "DbLogExclude", undef); - + my $dbh= $log->{DBH}; $dbh->{RaiseError} = 1; @@ -396,7 +397,31 @@ DbLog_Log($$) } #keine Readings loggen die in DbLogExclude explizit ausgeschlossen sind - next if($DbLogExclude && $reading =~ m/^$DbLogExclude$/); + my $DoIt = 1; + if($DbLogExclude) { + # Bsp: "(temperature|humidity):300 battery:3600" + my @v1 = split(/,/, $DbLogExclude); + for (my $i=0; $i{NAME}}{'.userReadings'}{$reading}{"DBLOG_".$log->{NAME}}{TIME}; + my $lv = $defs{$dev->{NAME}}{'.userReadings'}{$reading}{"DBLOG_".$log->{NAME}}{VALUE}; + $lt = 0 if(!$lt); + $lv = "" if(!$lv); + + if(($now-$lt < $v2[1]) && ($lv eq $value)) { + # innerhalb MinIntervall und LastValue=Value + $DoIt = 0; + } + } + } + } + next if($DoIt == 0); + + $defs{$dev->{NAME}}{'.userReadings'}{$reading}{"DBLOG_".$log->{NAME}}{TIME} = $now; + $defs{$dev->{NAME}}{'.userReadings'}{$reading}{"DBLOG_".$log->{NAME}}{VALUE} = $value; my @is= ($ts, $n, $t, $s, $reading, $value, $unit); @@ -1395,14 +1420,20 @@ sub chartQuery($@) { Attributes
@@ -1655,15 +1686,23 @@ sub chartQuery($@) { Attribute