From 62a1e8d5842a91d0b6550fa668d2c2b467e24ad8 Mon Sep 17 00:00:00 2001 From: rudolfkoenig Date: Sat, 17 Dec 2016 18:37:11 +0000 Subject: [PATCH] fhem.pl: readd accidentally removed patch 12772 git-svn-id: https://svn.fhem.de/fhem/trunk@12804 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/fhem.pl | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/fhem/fhem.pl b/fhem/fhem.pl index 41fa0b6c7..6960c5ec5 100755 --- a/fhem/fhem.pl +++ b/fhem/fhem.pl @@ -4188,26 +4188,18 @@ readingsBulkUpdate($$$@) if( $eocr && $eocrv[0] =~ m/.*:(.*)/ ) { my $threshold = $1; - my $ov = $value; - $value =~ s/[^\d\.\-eE]//g; # We expect only numbers here. - my $isNum = looks_like_number($value); - if(!$isNum) { # Forum #41083 - $value = $ov; - $value =~ s/[^\d\.\-]//g; - $isNum = looks_like_number($value); - } - if($isNum) { + if($value =~ m/([\d\.\-eE]+)/ && looks_like_number($1)) { #41083, #62190 + my $mv = $1; my $last_value = $hash->{".attreocr-threshold$reading"}; if( !defined($last_value) ) { - $hash->{".attreocr-threshold$reading"} = $value; - } elsif( abs($value-$last_value) < $threshold ) { + $hash->{".attreocr-threshold$reading"} = $mv; + } elsif( abs($mv - $last_value) < $threshold ) { $eocr = 0; } else { - $hash->{".attreocr-threshold$reading"} = $value; + $hash->{".attreocr-threshold$reading"} = $mv; } } - $value = $ov; } # determine if an event should be created: