fhem.pl: event-on-change-reading patch by justme1968 (Forum #24378)

git-svn-id: https://svn.fhem.de/fhem/trunk@6880 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
rudolfkoenig
2014-11-03 22:25:33 +00:00
parent 334e9d4eb2
commit bb02a5e951

View File

@@ -3653,12 +3653,13 @@ readingsBulkUpdate($$$@)
my $threshold_reached = 1;
if( $eocr
&& $eocrv[0] =~ m/.*:(.*)/ ) {
my $threshold = $1;
$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 ) {
} elsif( abs($value-$last_value) < $threshold ) {
$threshold_reached = 0;
} else {
$hash->{".attreocr-threshold$reading"} = $value;