mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-01-31 06:39:11 +00:00
93_DbRep: ignore non-numeric values in diffValue
git-svn-id: https://svn.fhem.de/fhem/trunk@27164 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
6de58e9aea
commit
17eebda9f6
@ -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.
|
||||
- change: 93_DbRep: ignore non-numeric values in diffValue and output
|
||||
the erroneous record in the log
|
||||
- feature: 74_AutomowerConnect: reduce readings, new getter for error codes
|
||||
and internal data, show mower path without registered image
|
||||
add widget selectnumbers to Park and Start setter
|
||||
|
@ -59,6 +59,7 @@ no if $] >= 5.017011, warnings => 'experimental::smartmatch';
|
||||
|
||||
# Version History intern
|
||||
my %DbRep_vNotesIntern = (
|
||||
"8.51.4" => "01.02.2023 ignore non-numeric values in diffValue and output the erroneous record in the log ",
|
||||
"8.51.3" => "22.01.2023 extend DbRep_averval avgTimeWeightMean by alkazaa, Restructuring of DbRep_averval ".
|
||||
"DbRep_reduceLog -> Handling of field 'value' with NULL value ",
|
||||
"8.51.2" => "13.01.2023 rewrite sub DbRep_OutputWriteToDB, new averageValue option writeToDBSingleStart ",
|
||||
@ -4522,6 +4523,11 @@ sub DbRep_diffval {
|
||||
my $vnew = $sp[3];
|
||||
$vnew =~ tr/\n//d;
|
||||
|
||||
if (!DbRep_IsNumeric ($vnew)) { # Test auf $value = "numeric"
|
||||
Log3 ($name, 3, "DbRep $name - WARNING - dataset has no numeric value >$vnew< and is ignored\ntimestamp >$timestamp<, device >$device<, reading >$reading<");
|
||||
next;
|
||||
}
|
||||
|
||||
$dse = $vold && (($vnew-$vold) > 0) ? ($vnew-$vold) : 0;
|
||||
@sp = $runtime_string." ".$timestamp." ".$vnew." ".$dse."\n";
|
||||
$vold = $vnew;
|
||||
@ -4558,8 +4564,6 @@ sub DbRep_diffval {
|
||||
$sth->finish;
|
||||
$dbh->disconnect;
|
||||
|
||||
# Log3 ($name, 5, "DbRep $name - raw data of row_array result:\n @row_array");
|
||||
|
||||
my $difflimit = AttrVal($name, "diffAccept", "20"); # legt fest, bis zu welchem Wert Differenzen akzeptiert werden (Ausreißer eliminieren)
|
||||
|
||||
# Berechnung diffValue aus Selektionshash
|
||||
@ -4588,7 +4592,7 @@ sub DbRep_diffval {
|
||||
|
||||
$timestamp =~ s/\s+$//g; # Leerzeichen am Ende $timestamp entfernen
|
||||
|
||||
if (!looks_like_number($value)) { # Test auf $value = "numeric"
|
||||
if (!DbRep_IsNumeric ($value)) { # Test auf $value = "numeric"
|
||||
$a[3] =~ s/\s+$//g;
|
||||
Log3 ($name, 2, "DbRep $name - ERROR - value isn't numeric in diffValue 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", "");
|
||||
@ -4633,7 +4637,7 @@ sub DbRep_diffval {
|
||||
$lval = $value if($value); # Übetrag über Perioden mit value = 0 hinweg !
|
||||
$rslval = $runtime_string;
|
||||
|
||||
Log3 ($name, 4, "DbRep $name - balance difference of $uediff between $rslval and $runtime_string");
|
||||
Log3 ($name, 5, "DbRep $name - balance difference of $uediff between $rslval and $runtime_string");
|
||||
|
||||
$diff_total = $diff ? $diff : 0 if($diff <= $difflimit);
|
||||
$rh{$runtime_string} = $runtime_string."|".$diff_total."|".$timestamp;
|
||||
@ -4644,10 +4648,10 @@ sub DbRep_diffval {
|
||||
$i++;
|
||||
}
|
||||
|
||||
Log3 ($name, 4, "DbRep $name - print result of diffValue calculation before encoding ...");
|
||||
Log3 ($name, 5, "DbRep $name - print result of diffValue calculation before encoding ...");
|
||||
|
||||
for my $key (sort(keys(%rh))) {
|
||||
Log3 ($name, 4, "runtimestring Key: $key, value: ".$rh{$key});
|
||||
Log3 ($name, 5, "runtimestring Key: $key, value: ".$rh{$key});
|
||||
}
|
||||
|
||||
my $ncp = DbRep_calcount($hash,\%ch);
|
||||
|
Loading…
Reference in New Issue
Block a user