2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-04-16 10:46:03 +00:00

KM271 log fixes

git-svn-id: https://svn.fhem.de/fhem/trunk@589 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
rudolfkoenig 2010-03-14 11:33:54 +00:00
parent 8c205d412f
commit e627993c87
3 changed files with 54 additions and 8 deletions

View File

@ -262,8 +262,8 @@ FileLog_Get($@)
} elsif($t == 2) { # delta-h or delta-d } elsif($t == 2) { # delta-h or delta-d
my $hd = $h->{didx}; my $hd = $h->{didx}; # TimeStamp-Length
my $ld = substr($fld[0],0,$hd); my $ld = substr($fld[0],0,$hd); # TimeStamp-Part (hour or date)
if(!defined($h->{last1}) || $h->{last3} ne $ld) { if(!defined($h->{last1}) || $h->{last3} ne $ld) {
if(defined($h->{last1})) { if(defined($h->{last1})) {
my @lda = split("[_:]", $lastdate{$hd}); my @lda = split("[_:]", $lastdate{$hd});
@ -279,7 +279,6 @@ FileLog_Get($@)
} }
$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);
@ -313,6 +312,11 @@ FileLog_Get($@)
my $hd = $h->{didx}; my $hd = $h->{didx};
if($hd && $lastdate{$hd}) { if($hd && $lastdate{$hd}) {
my $val = defined($h->{last1}) ? $h->{last2}-$h->{last1} : 0; my $val = defined($h->{last1}) ? $h->{last2}-$h->{last1} : 0;
$min[$i] = $val if($min[$i] == 999999);
$max[$i] = $val if($max[$i] == -999999);
$lastv[$i] = $val if(!$lastv[$i]);
$sum[$i] = $val if(!$sum[$i]);
$cnt[$i] = 1 if(!$cnt[$i]);
my @lda = split("[_:]", $lastdate{$hd}); my @lda = split("[_:]", $lastdate{$hd});
my $ts = "12:00:00"; # middle timestamp my $ts = "12:00:00"; # middle timestamp

View File

@ -240,8 +240,9 @@ SVG_render($$$$$$)
# Round values, compute a nice step # Round values, compute a nice step
next if(!defined($hmax{$axis})); next if(!defined($hmax{$axis}));
my $dh = $hmax{$axis} - $hmin{$axis}; my $dh = $hmax{$axis} - $hmin{$axis};
my ($step, $mi, $ma); my ($step, $mi, $ma) = (1, 1, 1);
my @limit = (1,2,5,10,20,50,100,200,500,1000,2000,5000,10000); my @limit = (1,2,5,10,20,50,100,200,500,1000,2000,5000,10000,
20000,50000,100000,200000,500000,1000000,2000000);
for my $li (0..int(@limit)-1) { for my $li (0..int(@limit)-1) {
my $l = $limit[$li]; my $l = $limit[$li];
next if($dh > $l); next if($dh > $l);

View File

@ -0,0 +1,41 @@
############################
# Display the Water temperature and burner runtime values.
# Corresponding FileLog definition:
# define KM271 FileLog /var/log/fhem/km271-%Y.log KM271
set terminal png transparent size <SIZE> crop
set output '<OUT>.png'
set xdata time
set timefmt "%Y-%m-%d_%H:%M:%S"
set xlabel " "
set ytics nomirror
set y2tics
set title '<L1>'
set grid
set y2label "Temperature in C"
set format y "%0.1f"
set ylabel "Minutes"
set yrange [0:]
#FileLog 4:Warmwasseristtemperatur:0:
#FileLog 4:Brennerlaufzeit:0:delta-h
#FileLog 4:Brennerlaufzeit:0:delta-d
plot "<IN>" using 1:4 axes x1y2 title 'WW-Temp' with lines lw 2,\
"<grep Brennerlaufzeit <IN> | perl -ane '\
@a = split(\"[_:]\", $F[0]);\
if(defined($lh) && $lh ne $a[1])\
{ printf(\"${ld}_$lh:30:00 %f\n\", $hv); $hv = 0; }\
if($lv) { $hv += ($F[3]-$lv); }\
$lh = $a[1]; $ld = $a[0]; $lv = $F[3];\
END { printf(\"${ld}_$lh:30:00 %f\n\", $hv) }'"\
using 1:2 axes x1y1 title 'Runtime/h (Min)' with histeps,\
"<grep Brennerlaufzeit <IN> | perl -ane '\
@a = split(\"[_]\", $F[0]);\
if(defined($ld) && $ld ne $a[0]) {\
printf(\"${ld}_12:00:00 %f\n\", $dv); $dv = 0; }\
if($lv) { $dv += ($F[3]-$lv); }\
$ld = $a[0]; $lv = $F[3];\
END {printf(\"${ld}_12:00:00 %f\n\", $dv)}'"\
using 1:2 axes x1y1 title 'Runtime/day (Min)' with histeps