2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-01-31 12:49:34 +00:00

fhem.pl: avoid warning messages in eocr-threshold checking

git-svn-id: https://svn.fhem.de/fhem/trunk@6249 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
rudolfkoenig 2014-07-13 10:41:00 +00:00
parent 115b55868d
commit f347e9795c

View File

@ -226,7 +226,7 @@ my $namedef = "where <name> is a single device name, a list separated by komma (
my $rcvdquit; # Used for quit handling in init files my $rcvdquit; # Used for quit handling in init files
my $readingsUpdateDelayTrigger; # needed internally my $readingsUpdateDelayTrigger; # needed internally
my $sig_term = 0; # if set to 1, terminate (saving the state) my $sig_term = 0; # if set to 1, terminate (saving the state)
my $wbName = ".WRITEBUFFER"; # Buffuer-name for delayed writing via select my $wbName = ".WRITEBUFFER"; # Buffer-name for delayed writing via select
my %comments; # Comments from the include files my %comments; # Comments from the include files
my %duplicate; # Pool of received msg for multi-fhz/cul setups my %duplicate; # Pool of received msg for multi-fhz/cul setups
my @cmdList; # Remaining commands in a chain. Used by sleep my @cmdList; # Remaining commands in a chain. Used by sleep
@ -3557,19 +3557,20 @@ readingsBulkUpdate($$$@)
my $eour = $attreour && grep($reading =~ m/^$_$/, @{$attreour}); my $eour = $attreour && grep($reading =~ m/^$_$/, @{$attreour});
# check if threshold is given # check if threshold is given
my $threshold_reachded = 1; my $threshold_reached = 1;
if( $eocr if( $eocr
&& $eocrv[0] =~ m/.*:(.*)/ ) { && $eocrv[0] =~ m/.*:(.*)/ ) {
$value =~ s/[^\d\.\-]//g; # We expect only numbers here.
my $last_value = $hash->{".attreocr-threshold$reading"}; my $last_value = $hash->{".attreocr-threshold$reading"};
if( !defined($last_value) ) { if( !defined($last_value) ) {
$hash->{".attreocr-threshold$reading"} = $value; $hash->{".attreocr-threshold$reading"} = $value;
} elsif( abs($value-$last_value) < $1 ) { } elsif( abs($value-$last_value) < $1 ) {
$threshold_reachded = 0; $threshold_reached = 0;
} else { } else {
$hash->{".attreocr-threshold$reading"} = $value; $hash->{".attreocr-threshold$reading"} = $value;
} }
#Log 1, "EOCR:$eocr value: $value last:$last_value threshold: $1 reached: $threshold_reachded"; #Log 1, "EOCR:$eocr value: $value last:$last_value threshold: $1 reached: $threshold_reached";
} }
# determine if an event should be created: # determine if an event should be created:
@ -3580,7 +3581,7 @@ readingsBulkUpdate($$$@)
# ...and the change greater then the threshold # ...and the change greater then the threshold
$changed= !($attreocr || $attreour) $changed= !($attreocr || $attreour)
|| $eour || $eour
|| ($eocr && ($value ne $readings->{VAL}) && $threshold_reachded); || ($eocr && ($value ne $readings->{VAL}) && $threshold_reached);
#Log 1, "EOCR:$eocr EOUR:$eour CHANGED:$changed"; #Log 1, "EOCR:$eocr EOUR:$eour CHANGED:$changed";
my @v = grep { my $l = $_; my @v = grep { my $l = $_;