From 77cf29e3ea9b2941fc630d0569fc2ca8215c86ec Mon Sep 17 00:00:00 2001 From: rudolfkoenig Date: Sun, 13 Jul 2014 10:41:00 +0000 Subject: [PATCH] fhem.pl: avoid warning messages in eocr-threshold checking git-svn-id: https://svn.fhem.de/fhem/trunk@6249 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/fhem.pl | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/fhem/fhem.pl b/fhem/fhem.pl index 659ef991a..3286ba751 100755 --- a/fhem/fhem.pl +++ b/fhem/fhem.pl @@ -226,7 +226,7 @@ my $namedef = "where is a single device name, a list separated by komma ( my $rcvdquit; # Used for quit handling in init files my $readingsUpdateDelayTrigger; # needed internally 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 %duplicate; # Pool of received msg for multi-fhz/cul setups my @cmdList; # Remaining commands in a chain. Used by sleep @@ -3557,19 +3557,20 @@ readingsBulkUpdate($$$@) my $eour = $attreour && grep($reading =~ m/^$_$/, @{$attreour}); # check if threshold is given - my $threshold_reachded = 1; + my $threshold_reached = 1; if( $eocr && $eocrv[0] =~ m/.*:(.*)/ ) { + $value =~ s/[^\d\.\-]//g; # We expect only numbers here. my $last_value = $hash->{".attreocr-threshold$reading"}; if( !defined($last_value) ) { $hash->{".attreocr-threshold$reading"} = $value; } elsif( abs($value-$last_value) < $1 ) { - $threshold_reachded = 0; + $threshold_reached = 0; } else { $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: @@ -3580,7 +3581,7 @@ readingsBulkUpdate($$$@) # ...and the change greater then the threshold $changed= !($attreocr || $attreour) || $eour - || ($eocr && ($value ne $readings->{VAL}) && $threshold_reachded); + || ($eocr && ($value ne $readings->{VAL}) && $threshold_reached); #Log 1, "EOCR:$eocr EOUR:$eour CHANGED:$changed"; my @v = grep { my $l = $_;