From 0301beccec10fb3fc2b94dd4f50cd97fbc1eefdc Mon Sep 17 00:00:00 2001 From: nasseeder1 Date: Thu, 30 Mar 2017 19:31:38 +0000 Subject: [PATCH] 93_DbRep: bugfix timestamp in minValue, maxValue if DB-VALUE contains more than one numeric value (e.g. in sysmon) git-svn-id: https://svn.fhem.de/fhem/trunk@13857 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/CHANGED | 2 ++ fhem/FHEM/93_DbRep.pm | 17 ++++++++--------- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/fhem/CHANGED b/fhem/CHANGED index 59e66ada9..0b82a6654 100644 --- a/fhem/CHANGED +++ b/fhem/CHANGED @@ -1,5 +1,7 @@ # Add changes at the top of the list. Keep it in ASCII, and 80-char wide. # Do not insert empty lines here, update check depends on it. + - bugfix: 93_DbRep: bugfix timestamp in minValue, maxValue if DB-VALUE + contains more than one numeric value (e.g. in sysmon) - bugfix: 38_netatmo: sanity check for dynamic interval - bugfix: 88_HMCCU: fixed bug in update of virtual devices - feature: 70_BRAVIA: command remoteControl supports 'Netflix' diff --git a/fhem/FHEM/93_DbRep.pm b/fhem/FHEM/93_DbRep.pm index 9372ffed2..845f1adf8 100644 --- a/fhem/FHEM/93_DbRep.pm +++ b/fhem/FHEM/93_DbRep.pm @@ -40,6 +40,8 @@ ########################################################################################################### # Versions History: # +# 4.11.4 29.03.2017 bugfix timestamp in minValue, maxValue if VALUE contains more than one +# numeric value (like in sysmon) # 4.11.3 26.03.2017 usage of daylight saving time changed to avoid wrong selection when wintertime # switch to summertime, minor bug fixes # 4.11.2 16.03.2017 bugfix in func dbmeta_DoParse (SQLITE_DB_FILENAME) @@ -178,7 +180,7 @@ use Blocking; use Time::Local; # no if $] >= 5.017011, warnings => 'experimental'; -my $DbRepVersion = "4.11.3"; +my $DbRepVersion = "4.11.4"; my %dbrep_col = ("DEVICE" => 64, "TYPE" => 64, @@ -1540,16 +1542,14 @@ sub maxval_DoParse($) { my $runtime_string = decode_base64($a[0]); $lastruntimestring = $runtime_string if ($i == 1); my $value = $a[1]; - - $a[3] =~ s/:/-/g if($a[3]); # substituieren unsopported characters -> siehe fhem.pl - my $timestamp = $a[3]?$a[2]."_".$a[3]:$a[2]; + $a[-1] =~ s/:/-/g if($a[-1]); # substituieren unsupported characters -> siehe fhem.pl + my $timestamp = ($a[-1]&&$a[-2])?$a[-2]."_".$a[-1]:$a[-1]; # Leerzeichen am Ende $timestamp entfernen $timestamp =~ s/\s+$//g; # Test auf $value = "numeric" if (!looks_like_number($value)) { - $a[3] =~ s/\s+$//g; Log3 ($name, 2, "DbRep $name - ERROR - value isn't numeric in maxValue function. Faulty dataset was \nTIMESTAMP: $timestamp, DEVICE: $device, READING: $reading, VALUE: $value."); $err = encode_base64("Value isn't numeric. Faulty dataset was - TIMESTAMP: $timestamp, VALUE: $value", ""); Log3 ($name, 4, "DbRep $name -> BlockingCall maxval_DoParse finished"); @@ -1775,16 +1775,15 @@ sub minval_DoParse($) { $lastruntimestring = $runtime_string if ($i == 1); $value = $a[1]; $min_value = $a[1] if ($i == 1); - - $a[3] =~ s/:/-/g if($a[3]); # substituieren unsopported characters -> siehe fhem.pl - my $timestamp = $a[3]?$a[2]."_".$a[3]:$a[2]; + $a[-1] =~ s/:/-/g if($a[-1]); # substituieren unsupported characters -> siehe fhem.pl + my $timestamp = ($a[-1]&&$a[-2])?$a[-2]."_".$a[-1]:$a[-1]; # Leerzeichen am Ende $timestamp entfernen $timestamp =~ s/\s+$//g; # Test auf $value = "numeric" if (!looks_like_number($value)) { - $a[3] =~ s/\s+$//g; + # $a[-1] =~ s/\s+$//g; Log3 ($name, 2, "DbRep $name - ERROR - value isn't numeric in minValue function. Faulty dataset was \nTIMESTAMP: $timestamp, DEVICE: $device, READING: $reading, VALUE: $value."); $err = encode_base64("Value isn't numeric. Faulty dataset was - TIMESTAMP: $timestamp, VALUE: $value", ""); Log3 ($name, 4, "DbRep $name -> BlockingCall minval_DoParse finished");