2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-03-09 20:57:11 +00:00

93_DbRep: fix diffValue writeToDB: Fm:#53584.msg1270905#msg1270905

git-svn-id: https://svn.fhem.de/fhem/trunk@27393 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
nasseeder1 2023-04-04 19:30:04 +00:00
parent c2f81e388c
commit ac1e4ea020
2 changed files with 12 additions and 7 deletions

View File

@ -1,5 +1,6 @@
# 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: fix diffValue writeToDB: Fm:#53584.msg1270905#msg1270905
- feature: 93_DbRep: diffValue can operate positive and negative differences,
sqlCmd can execute 'describe' statement
- bugfix: 72_FRITZBOX: Fehlerkorrekturen: u.a. fritzLog

View File

@ -59,7 +59,8 @@ no if $] >= 5.017011, warnings => 'experimental::smartmatch';
# Version History intern
my %DbRep_vNotesIntern = (
"8.52.2" => "28.03.2023 diffValue ",
"8.52.3" => "04.04.2023 fix diffValue writeToDB: https://forum.fhem.de/index.php?topic=53584.msg1270905#msg1270905 ",
"8.52.2" => "28.03.2023 diffValue can operate positive and negative differences, sqlCmd can execute 'describe' statement ",
"8.52.1" => "19.03.2023 fix Perl Warnings ",
"8.52.0" => "17.02.2023 get utf8mb4 info by connect db and set connection collation accordingly, new setter migrateCollation ",
"8.51.6" => "11.02.2023 fix execute DbRep_afterproc after generating readings ".
@ -4571,7 +4572,7 @@ sub DbRep_diffval {
my @db_array;
for my $row (@array) {
@sp = split("[ \t][ \t]*", $row, 4);
@sp = split /\s+/x, $row, 4;
my $runtime_string = $sp[0];
my $timestamp = $sp[2] ? $sp[1]." ".$sp[2] : $sp[1];
my $vnew = $sp[3];
@ -4607,15 +4608,15 @@ sub DbRep_diffval {
my $aval = AttrVal($name, "aggregation", "");
if($aval eq "hour") {
my @rsf = split(/[ :]/,$runtime_string_first);
my @rsf = split /[ :]/, $runtime_string_first;
@array = ($runtime_string." ".$rsf[0]."_".$rsf[1]."\n");
}
elsif($aval eq "minute") {
my @rsf = split(/[ :]/,$runtime_string_first);
my @rsf = split /[ :]/, $runtime_string_first;
@array = ($runtime_string." ".$rsf[0]."_".$rsf[1]."-".$rsf[2]."\n");
}
else {
my @rsf = split(" ",$runtime_string_first);
my @rsf = split " ", $runtime_string_first;
@array = ($runtime_string." ".$rsf[0]."\n");
}
}
@ -4648,7 +4649,10 @@ sub DbRep_diffval {
my @a = split /\s+/x, $row, 6;
my $runtime_string = decode_base64($a[0]);
$lastruntimestring = $runtime_string if ($i == 1);
my $timestamp = $a[2] ? $a[1]."_".$a[2] : $a[1];
next if(!$a[2]);
my $timestamp = $a[1]."_".$a[2];
my $value = $a[3] ? $a[3] : 0;
my $diff = $a[4] ? $a[4] : 0;
@ -4743,7 +4747,7 @@ sub DbRep_diffval {
# ignorierte Zeilen (abs $diff > $dlim)
my $rowsrej;
$rowsrej = encode_base64 ($rejectstr, "") if($rejectstr);
Log3 ($name, 1, "DbRep $name - rh: ".Dumper %rh) ;
my $rows = join('§', %rh); # Ergebnishash
my ($wrt,$irowdone); # Ergebnisse in Datenbank schreiben