mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-04-28 23:14:10 +00:00
93_DbRep: contrib 8.51.4
git-svn-id: https://svn.fhem.de/fhem/trunk@27161 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
d52b398ed2
commit
82b1db34ed
@ -1,5 +1,5 @@
|
|||||||
##########################################################################################################
|
##########################################################################################################
|
||||||
# $Id: 93_DbRep.pm 27047 2023-01-21 20:58:50Z DS_Starter $
|
# $Id: 93_DbRep.pm 27102 2023-01-22 17:35:45Z DS_Starter $
|
||||||
##########################################################################################################
|
##########################################################################################################
|
||||||
# 93_DbRep.pm
|
# 93_DbRep.pm
|
||||||
#
|
#
|
||||||
@ -59,6 +59,7 @@ no if $] >= 5.017011, warnings => 'experimental::smartmatch';
|
|||||||
|
|
||||||
# Version History intern
|
# Version History intern
|
||||||
my %DbRep_vNotesIntern = (
|
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 ".
|
"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 ",
|
"DbRep_reduceLog -> Handling of field 'value' with NULL value ",
|
||||||
"8.51.2" => "13.01.2023 rewrite sub DbRep_OutputWriteToDB, new averageValue option writeToDBSingleStart ",
|
"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];
|
my $vnew = $sp[3];
|
||||||
$vnew =~ tr/\n//d;
|
$vnew =~ tr/\n//d;
|
||||||
|
|
||||||
|
if (!DbRep_IsNumeric ($vnew)) { # Test auf $value = "numeric"
|
||||||
|
Log3 ($name, 2, "DbRep $name - WARNING - dataset has no numeric value >$vnew< and is ignored, >$timestamp<, device >$device<, reading >$reading<.");
|
||||||
|
next;
|
||||||
|
}
|
||||||
|
|
||||||
$dse = $vold && (($vnew-$vold) > 0) ? ($vnew-$vold) : 0;
|
$dse = $vold && (($vnew-$vold) > 0) ? ($vnew-$vold) : 0;
|
||||||
@sp = $runtime_string." ".$timestamp." ".$vnew." ".$dse."\n";
|
@sp = $runtime_string." ".$timestamp." ".$vnew." ".$dse."\n";
|
||||||
$vold = $vnew;
|
$vold = $vnew;
|
||||||
@ -4558,8 +4564,6 @@ sub DbRep_diffval {
|
|||||||
$sth->finish;
|
$sth->finish;
|
||||||
$dbh->disconnect;
|
$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)
|
my $difflimit = AttrVal($name, "diffAccept", "20"); # legt fest, bis zu welchem Wert Differenzen akzeptiert werden (Ausreißer eliminieren)
|
||||||
|
|
||||||
# Berechnung diffValue aus Selektionshash
|
# Berechnung diffValue aus Selektionshash
|
||||||
@ -4588,7 +4592,7 @@ sub DbRep_diffval {
|
|||||||
|
|
||||||
$timestamp =~ s/\s+$//g; # Leerzeichen am Ende $timestamp entfernen
|
$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;
|
$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.");
|
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", "");
|
$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 !
|
$lval = $value if($value); # Übetrag über Perioden mit value = 0 hinweg !
|
||||||
$rslval = $runtime_string;
|
$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);
|
$diff_total = $diff ? $diff : 0 if($diff <= $difflimit);
|
||||||
$rh{$runtime_string} = $runtime_string."|".$diff_total."|".$timestamp;
|
$rh{$runtime_string} = $runtime_string."|".$diff_total."|".$timestamp;
|
||||||
@ -4644,10 +4648,10 @@ sub DbRep_diffval {
|
|||||||
$i++;
|
$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))) {
|
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);
|
my $ncp = DbRep_calcount($hash,\%ch);
|
||||||
@ -13671,12 +13675,12 @@ sub DbRep_setVersionInfo {
|
|||||||
if($modules{$type}{META}{x_prereqs_src} && !$hash->{HELPER}{MODMETAABSENT}) {
|
if($modules{$type}{META}{x_prereqs_src} && !$hash->{HELPER}{MODMETAABSENT}) {
|
||||||
# META-Daten sind vorhanden
|
# META-Daten sind vorhanden
|
||||||
$modules{$type}{META}{version} = "v".$v; # Version aus META.json überschreiben, Anzeige mit {Dumper $modules{SMAPortal}{META}}
|
$modules{$type}{META}{version} = "v".$v; # Version aus META.json überschreiben, Anzeige mit {Dumper $modules{SMAPortal}{META}}
|
||||||
if($modules{$type}{META}{x_version}) { # {x_version} ( nur gesetzt wenn $Id: 93_DbRep.pm 27047 2023-01-13 20:58:50Z DS_Starter $ im Kopf komplett! vorhanden )
|
if($modules{$type}{META}{x_version}) { # {x_version} ( nur gesetzt wenn $Id: 93_DbRep.pm 27102 2023-01-22 17:35:45Z DS_Starter $ im Kopf komplett! vorhanden )
|
||||||
$modules{$type}{META}{x_version} =~ s/1.1.1/$v/g;
|
$modules{$type}{META}{x_version} =~ s/1.1.1/$v/g;
|
||||||
} else {
|
} else {
|
||||||
$modules{$type}{META}{x_version} = $v;
|
$modules{$type}{META}{x_version} = $v;
|
||||||
}
|
}
|
||||||
return $@ unless (FHEM::Meta::SetInternals($hash)); # FVERSION wird gesetzt ( nur gesetzt wenn $Id: 93_DbRep.pm 27047 2023-01-13 20:58:50Z DS_Starter $ im Kopf komplett! vorhanden )
|
return $@ unless (FHEM::Meta::SetInternals($hash)); # FVERSION wird gesetzt ( nur gesetzt wenn $Id: 93_DbRep.pm 27102 2023-01-22 17:35:45Z DS_Starter $ im Kopf komplett! vorhanden )
|
||||||
if(__PACKAGE__ eq "FHEM::$type" || __PACKAGE__ eq $type) {
|
if(__PACKAGE__ eq "FHEM::$type" || __PACKAGE__ eq $type) {
|
||||||
# es wird mit Packages gearbeitet -> Perl übliche Modulversion setzen
|
# es wird mit Packages gearbeitet -> Perl übliche Modulversion setzen
|
||||||
# mit {<Modul>->VERSION()} im FHEMWEB kann Modulversion abgefragt werden
|
# mit {<Modul>->VERSION()} im FHEMWEB kann Modulversion abgefragt werden
|
||||||
|
Loading…
x
Reference in New Issue
Block a user