fhem.pl: readd accidentally removed patch 12772
git-svn-id: https://svn.fhem.de/fhem/trunk@12804 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
18
fhem/fhem.pl
18
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:
|
||||
|
||||
Reference in New Issue
Block a user