From 6612e8da50cbd102fab2ddbc07a02d78fcf82697 Mon Sep 17 00:00:00 2001 From: rudolfkoenig <> Date: Sun, 16 Nov 2014 10:16:12 +0000 Subject: [PATCH] 92_FileLog.pm: SVG/FileLog_Get: fix delta-d problem on rescan 98_SVG.pn: Add "Show preprocessed input" button git-svn-id: https://svn.fhem.de/fhem/trunk@6997 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/FHEM/92_FileLog.pm | 2 ++ fhem/FHEM/98_SVG.pm | 36 ++++++++++++++++++++++++++++++++---- 2 files changed, 34 insertions(+), 4 deletions(-) diff --git a/fhem/FHEM/92_FileLog.pm b/fhem/FHEM/92_FileLog.pm index cf443d13f..aaabde09c 100755 --- a/fhem/FHEM/92_FileLog.pm +++ b/fhem/FHEM/92_FileLog.pm @@ -669,6 +669,8 @@ RESCAN: } elsif($t == 2) { # delta-h or delta-d + next if($rescan); + my $hd = $h->{didx}; # TimeStamp-Length my $ld = substr($fld[0],0,$hd); # TimeStamp-Part (hour or date) if(!defined($h->{last1}) || $h->{last3} ne $ld) { diff --git a/fhem/FHEM/98_SVG.pm b/fhem/FHEM/98_SVG.pm index 9f9809662..283564438 100755 --- a/fhem/FHEM/98_SVG.pm +++ b/fhem/FHEM/98_SVG.pm @@ -281,6 +281,9 @@ SVG_PEdit($$$$) $ret .= FW_hidden("detail", $d); # go to detail after save $ret .= FW_hidden("gplotName", $gp); $ret .= FW_hidden("logdevicetype", $ldt); + if(defined($FW_pos{zoom}) && defined($FW_pos{off})) { # for showData + $ret .= FW_hidden("pos", "zoom=$FW_pos{zoom};off=$FW_pos{off}"); + } $ret .= ""; $ret .= ""; $ret .= ""; @@ -331,7 +334,7 @@ SVG_PEdit($$$$) my @lineStyles; if(SVG_openFile($FW_cssdir, AttrVal($FW_wname,"stylesheetPrefix",""), "svg_style.css")) { - map { push(@lineStyles,$1) if($_ =~ m/^\.(l[^{ ]*)/) } ; + map { push(@lineStyles,$1) if($_ =~ m/^\.(l[^{ ]*)/) } ; # } vim help close(FH); } @@ -366,7 +369,9 @@ SVG_PEdit($$$$) $ret .= "Example lines for input:
$example
"; $ret .= ""; + $ret .= FW_submit("submit", "Write .gplot file")." ". + FW_submit("showFileLogData", "Show preprocessed input"). + ""; $ret .= "
Plot title
"; - $ret .= FW_submit("submit", "Write .gplot file")."
"; } @@ -434,14 +439,37 @@ SVG_zoomLink($$$) } +sub +SVG_showData() +{ + my $wl = $FW_webArgs{detail}; + my $hash = $defs{$wl}; + my ($d, $gplotfile, $file) = split(":", $hash->{DEF}); + $gplotfile = "$FW_gplotdir/$gplotfile.gplot"; + my ($err, $cfg, $plot, $flog) = SVG_readgplotfile($wl, $gplotfile); + if($err) { + $FW_RET=$err; + return 1; + } + SVG_calcOffsets($d, $wl); + my ($f,$t)=($SVG_devs{$d}{from}, $SVG_devs{$d}{to}); + my $cmd = "get $d $file - $f $t " . join(" ", @{$flog}); + my $ret = FW_fC($cmd, 1); + $ret =~ s/\n/
/gs; + $FW_RET = "$cmd

$ret"; + return 1; +} + sub SVG_WriteGplot($) { my ($arg) = @_; FW_digestCgi($arg); + return SVG_showData() if($FW_webArgs{showFileLogData}); + if(!defined($FW_webArgs{par_0_0})) { - FW_pO "missing data in logfile: won't write incomplete .gplot definition"; + $FW_RET="missing data in logfile: won't write incomplete .gplot definition"; return 0; } @@ -502,7 +530,7 @@ SVG_WriteGplot($) } my $err = FileWrite($fName, @rows); - FW_pO "SVG_WriteGplot: $err" if($err); + $FW_RET="SVG_WriteGplot: $err" if($err); return 0; }