Return 0 values too for hourly deltas
git-svn-id: https://fhem.svn.sourceforge.net/svnroot/fhem/trunk/fhem@643 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
@@ -245,6 +245,7 @@ FileLog_Get($@)
|
|||||||
|
|
||||||
for my $i (0..int(@a)-1) { # Process each req. field
|
for my $i (0..int(@a)-1) { # Process each req. field
|
||||||
my $h = $d[$i];
|
my $h = $d[$i];
|
||||||
|
my @missingvals;
|
||||||
next if($h->{re} && $l !~ m/$h->{re}/); # 20%
|
next if($h->{re} && $l !~ m/$h->{re}/); # 20%
|
||||||
|
|
||||||
my $col = $h->{col};
|
my $col = $h->{col};
|
||||||
@@ -273,12 +274,19 @@ FileLog_Get($@)
|
|||||||
$v = 0 if($v < 0); # Skip negative delta
|
$v = 0 if($v < 0); # Skip negative delta
|
||||||
$dte = "$lda[0]_$ts";
|
$dte = "$lda[0]_$ts";
|
||||||
$val = sprintf("%0.1f", $v);
|
$val = sprintf("%0.1f", $v);
|
||||||
|
if($hd == 13) { # Generate missing 0 values / hour
|
||||||
|
my @cda = split("[_:]", $ld);
|
||||||
|
for(my $mi = $lda[1]+1; $mi < $cda[1]; $mi++) {
|
||||||
|
push @missingvals, sprintf("%s_%02d:30:00 0\n", $lda[0], $mi);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
$h->{last1} = $fld[$col];
|
$h->{last1} = $fld[$col];
|
||||||
$h->{last3} = $ld;
|
$h->{last3} = $ld;
|
||||||
}
|
}
|
||||||
$h->{last2} = $fld[$col];
|
$h->{last2} = $fld[$col];
|
||||||
$lastdate{$hd} = $fld[0];
|
$lastdate{$hd} = $fld[0];
|
||||||
|
|
||||||
} elsif($t == 3) { # int function
|
} elsif($t == 3) { # int function
|
||||||
$val = $1 if($fld[$col] =~ m/^(\d+).*/o);
|
$val = $1 if($fld[$col] =~ m/^(\d+).*/o);
|
||||||
|
|
||||||
@@ -294,14 +302,21 @@ FileLog_Get($@)
|
|||||||
$cnt[$i]++;
|
$cnt[$i]++;
|
||||||
$lastv[$i] = $val;
|
$lastv[$i] = $val;
|
||||||
$lastd[$i] = $dte;
|
$lastd[$i] = $dte;
|
||||||
|
foreach my $mval (@missingvals) {
|
||||||
|
$cnt[$i]++;
|
||||||
|
$min[$i] = 0 if(0 < $min[$i]);
|
||||||
|
}
|
||||||
|
|
||||||
if($outf eq "-") {
|
if($outf eq "-") {
|
||||||
$h->{ret} .= "$dte $val\n";
|
$h->{ret} .= "$dte $val\n";
|
||||||
|
foreach my $mval (@missingvals) { $h->{ret} .= $mval }
|
||||||
} else {
|
} else {
|
||||||
my $fh = $h->{fh}; # cannot use $h->{fh} in print directly
|
my $fh = $h->{fh}; # cannot use $h->{fh} in print directly
|
||||||
print $fh "$dte $val\n";
|
print $fh "$dte $val\n";
|
||||||
|
foreach my $mval (@missingvals) { print $fh $mval }
|
||||||
$h->{count}++;
|
$h->{count}++;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$ifh->close();
|
$ifh->close();
|
||||||
|
|||||||
Reference in New Issue
Block a user