From 416ea638f5f10716207fef57b1f7a290f53555f1 Mon Sep 17 00:00:00 2001 From: bentele <> Date: Fri, 5 Apr 2013 20:58:33 +0000 Subject: [PATCH] NaN values and prevent too much logs git-svn-id: https://svn.fhem.de/fhem/trunk@3038 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/FHEM/70_SML.pm | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/fhem/FHEM/70_SML.pm b/fhem/FHEM/70_SML.pm index 320e53374..00cdadc7b 100644 --- a/fhem/FHEM/70_SML.pm +++ b/fhem/FHEM/70_SML.pm @@ -95,7 +95,7 @@ energy_Define($$) $hash->{Interval} = int(@args) >= 5 ? int($args[4]) : 300; $hash->{Timeout} = int(@args) >= 6 ? int($args[5]) : 4; - Log 3, "$hash->{NAME} will read from SML at $hash->{Host}:$hash->{Port} " ; + Log 4, "$hash->{NAME} will read from SML at $hash->{Host}:$hash->{Port} " ; $hash->{Invalid} = -1; # default value for invalid readings $hash->{Rereads} = 2; # number of retries when reading curPwr of 0 $hash->{UseSVTime} = ''; # use the SV time as timestamp (else: TimeNow()) @@ -176,15 +176,18 @@ if (defined ($socket) and $socket and $socket->connected()) @array = split(/\n/,$message); foreach (@array){ - if ( $_ =~ /(.*)<\/v>/ ) - { - Log 5, "$hash->{NAME} got fresh values from $ip ($1)"; - $last = $1; - $counts++ ; - $summary += $1; - if ($last < $min) {$min = $last}; + if ( $_ =~ /(.*)<\/v>/ ){ + Log 5, "$hash->{NAME} got fresh values from $ip ($1)"; + if ( $1 eq "NaN" ){ + Log 5, "$hash->{NAME} NaN fehler ($1) summary: $summary"; + }else{ + $last = $1; + $counts++ ; + $summary += $1; + if ($last < $min) {$min = $last}; if ($last > $max) {$max = $last}; - } + } + } if ( $_ =~ /(.*)<\/error>/ ) { if ( $1 eq "true" ) @@ -290,7 +293,7 @@ if ( $success == 0 and $summary > 0 and $counts > 0) } push @{$hash->{CHANGED}}, $log; DoTrigger($hash->{NAME}, undef) if ($init_done); - Log 3, "$hash->{NAME} write log file: $log"; + Log 4, "$hash->{NAME} write log file: $log"; }else{ Log 3, "$hash->{NAME} can't update - device send a error"; }