mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-01-31 06:39:11 +00:00
Multiline extension, pgm2 reordering
git-svn-id: https://svn.fhem.de/fhem/trunk@168 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
9cf3ffb22a
commit
de1cc4ea3c
@ -384,6 +384,7 @@
|
||||
- feature: contrib/00_LIRC.pm (25.3, by Bernhard)
|
||||
- bugfix : 00_FHZ: additional stty settings for strange Linux versions
|
||||
- bugfix : pgm2 wrong temp summary for FHT's (reported by O.D., 16.4.2008)
|
||||
|
||||
- TODO
|
||||
emem -2.5kW / getDevData for emwz -1
|
||||
- feature: FHEM modules may live on a filesystem with "ignorant" casing (FAT)
|
||||
- feature: FileLog "set reopen" for manual tweaking of logfiles.
|
||||
- feature: multiline commands are supported through the command line
|
||||
- feature: pgm2 installation changes, multiple instances, external css
|
||||
|
@ -25,8 +25,8 @@ at_Define($$)
|
||||
my ($name, undef, $tm, $command) = split("[ \t]+", $def, 4);
|
||||
|
||||
if(!$command) {
|
||||
if($hash->{CMD}) {
|
||||
$command = $hash->{CMD}; # Called from modify
|
||||
if($hash->{OLDDEF}) { # Called from modify, where command is optional
|
||||
(undef, $command) = split("[ \t]+", $hash->{OLDDEF}, 2);
|
||||
$hash->{DEF} = "$tm $command";
|
||||
} else {
|
||||
return "Usage: define <name> at <timespec> <command>";
|
||||
@ -65,7 +65,6 @@ at_Define($$)
|
||||
}
|
||||
$hash->{NTM} = $ntm if($rel eq "+" || $fn);
|
||||
$hash->{TRIGGERTIME} = $nt;
|
||||
$hash->{CMD} = SemicolonEscape($command);
|
||||
$nextat = $nt if(!$nextat || $nextat > $nt);
|
||||
|
||||
$hash->{STATE} = "Next: " . FmtTime($nt);
|
||||
@ -85,7 +84,9 @@ at_Exec($)
|
||||
}
|
||||
|
||||
delete $attr{$name}{skip_next} if($skip);
|
||||
AnalyzeCommandChain(undef, $defs{$name}{CMD}) if(!$skip && !$disable);
|
||||
my (undef, $command) = split("[ \t]+", $defs{$name}{DEF}, 2);
|
||||
$command = SemicolonEscape($command);
|
||||
AnalyzeCommandChain(undef, $command) if(!$skip && !$disable);
|
||||
|
||||
my $count = $defs{$name}{REP};
|
||||
my $def = $defs{$name}{DEF};
|
||||
|
@ -25,17 +25,17 @@ notify_Define($$)
|
||||
my ($type, $name, $re, $command) = split("[ \t]+", $def, 4);
|
||||
|
||||
if(!$command) {
|
||||
if($hash->{CMD}) {
|
||||
$command = $hash->{CMD}; # Called from modify
|
||||
if($hash->{OLDDEF}) { # Called from modify, where command is optional
|
||||
(undef, $command) = split("[ \t]+", $hash->{OLDDEF}, 2);
|
||||
$hash->{DEF} = "$re $command";
|
||||
} else {
|
||||
return "Usage: define <name> notify <regexp> <command>";
|
||||
}
|
||||
}
|
||||
|
||||
# Checking for misleading regexps
|
||||
eval { "Hallo" =~ m/^$re$/ };
|
||||
return "Bad regexp: $@" if($@);
|
||||
$hash->{CMD} = SemicolonEscape($command);
|
||||
$hash->{REGEXP} = $re;
|
||||
$hash->{STATE} = "active";
|
||||
|
||||
@ -46,13 +46,13 @@ notify_Define($$)
|
||||
sub
|
||||
notify_Exec($$)
|
||||
{
|
||||
my ($log, $dev) = @_;
|
||||
my ($ntfy, $dev) = @_;
|
||||
|
||||
my $ln = $log->{NAME};
|
||||
my $ln = $ntfy->{NAME};
|
||||
return "" if($attr{$ln} && $attr{$ln}{disable});
|
||||
|
||||
my $n = $dev->{NAME};
|
||||
my $re = $log->{REGEXP};
|
||||
my $re = $ntfy->{REGEXP};
|
||||
my $max = int(@{$dev->{CHANGED}});
|
||||
my $t = $dev->{TYPE};
|
||||
|
||||
@ -61,7 +61,8 @@ notify_Exec($$)
|
||||
my $s = $dev->{CHANGED}[$i];
|
||||
$s = "" if(!defined($s));
|
||||
if($n =~ m/^$re$/ || "$n:$s" =~ m/^$re$/) {
|
||||
my $exec = $log->{CMD};
|
||||
my (undef, $exec) = split("[ \t]+", $ntfy->{DEF}, 2);
|
||||
$exec = SemicolonEscape($exec);
|
||||
|
||||
$exec =~ s/%%/____/g;
|
||||
my $extsyntax= 0;
|
||||
|
@ -11,8 +11,10 @@ FileLog_Initialize($)
|
||||
{
|
||||
my ($hash) = @_;
|
||||
|
||||
$hash->{DefFn} = "FileLog_Define";
|
||||
$hash->{UndefFn} = "FileLog_Undef";
|
||||
$hash->{DefFn} = "FileLog_Define";
|
||||
$hash->{SetFn} = "FileLog_Set";
|
||||
$hash->{GetFn} = "FileLog_Get";
|
||||
$hash->{UndefFn} = "FileLog_Undef";
|
||||
$hash->{NotifyFn} = "FileLog_Log";
|
||||
$hash->{AttrFn} = "FileLog_Attr";
|
||||
# logtype is used by the frontend
|
||||
@ -101,6 +103,7 @@ FileLog_Log($$)
|
||||
return "";
|
||||
}
|
||||
|
||||
###################################
|
||||
sub
|
||||
FileLog_Attr(@)
|
||||
{
|
||||
@ -117,4 +120,79 @@ FileLog_Attr(@)
|
||||
|
||||
return undef;
|
||||
}
|
||||
|
||||
###################################
|
||||
sub
|
||||
FileLog_Set($@)
|
||||
{
|
||||
my ($hash, @a) = @_;
|
||||
|
||||
return "no set argument specified" if(int(@a) != 2);
|
||||
return "Unknown argument $a[1], choose one of reopen"
|
||||
if($a[1] ne "reopen");
|
||||
|
||||
my $fh = $hash->{FH};
|
||||
my $cn = $hash->{currentlogfile};
|
||||
$fh->close();
|
||||
$fh = new IO::File ">>$cn";
|
||||
return "Can't open $cn" if(!defined($fh));
|
||||
$hash->{FH} = $fh;
|
||||
return undef;
|
||||
}
|
||||
|
||||
###################################
|
||||
sub
|
||||
FileLog_Get($@)
|
||||
{
|
||||
my ($hash, @a) = @_;
|
||||
|
||||
return "Usage: get $a[0] <from> <to> <column_list>" if(int(@a) != 4);
|
||||
my $fh = new IO::File $hash->{currentlogfile};
|
||||
seekTo($fh, $hash, $a[1]);
|
||||
# my @arr =
|
||||
while(my $l = <$fh>) {
|
||||
last if($l gt $a[2]);
|
||||
}
|
||||
close($fh);
|
||||
return "EOF" if(!defined($data));
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
###################################
|
||||
sub
|
||||
seekTo($$$)
|
||||
{
|
||||
my ($fh, $hash, $ts) = @_;
|
||||
|
||||
# If its cached
|
||||
if($hash->{pos} && $hash->{pos}{$ts}) {
|
||||
$fh->seek($hash->{pos}{$ts}, 0);
|
||||
return;
|
||||
}
|
||||
|
||||
$fh->seek(0, 2); # Go to the end
|
||||
my $upper = $fh->tell;
|
||||
|
||||
my ($lower, $next, $last) = (0, $upper/2, 0);
|
||||
while() { # Binary search
|
||||
$fh->seek($next, 0);
|
||||
my $data = <$fh>;
|
||||
if($data !~ m/^20\d\d-\d\d-\d\d_\d\d:\d\d:\d\d /) {
|
||||
$next = $fh->tell;
|
||||
$data = <$fh>;
|
||||
}
|
||||
last if($next eq $last);
|
||||
|
||||
$last = $next;
|
||||
if($data lt $ts) {
|
||||
($lower, $next) = ($next, ($next+$upper)/2);
|
||||
} else {
|
||||
($upper, $next) = ($next, ($lower+$next)/2);
|
||||
}
|
||||
}
|
||||
$hash->{pos}{$ts} = $last;
|
||||
|
||||
}
|
||||
|
||||
1;
|
||||
|
28
fhem/HISTORY
28
fhem/HISTORY
@ -220,3 +220,31 @@
|
||||
|
||||
- Peter S. Wed Mar 19 08:24:00 MET 2008
|
||||
- 00_FHZ.pm: DoTriger -> DoTrigger
|
||||
|
||||
- Rudi Fri May 9 20:00:00 MEST 2008
|
||||
- feature: FHEM modules may live on a filesystem with "ignorant" casing (FAT)
|
||||
If you install FHEM on a USB-Stick (e.g. for the FritzBox) it may happen
|
||||
that the filename casing is different from the function names inside the file.
|
||||
-> Fhem won't find the <module>_Initialize function. Fixed by searching all
|
||||
function-names for a match with "ignore-case"
|
||||
- feature: FileLog function "set reopen" impemented. In case you want to delete some
|
||||
wrong entries from a current logfile, you must tell fhem to reopen the file again
|
||||
- feature: multiline commands are supported through the command line
|
||||
Up till now multiline commands were supported only by "include". Now they
|
||||
are supprted from the (tcp/ip) connection too, so they can be used by the
|
||||
web frontends.
|
||||
- feature: pgm2 installation changes, multiple instances, external css
|
||||
pgm2 (FHEMWEB) is now a "real" fhem module:
|
||||
- the configuration takes place via attributes
|
||||
- the css file is external, and each FHEMWEB instance can use its own set
|
||||
- the default location for pictures, gnuplot scripts and css is the FHEM
|
||||
module directory
|
||||
- multiline support for notify and at scripts.
|
||||
|
||||
|
||||
|
||||
|
||||
- feature: FileLog "set reopen" for manual tweaking of logfiles.
|
||||
- feature: multiline commands are supported through the command line
|
||||
- feature: pgm2 installation changes, multiple instances, external css
|
||||
|
||||
|
@ -98,9 +98,9 @@ configuration file at startup). The commands are either executed directly, or
|
||||
later if they are arguments to the <a href="#at">at</a> and <a
|
||||
href="#notify">notify</a> fhem commands.<br><br>
|
||||
|
||||
If commands are read from a file, then a line ending with \ will be
|
||||
concatenated with the next one, so long lines (e.g. perl oneliners) can be
|
||||
split in multiple lines<br><br>
|
||||
A line ending with \ will be concatenated with the next one, so long lines
|
||||
(e.g. multiple perl commands) can be split in multiple lines. Some web fronteds
|
||||
make editing of multiline commands transparent.<br><br>
|
||||
|
||||
|
||||
<a name="help"></a>
|
||||
@ -1826,6 +1826,15 @@ Send buffer:<br/> 2007-10-19 00:31:24 desired-temp 22.5
|
||||
<br><br>
|
||||
</ul>
|
||||
|
||||
<a name="FileLogset"></a>
|
||||
<h4>Type FileLog:</h4>
|
||||
<ul>
|
||||
<code>set <name> reopen</code><br>
|
||||
|
||||
Used to reopen a FileLog after making some manual changes to the logfile.
|
||||
<br>
|
||||
</ul>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
|
@ -29,7 +29,6 @@
|
||||
<br>
|
||||
What does not work right now:<br>
|
||||
<ul>
|
||||
<li>Automatic startup after reboot of the fritzbox</li>
|
||||
<li>Gnuplot. No idea how to replace it, perhaps we compile a fritzbox
|
||||
version</li>
|
||||
<li>EM1010PC. I tried it without batteries, and I think the USB interface
|
||||
@ -81,6 +80,12 @@
|
||||
telnet fritz.box 7072<br>
|
||||
</ul>
|
||||
to define your devices.</li>
|
||||
<li>To enable automatic startup after reboot of the fritzbox enter the
|
||||
following at the end of the /var/flash/debug.cfg:<br>
|
||||
<ul>
|
||||
/bin/sleep 120<br>
|
||||
cd /var/media/ftp/*Partition*/usr/fhem && ./rc.fhem
|
||||
</ul></li>
|
||||
</ul>
|
||||
<br>
|
||||
Tips:<br>
|
||||
@ -123,8 +128,8 @@
|
||||
|
||||
<h2>Links</h2>
|
||||
<ul>
|
||||
<li>Complete fhem package for the fritzbox: <a href="fb_fhem_0.2.tar.gz">
|
||||
fb_fhem_0.2.tar.gz</a></li>
|
||||
<li>Complete fhem package for the fritzbox: <a href="fb_fhem_0.3.tar.gz">
|
||||
fb_fhem_0.3.tar.gz</a></li>
|
||||
<li>Telnet on the fritzbox:
|
||||
<a href="http://www.ip-phone-forum.de/showthread.php?t=69245">
|
||||
ip-phone-thread</a></li>
|
||||
|
65
fhem/fhem.pl
65
fhem/fhem.pl
@ -45,26 +45,27 @@ sub AssignIoPort($);
|
||||
sub CallFn(@);
|
||||
sub CommandChain($$);
|
||||
sub DoClose($);
|
||||
sub FmtDateTime($);
|
||||
sub FmtTime($);
|
||||
sub GetLogLevel(@);
|
||||
sub HandleTimeout();
|
||||
sub GlobalAttr($$);
|
||||
sub HandleArchiving($);
|
||||
sub HandleTimeout();
|
||||
sub IOWrite($@);
|
||||
sub InternalTimer($$$$);
|
||||
sub Log($$);
|
||||
sub OpenLogfile($);
|
||||
sub PrintHash($$);
|
||||
sub ResolveDateWildcards($@);
|
||||
sub SemicolonEscape($);
|
||||
sub SignalHandling();
|
||||
sub TimeNow();
|
||||
sub FmtDateTime($);
|
||||
sub FmtTime($);
|
||||
sub WriteStatefile();
|
||||
sub XmlEscape($);
|
||||
sub devspec2array($);
|
||||
sub doGlobalDef($);
|
||||
sub fhem($);
|
||||
sub fhz($);
|
||||
sub doGlobalDef($);
|
||||
sub PrintHash($$);
|
||||
sub devspec2array($);
|
||||
|
||||
sub CommandAttr($$);
|
||||
sub CommandDefaultAttr($$);
|
||||
@ -138,7 +139,7 @@ my %intAt; # Internal at timer hash.
|
||||
my $intAtCnt=0;
|
||||
my $reread_active = 0;
|
||||
my $AttrList = "room comment";
|
||||
my $cvsid = '$Id: fhem.pl,v 1.41 2008-04-28 17:27:14 rudolfkoenig Exp $';
|
||||
my $cvsid = '$Id: fhem.pl,v 1.42 2008-05-09 13:58:10 rudolfkoenig Exp $';
|
||||
|
||||
$init_done = 0;
|
||||
|
||||
@ -441,13 +442,22 @@ AnalyzeInput($)
|
||||
my ($cmd, $rest) = split("\n", $client{$c}{buffer}, 2);
|
||||
$client{$c}{buffer} = $rest;
|
||||
if($cmd) {
|
||||
AnalyzeCommandChain($c, $cmd);
|
||||
return if(!defined($client{$c})); # quit
|
||||
if($cmd =~ m/\\$/) { # Multi-line
|
||||
$client{$c}{prevlines} .= $cmd . "\n";
|
||||
} else {
|
||||
if($client{$c}{prevlines}) {
|
||||
$cmd = $client{$c}{prevlines} . $cmd;
|
||||
undef($client{$c}{prevlines});
|
||||
}
|
||||
AnalyzeCommandChain($c, $cmd);
|
||||
return if(!defined($client{$c})); # quit
|
||||
}
|
||||
} else {
|
||||
$client{$c}{prompt} = 1;
|
||||
$client{$c}{prompt} = 1; # Empty return
|
||||
}
|
||||
syswrite($client{$c}{fd}, "FHZ> ")
|
||||
if($client{$c}{prompt} && $rest !~ m/\n/);
|
||||
|
||||
syswrite($client{$c}{fd}, $client{$c}{prevlines} ? "> " : "FHZ> ")
|
||||
if($client{$c}{prompt} && !$rest);
|
||||
}
|
||||
}
|
||||
|
||||
@ -457,7 +467,7 @@ sub
|
||||
AnalyzeCommandChain($$)
|
||||
{
|
||||
my ($c, $cmd) = @_;
|
||||
$cmd =~ s/#.*$//;
|
||||
$cmd =~ s/#.*$//s;
|
||||
$cmd =~ s/;;/____/g;
|
||||
foreach my $subcmd (split(";", $cmd)) {
|
||||
$subcmd =~ s/____/;/g;
|
||||
@ -478,8 +488,9 @@ AnalyzeCommand($$)
|
||||
Log 5, "Cmd: >$cmd<";
|
||||
return if(!$cmd);
|
||||
|
||||
if($cmd =~ m/^{.*}$/) { # Perl code
|
||||
if($cmd =~ m/^{.*}$/s) { # Perl code
|
||||
|
||||
$cmd =~ s/\\\n/ /g; # Multi-line
|
||||
# Make life easier for oneliners:
|
||||
%value = ();
|
||||
foreach my $d (keys %defs) { $value{$d} = $defs{$d}{STATE } }
|
||||
@ -502,7 +513,7 @@ AnalyzeCommand($$)
|
||||
|
||||
}
|
||||
|
||||
if($cmd =~ m/^"(.*)"$/) { # Shell code, always in bg
|
||||
if($cmd =~ m/^"(.*)"$/s) { # Shell code, always in bg
|
||||
system("$1 &");
|
||||
return;
|
||||
}
|
||||
@ -526,7 +537,7 @@ AnalyzeCommand($$)
|
||||
}
|
||||
|
||||
if(!defined($cmds{$fn})) {
|
||||
my $msg = "Unknown command $fn, try help";
|
||||
my $msg = "Unknown command $fn, try help";
|
||||
if($cl) {
|
||||
syswrite($client{$cl}{fd}, "$msg\n");
|
||||
} else {
|
||||
@ -616,7 +627,7 @@ CommandInclude($$)
|
||||
while(my $l = <$fh>) {
|
||||
chomp($l);
|
||||
if($l =~ m/^(.*)\\$/) { # Multiline commands
|
||||
$bigcmd .= $1;
|
||||
$bigcmd .= "$1\\\n";
|
||||
} else {
|
||||
AnalyzeCommandChain($cl, $bigcmd . $l);
|
||||
$bigcmd = "";
|
||||
@ -996,10 +1007,11 @@ CommandModify($$)
|
||||
return "Define $a[0] first" if(!defined($defs{$a[0]}));
|
||||
my $hash = $defs{$a[0]};
|
||||
|
||||
my $odef = $hash->{DEF};
|
||||
$hash->{OLDDEF} = $hash->{DEF};
|
||||
$hash->{DEF} = $a[1];
|
||||
my $ret = CallFn($a[0], "DefFn", $hash, "$a[0] $hash->{TYPE} $a[1]");
|
||||
$hash->{DEF} = $odef if($ret);
|
||||
$hash->{DEF} = $hash->{OLDDEF} if($ret);
|
||||
delete($hash->{OLDDEF});
|
||||
return $ret;
|
||||
}
|
||||
|
||||
@ -1162,6 +1174,7 @@ XmlEscape($)
|
||||
{
|
||||
my $a = shift;
|
||||
return "" if(!$a);
|
||||
$a =~ s/\\\n/<br>/g; # Multi-line
|
||||
$a =~ s/&/&/g;
|
||||
$a =~ s/"/"/g;
|
||||
$a =~ s/</</g;
|
||||
@ -1247,22 +1260,21 @@ CommandReload($$)
|
||||
Log 5, "Loading $file";
|
||||
|
||||
my $ret;
|
||||
no strict "refs";
|
||||
|
||||
no strict "refs";
|
||||
# Get the correct module case from the initialize function name. We need
|
||||
# this as sometimes we live on a FAT fs with wrong case
|
||||
eval {
|
||||
do "$file";
|
||||
|
||||
# Get the correct module case from the initialize function name. We need
|
||||
# this as sometimes we live on a FAT fs with wrong case
|
||||
foreach my $i (keys %main::) {
|
||||
if($i =~ m/^(${m})_initialize$/i) {
|
||||
$m = $1;
|
||||
last;
|
||||
}
|
||||
}
|
||||
|
||||
$ret = &{ "${m}_Initialize" }(\%hash);
|
||||
};
|
||||
|
||||
if($@) {
|
||||
return "$@";
|
||||
}
|
||||
@ -1418,7 +1430,7 @@ CommandAttr($$)
|
||||
next;
|
||||
}
|
||||
if(" $list " !~ m/ ${a[1]}[ :;]/) {
|
||||
push @rets, "Unknown attribute $a[1], use attr global userattr ($list)";
|
||||
push @rets, "Unknown attribute $a[1], use attr global userattr $a[1]";
|
||||
next;
|
||||
}
|
||||
|
||||
@ -1725,10 +1737,9 @@ sub
|
||||
SemicolonEscape($)
|
||||
{
|
||||
my $cmd = shift;
|
||||
|
||||
$cmd =~ s/^[ \t]*//;
|
||||
$cmd =~ s/[ \t]*$//;
|
||||
if($cmd =~ m/^{.*}$/ || $cmd =~ m/^".*"$/) {
|
||||
if($cmd =~ m/^{.*}$/s || $cmd =~ m/^".*"$/s) {
|
||||
$cmd =~ s/;/;;/g
|
||||
}
|
||||
return $cmd;
|
||||
|
@ -6,46 +6,16 @@ use warnings;
|
||||
|
||||
use IO::Socket;
|
||||
|
||||
###################
|
||||
# Config
|
||||
my $FHEMWEB_absicondir = "/home/httpd/icons"; # Copy your icons here
|
||||
my $FHEMWEB_relicondir = "/icons";
|
||||
my $FHEMWEB_gnuplot = "/usr/bin/gnuplot"; # Set it to empty to disable
|
||||
my $FHEMWEB_gnuplotdir = "/home/httpd/cgi-bin"; # the .gplot filees live here
|
||||
my $FHEMWEB_absdoc = "/home/httpd/html/commandref.html";
|
||||
my $FHEMWEB_reldoc = "/commandref.html";
|
||||
my $FHEMWEB_tmpfile = "/tmp/file.$$";
|
||||
my $__ME = "/fhem";
|
||||
|
||||
###################
|
||||
# CSS
|
||||
my $FHEMWEB_css1 = "border: solid; border-width: thin; width: 100%; -moz-border-radius:8px; ";
|
||||
my $FHEMWEB_css="
|
||||
body { color: black; background: #FFFFD7; }
|
||||
table.room { $FHEMWEB_css1; background: #D7FFFF; }
|
||||
table.room tr.sel { background: #A0FFFF; }
|
||||
table.FS20 { $FHEMWEB_css1; background: #C0FFFF; }
|
||||
table.FS20 tr.odd { background: #D7FFFF; }
|
||||
table.FHT { $FHEMWEB_css1; background: #FFC0C0; }
|
||||
table.FHT tr.odd { background: #FFD7D7; }
|
||||
table.KS300 { $FHEMWEB_css1; background: #C0FFC0; }
|
||||
table.KS300 tr.odd { background: #A7FFA7; }
|
||||
table.FileLog { $FHEMWEB_css1; background: #FFC0C0; }
|
||||
table.FileLog tr.odd { background: #FFD7D7; }
|
||||
table.at { $FHEMWEB_css1; background: #FFFFC0; }
|
||||
table.at tr.odd { background: #FFFFD7; }
|
||||
table.notify { $FHEMWEB_css1; background: #D7D7A0; }
|
||||
table.notify tr.odd { background: #FFFFC0; }
|
||||
table.FHZ { $FHEMWEB_css1; background: #C0C0C0; }
|
||||
table.FHZ tr.odd { background: #D7D7D7; }
|
||||
table.EM { $FHEMWEB_css1; background: #E0E0E0; }
|
||||
table.EM tr.odd { background: #F0F0F0; }
|
||||
table._internal_ { $FHEMWEB_css1; background: #C0C0C0; }
|
||||
table._internal_ tr.odd { background: #D7D7D7; }
|
||||
#hdr { position:absolute; top:10px; left:10px; }
|
||||
#left { position:absolute; top:50px; left:10px; width:130px; }
|
||||
#right { position:absolute; top:50px; left:160px; bottom:10px; overflow:auto;}
|
||||
";
|
||||
# Config
|
||||
my $__ME;
|
||||
my $FHEMWEBdir;
|
||||
my $FHEMWEB_tmpfile = "/tmp/file.$$";
|
||||
my $FHEMWEB_reldoc;
|
||||
|
||||
use vars qw(%defs);
|
||||
use vars qw(%attr);
|
||||
|
||||
# Nothing to config below
|
||||
#########################
|
||||
@ -84,7 +54,7 @@ my $__title;
|
||||
my $__cmdret;
|
||||
my $__RET;
|
||||
my $__RETTYPE;
|
||||
my $__SF = "<form method=\"get\" action=\"$__ME\">";
|
||||
my $__SF;
|
||||
my $__ti; # Tabindex for all input fields
|
||||
|
||||
|
||||
@ -98,7 +68,7 @@ FHEMWEB_Initialize($)
|
||||
|
||||
$hash->{DefFn} = "FHEMWEB_Define";
|
||||
$hash->{UndefFn} = "FHEMWEB_Undef";
|
||||
$hash->{AttrList}= "loglevel:0,1,2,3,4,5,6";
|
||||
$hash->{AttrList}= "loglevel:0,1,2,3,4,5,6 fhemwebdir fhemwebname";
|
||||
}
|
||||
|
||||
#####################################
|
||||
@ -114,14 +84,16 @@ FHEMWEB_Define($$)
|
||||
$hash->{STATE} = "Initialized";
|
||||
$hash->{PORT} = IO::Socket::INET->new(
|
||||
Proto => 'tcp',
|
||||
LocalHost => ($global ? undef : "localhost"),
|
||||
LocalHost => (($global && $global eq "global") ? undef : "localhost"),
|
||||
LocalPort => $port,
|
||||
Listen => 10,
|
||||
ReuseAddr => 1);
|
||||
|
||||
return "Can't open server port at $port: $!" if(!$hash->{PORT});
|
||||
|
||||
$hash->{FD} = $hash->{PORT}->fileno();
|
||||
$hash->{SERVERSOCKET} = "True";
|
||||
Log 2, "FHEMWEB port $port opened";
|
||||
Log(2, "FHEMWEB port $port opened");
|
||||
|
||||
return undef;
|
||||
}
|
||||
@ -149,7 +121,7 @@ FHEMWEB_Read($)
|
||||
|
||||
if(!@clientinfo) {
|
||||
Print("ERROR", 1, "016 Accept failed for admin port");
|
||||
Log 1, "Accept failed for HTTP port ($name: $!)";
|
||||
Log(1, "Accept failed for HTTP port ($name: $!)");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -166,13 +138,19 @@ FHEMWEB_Read($)
|
||||
$nhash{BUF} = "";
|
||||
|
||||
$defs{$nhash{NAME}} = \%nhash;
|
||||
Log $ll, "Connection accepted from $nhash{NAME}";
|
||||
Log($ll, "Connection accepted from $nhash{NAME}");
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
my $name = $hash->{SNAME};
|
||||
my $ll = GetLogLevel($name,4);
|
||||
$FHEMWEBdir = ($attr{$name} && $attr{$name}{fhemwebdir}) ?
|
||||
$attr{$name}{fhemwebdir} : "$attr{global}{modpath}/FHEM";
|
||||
$__ME = "/" . (($attr{$name} && $attr{$name}{fhemwebname}) ?
|
||||
$attr{$name}{fhemwebname} : "fhem");
|
||||
$FHEMWEB_reldoc = "$__ME/commandref.html";
|
||||
$__SF = "<form method=\"get\" action=\"$__ME\">";
|
||||
|
||||
# Data from HTTP Client
|
||||
my $buf;
|
||||
@ -182,27 +160,29 @@ FHEMWEB_Read($)
|
||||
close($hash->{CD});
|
||||
delete($defs{$hash->{NAME}});
|
||||
# Don't delete the attr entry.
|
||||
Log $ll, "Connection closed for $hash->{NAME}";
|
||||
Log($ll, "Connection closed for $hash->{NAME}");
|
||||
return;
|
||||
}
|
||||
|
||||
$hash->{BUF} .= $buf;
|
||||
#Log 1, "Got: >$hash->{BUF}<";
|
||||
#Log(1, "Got: >$hash->{BUF}<");
|
||||
return if($hash->{BUF} !~ m/\n\n$/ && $hash->{BUF} !~ m/\r\n\r\n$/);
|
||||
|
||||
my @lines = split("[\r\n]", $hash->{BUF});
|
||||
my ($mode, $arg, $method) = split(" ", $lines[0]);
|
||||
$hash->{BUF} = "";
|
||||
|
||||
Log $ll, "HTTP $hash->{NAME} GET $arg";
|
||||
Log($ll, "HTTP $hash->{NAME} GET $arg");
|
||||
|
||||
FHEMWEB_AnswerCall($arg);
|
||||
|
||||
my $c = $hash->{CD};
|
||||
my $l = length($__RET);
|
||||
my $exp = localtime(time()+300) . " GMT";
|
||||
|
||||
print $c "HTTP/1.1 200 OK\r\n",
|
||||
"Content-Length: $l\r\n",
|
||||
"Expires: $exp\r\n",
|
||||
"Content-Type: $__RETTYPE\r\n\r\n",
|
||||
$__RET;
|
||||
}
|
||||
@ -225,27 +205,35 @@ FHEMWEB_AnswerCall($)
|
||||
$__ti = 1;
|
||||
|
||||
# Lets go:
|
||||
if($arg !~ m/^$__ME(.*)/) {
|
||||
if($arg =~ m/^$FHEMWEB_reldoc/) {
|
||||
open(FH, $FHEMWEB_absdoc) || return;
|
||||
pO join("", <FH>);
|
||||
close(FH);
|
||||
} elsif($arg =~ m/^$FHEMWEB_relicondir(.*)$/) {
|
||||
$__RETTYPE = "image/gif";
|
||||
open(FH, "$FHEMWEB_absicondir$1") || return;
|
||||
pO join("", <FH>);
|
||||
close(FH);
|
||||
} else {
|
||||
Log 5, "Unknown document $arg requested";
|
||||
}
|
||||
if($arg =~ m/^$FHEMWEB_reldoc/) {
|
||||
open(FH, "$FHEMWEBdir/commandref.html") || return;
|
||||
pO join("", <FH>);
|
||||
close(FH);
|
||||
return;
|
||||
} elsif($arg =~ m,^$__ME/style.css,) {
|
||||
open(FH, "$FHEMWEBdir/style.css") || return;
|
||||
pO join("", <FH>);
|
||||
close(FH);
|
||||
$__RETTYPE = "text/css";
|
||||
return;
|
||||
} elsif($arg =~ m,^$__ME/icons/(.*)$,) {
|
||||
open(FH, "$FHEMWEBdir/$1") || return;
|
||||
pO join("", <FH>);
|
||||
close(FH);
|
||||
$__RETTYPE = "image/gif";
|
||||
return;
|
||||
} elsif($arg !~ m/^$__ME(.*)/) {
|
||||
Log(5, "Unknown document $arg requested");
|
||||
return;
|
||||
}
|
||||
|
||||
my $cmd = FHEMWEB_digestCgi($1);
|
||||
|
||||
$__cmdret = fC($cmd) if($cmd &&
|
||||
$cmd !~ /^showlog/ &&
|
||||
$cmd !~ /^toweblink/ &&
|
||||
$cmd !~ /^showarchive/);
|
||||
$cmd !~ /^showarchive/ &&
|
||||
$cmd !~ /^edit/);
|
||||
FHEMWEB_parseXmlList();
|
||||
return FHEMWEB_showLog($cmd) if($cmd =~ m/^showlog /);
|
||||
|
||||
@ -264,9 +252,9 @@ FHEMWEB_AnswerCall($)
|
||||
}
|
||||
}
|
||||
|
||||
pO "<html><head><title>$__title</title><style type=\"text/css\">";
|
||||
pO "<!--/* <![CDATA[ */\n$FHEMWEB_css\n/* ]]> */-->";
|
||||
pO "</style></head><body name=\"$__title\">\n";
|
||||
pO "<html><head><title>$__title</title>";
|
||||
pO "<link href=\"$__ME/style.css\" rel=\"stylesheet\"/>";
|
||||
pO "</head><body name=\"$__title\">\n";
|
||||
|
||||
if($__cmdret) {
|
||||
$__detail = "";
|
||||
@ -300,8 +288,9 @@ FHEMWEB_digestCgi($)
|
||||
foreach my $pv (split("&", $arg)) {
|
||||
$pv =~ s/\+/ /g;
|
||||
$pv =~ s/%(..)/chr(hex($1))/ge;
|
||||
#Log 1, "P1: $pv";
|
||||
my ($p,$v) = split("=",$pv, 2);
|
||||
$v =~ s/[\r]\n/\\\n/g;
|
||||
#Log(0, "P: $p, V: $v");
|
||||
|
||||
if($p eq "detail") { $__detail = $v; }
|
||||
if($p eq "room") { $__room = $v; }
|
||||
@ -337,6 +326,7 @@ FHEMWEB_parseXmlList()
|
||||
####### INT, ATTR & STATE
|
||||
if($l =~ m,^\t\t\t<(.*) key="(.*)" value="([^"]*)"(.*)/>,) {
|
||||
my ($t, $n, $v, $m) = ($1, $2, $3, $4);
|
||||
$v =~ s/<br>/<br>/g;
|
||||
$__devs{$name}{$t}{$n}{VAL} = $v;
|
||||
if($m) {
|
||||
$m =~ m/measured="(.*)"/;
|
||||
@ -392,8 +382,9 @@ FHEMWEB_makeTable($$$$$$$$)
|
||||
{
|
||||
my($d,$t,$header,$hash,$clist,$ccmd,$makelink,$cmd) = (@_);
|
||||
|
||||
$t = "EM" if($t =~ m/^EM.*$/);
|
||||
return if(!$hash && !$clist);
|
||||
|
||||
$t = "EM" if($t =~ m/^EM.*$/); # EMWZ,EMEM,etc.
|
||||
pO " <table class=\"$t\">\n";
|
||||
|
||||
# Header
|
||||
@ -420,7 +411,13 @@ FHEMWEB_makeTable($$$$$$$$)
|
||||
} else {
|
||||
pO "<td>$v</td>";
|
||||
}
|
||||
pO "<td>$hash->{$v}{VAL}</td>";
|
||||
|
||||
if($v eq "DEF") {
|
||||
FHEMWEB_makeEdit($d, $t, "modify", $hash->{$v}{VAL});
|
||||
} else {
|
||||
pO "<td id=\"show\">$hash->{$v}{VAL}</td>";
|
||||
}
|
||||
|
||||
pO "<td>$hash->{$v}{TIM}</td>" if($hash->{$v}{TIM});
|
||||
pO "<td><a href=\"$__ME?cmd.$d=$cmd $d $v&detail=$d\">$cmd</a></td>"
|
||||
if($cmd);
|
||||
@ -490,6 +487,14 @@ FHEMWEB_doDetail($)
|
||||
pO "<div id=\"right\">\n";
|
||||
pO "<table><tr><td>\n";
|
||||
pO "<a href=\"$__ME?cmd=delete $d\">Delete $d</a>\n";
|
||||
|
||||
my $pgm = "Javascript:" .
|
||||
"s=document.getElementById('edit').style;".
|
||||
"if(s.display=='none') s.display='block'; else s.display='none';".
|
||||
"s=document.getElementById('disp').style;".
|
||||
"if(s.display=='none') s.display='block'; else s.display='none';";
|
||||
pO "<a href=\"#top\" onClick=\"$pgm\">Modify $d</a>";
|
||||
|
||||
pO "</td></tr><tr><td>\n";
|
||||
FHEMWEB_makeTable($d, $t,
|
||||
"<a href=\"$FHEMWEB_reldoc#${t}set\">State</a>,Value,Measured",
|
||||
@ -547,7 +552,7 @@ FHEMWEB_checkDirs()
|
||||
{
|
||||
return if($__iconsread && (time() - $__iconsread) < 5);
|
||||
%__icons = ();
|
||||
if(opendir(DH, $FHEMWEB_absicondir)) {
|
||||
if(opendir(DH, $FHEMWEBdir)) {
|
||||
while(my $l = readdir(DH)) {
|
||||
next if($l =~ m/^\./);
|
||||
my $x = $l;
|
||||
@ -647,7 +652,7 @@ FHEMWEB_showRoom()
|
||||
|
||||
pO "<td><a href=\"$__ME?detail=$d\">$d</a></td>";
|
||||
if($iname) {
|
||||
pO "<td align=\"center\"><img src=\"$FHEMWEB_relicondir/$iname\" ".
|
||||
pO "<td align=\"center\"><img src=\"$__ME/icons/$iname\" ".
|
||||
"alt=\"$v\"/></td>";
|
||||
} else {
|
||||
pO "<td align=\"center\">$v</td>";
|
||||
@ -796,7 +801,7 @@ FHEMWEB_showLog($)
|
||||
my $path = "$1/$file";
|
||||
$path = $__devs{$d}{ATTR}{archivedir}{VAL} . "/$file" if(!-f $path);
|
||||
|
||||
my $gplot_pgm = "$FHEMWEB_gnuplotdir/$type.gplot";
|
||||
my $gplot_pgm = "$FHEMWEBdir/$type.gplot";
|
||||
|
||||
return FHEMWEB_fatal("Cannot read $gplot_pgm") if(!-r $gplot_pgm);
|
||||
return FHEMWEB_fatal("Cannot read $path") if(!-r $path);
|
||||
@ -809,7 +814,7 @@ FHEMWEB_showLog($)
|
||||
$gplot_script =~ s/<IN>/$path/g;
|
||||
$gplot_script =~ s/<TL>/$file/g;
|
||||
|
||||
open(FH, "|$FHEMWEB_gnuplot > /dev/null");# feed it to gnuplot
|
||||
open(FH, "|gnuplot > /dev/null");# feed it to gnuplot
|
||||
print FH $gplot_script;
|
||||
close(FH);
|
||||
|
||||
@ -865,6 +870,30 @@ FHEMWEB_textfield($$)
|
||||
return $s;
|
||||
}
|
||||
|
||||
sub
|
||||
FHEMWEB_makeEdit($$$$)
|
||||
{
|
||||
my ($name, $type, $cmd, $val) = @_;
|
||||
|
||||
pO "<td>";
|
||||
pO "<div id=\"edit\" style=\"display:none\"><form>";
|
||||
my $eval = $val;
|
||||
$eval =~ s/<br>/\n/g;
|
||||
if($type eq "at" || $type eq "notify") {
|
||||
pO "<textarea name=\"val.${cmd}$name\" cols=\"60\" rows=\"10\" ".
|
||||
"tabindex=\"$__ti\">$eval</textarea>";
|
||||
} else {
|
||||
pO "<input type=\"text\" name=\"val.${cmd}$name\" size=\"40\" ".
|
||||
"tabindex=\"$__ti\" value=\"$eval\"/>";
|
||||
}
|
||||
$__ti++;
|
||||
pO "<br>" . FHEMWEB_submit("cmd.${cmd}$name", "$cmd $name");
|
||||
pO "</form></div>";
|
||||
$eval = "<pre>$eval</pre>" if($eval =~ m/\n/);
|
||||
pO "<div id=\"disp\">$eval</div>";
|
||||
pO "</td>";
|
||||
}
|
||||
|
||||
##################
|
||||
sub
|
||||
FHEMWEB_submit($$)
|
||||
@ -891,10 +920,13 @@ pO(@)
|
||||
sub
|
||||
fC($)
|
||||
{
|
||||
my ($cmd) = @_;
|
||||
my $oll = $attr{global}{verbose};
|
||||
$attr{global}{verbose} = 0;
|
||||
my $ret = AnalyzeCommand(undef, shift);
|
||||
$attr{global}{verbose} = $oll;
|
||||
my $ret = AnalyzeCommand(undef, $cmd);
|
||||
if($cmd !~ m/attr.*global.*verbose/) {
|
||||
$attr{global}{verbose} = $oll;
|
||||
}
|
||||
return $ret;
|
||||
}
|
||||
|
||||
|
@ -4,15 +4,19 @@
|
||||
|
||||
|
||||
#=================
|
||||
set terminal png size 800,200 crop
|
||||
set terminal png transparent size 800,200 crop
|
||||
set output '<OUT>.png'
|
||||
set xdata time
|
||||
set timefmt "%Y-%m-%d_%H:%M:%S"
|
||||
set xlabel " "
|
||||
|
||||
set ytics nomirror
|
||||
set title '<TL>'
|
||||
set ylabel "Power (KW)"
|
||||
set y2label "Power (KW)"
|
||||
set grid
|
||||
#set ytics .2
|
||||
set ytics
|
||||
set y2tics
|
||||
set format y "%.1f"
|
||||
set format y2 "%.1f"
|
||||
|
||||
plot "<IN>" using 1:4 title 'Power (KW)' with lines
|
||||
plot "<IN>" using 1:4 notitle with lines
|
||||
|
@ -3,21 +3,24 @@
|
||||
# FileLog definition:
|
||||
# define FileLog fhtlog1 fht1:.*(temp|actuator).* /var/log/fht1-%Y-%U.log
|
||||
#
|
||||
set terminal png size 800,200 crop
|
||||
set terminal png transparent size 800,200 crop
|
||||
set output '<OUT>.png'
|
||||
set xdata time
|
||||
set timefmt "%Y-%m-%d_%H:%M:%S"
|
||||
set xlabel " "
|
||||
set ytics nomirror
|
||||
set y2tics
|
||||
set ytics 1
|
||||
#set ytics
|
||||
set title '<TL>'
|
||||
set grid
|
||||
set grid xtics y2tics
|
||||
|
||||
set y2label "temperature (Celsius)"
|
||||
set ylabel "Actuator (%)"
|
||||
|
||||
set ylabel "Temperature (Celsius)"
|
||||
set y2label "Actuator (%)"
|
||||
plot \
|
||||
"< awk '/measured/{print $1, $4; s=1}' <IN>"\
|
||||
using 1:2 axes x1y1 title 'Measured temperature' with lines,\
|
||||
"< awk '/actuator/ {print $1, $4+0; have=1} /measured/ {s=$1} END { if(!have) print (s, 0)}' <IN>"\
|
||||
using 1:2 axes x1y2 title 'Actuator (%)' with lines
|
||||
"< awk '/measured/{print $1, $4}' <IN>"\
|
||||
using 1:2 axes x1y2 title 'Measured temperature' with lines lw 2,\
|
||||
"< awk '/desired/ {print $1, $4+0}' <IN>"\
|
||||
using 1:2 axes x1y2 title 'Desired temperature' with steps,\
|
||||
"< awk '/actuator/ {print $1, $4+0}' <IN>"\
|
||||
using 1:2 axes x1y1 title 'Actuator (%)' with lines\
|
||||
|
@ -3,14 +3,19 @@
|
||||
# FileLog definition:
|
||||
# define FileLog fs20log fs20dev /var/log/fs20dev-%Y-%U.log
|
||||
#
|
||||
set terminal png size 800,200 crop
|
||||
set terminal png transparent size 800,200 crop
|
||||
set output '<OUT>.png'
|
||||
set xdata time
|
||||
set timefmt "%Y-%m-%d_%H:%M:%S"
|
||||
set xlabel " "
|
||||
set title '<TL>'
|
||||
set noytics
|
||||
|
||||
set ytics ("Off" 0, "On" 1)
|
||||
set y2tics ("Off" 0, "On" 1)
|
||||
set yrange [-0.1:1.1]
|
||||
set y2range [-0.1:1.1]
|
||||
set ylabel "Pumpe"
|
||||
set y2label "Pumpe"
|
||||
|
||||
plot "< awk '{print $1, $3==\"on\"? 1 : 0; }' <IN>"\
|
||||
using 1:2 title 'On/Off' with steps
|
||||
using 1:2 notitle with steps
|
||||
|
@ -3,7 +3,7 @@
|
||||
# FileLog definition:
|
||||
# define FileLog ks300log ks300:.*H:.* /var/log/ks300-%Y-%U.log
|
||||
#
|
||||
set terminal png size 800,200 crop
|
||||
set terminal png transparent size 800,200 crop
|
||||
set output '<OUT>.png'
|
||||
set xdata time
|
||||
set timefmt "%Y-%m-%d_%H:%M:%S"
|
||||
@ -13,8 +13,27 @@ set y2tics
|
||||
set title '<TL>'
|
||||
set grid
|
||||
|
||||
set ylabel "Temperature (Celsius)"
|
||||
set y2label "Rain (l/m2)"
|
||||
plot "<IN>" using 1:4 axes x1y1 title 'Temperature' with lines,\
|
||||
"<grep -v avg_ <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[9]-$lv); } $lh = $a[1]; $ld = $a[0]; $lv = $F[9]; END { printf(\"${ld}_$lh:30:00 %f\n\", $hv) }'" using 1:2 axes x1y2 title 'Rain/h' with histeps,\
|
||||
"<grep -v avg_ <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[9]-$lv); } $ld = $a[0]; $lv = $F[9]; END {printf(\"${ld}_12:00:00 %f\n\", $dv)}'" using 1:2 axes x1y2 title 'Rain/day' with histeps
|
||||
set y2label "Temperature (Celsius)"
|
||||
set format y "%0.1f"
|
||||
set ylabel "Rain (l/m2)"
|
||||
set yrange [0:]
|
||||
|
||||
# Computing Rain/h and Rain/d values by accumulating the changes.
|
||||
|
||||
plot "<IN>" using 1:4 axes x1y2 title 'Temperature' with lines lw 2,\
|
||||
"<grep -v avg_ <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[9]-$lv); }\
|
||||
$lh = $a[1]; $ld = $a[0]; $lv = $F[9];\
|
||||
END { printf(\"${ld}_$lh:30:00 %f\n\", $hv) }'"\
|
||||
using 1:2 axes x1y1 title 'Rain/h' with histeps,\
|
||||
"<grep -v avg_ <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[9]-$lv); }\
|
||||
$ld = $a[0]; $lv = $F[9];\
|
||||
END {printf(\"${ld}_12:00:00 %f\n\", $dv)}'"\
|
||||
using 1:2 axes x1y1 title 'Rain/day' with histeps
|
||||
|
@ -3,7 +3,7 @@
|
||||
# FileLog definition:
|
||||
# define FileLog ks300log ks300:.*H:.* /var/log/ks300-%Y-%U.log
|
||||
#
|
||||
set terminal png size 800,200 crop
|
||||
set terminal png transparent size 800,200 crop
|
||||
set output '<OUT>.png'
|
||||
set xdata time
|
||||
set timefmt "%Y-%m-%d_%H:%M:%S"
|
||||
|
@ -3,7 +3,7 @@
|
||||
# FileLog definition:
|
||||
# define FileLog ks300log ks300:.*H:.* /var/log/ks300-%Y-%U.log
|
||||
#
|
||||
set terminal png size 800,200 crop
|
||||
set terminal png transparent size 800,200 crop
|
||||
set output '<OUT>.png'
|
||||
set xdata time
|
||||
set timefmt "%Y-%m-%d_%H:%M:%S"
|
||||
|
@ -3,18 +3,21 @@
|
||||
# define pirilog FileLog /var/log/piri-%Y-%m-%d.log piri.*
|
||||
# The devices are called piri.sz, piri.flo, piri.flu, prir.wz1 and piri.wz2
|
||||
#
|
||||
set terminal png size 800,200 crop
|
||||
set terminal png transparent size 800,200 crop
|
||||
set output '<OUT>.png'
|
||||
set xdata time
|
||||
set timefmt "%Y-%m-%d_%H:%M:%S"
|
||||
set xlabel " "
|
||||
set ylabel "Piri"
|
||||
set y2label "Piri"
|
||||
set title '<TL>'
|
||||
set noytics
|
||||
set yrange [-0.1:1.1]
|
||||
set ytics ("Sz" 0.8, "FlO" 0.6, "FlU" 0.4, "Wz1" 0.2, "Wz2" 0.0)
|
||||
set y2tics ("Sz" 0.8, "FlO" 0.6, "FlU" 0.4, "Wz1" 0.2, "Wz2" 0.0)
|
||||
set yrange [-0.1:0.9]
|
||||
|
||||
plot\
|
||||
"< awk '/sz/ {print $1, 0.8; }' <IN>" using 1:2 title 'sz' with points,\
|
||||
"< awk '/flo/{print $1, 0.6; }' <IN>" using 1:2 title 'flo' with points,\
|
||||
"< awk '/flu/{print $1, 0.4; }' <IN>" using 1:2 title 'flu' with points,\
|
||||
"< awk '/wz1/{print $1, 0.2; }' <IN>" using 1:2 title 'wz1' with points,\
|
||||
"< awk '/wz2/{print $1, 0.0; }' <IN>" using 1:2 title 'wz2' with points
|
||||
"< awk '/sz/ {print $1, 0.8; }' <IN>" using 1:2 notitle with points,\
|
||||
"< awk '/flo/{print $1, 0.6; }' <IN>" using 1:2 notitle with points,\
|
||||
"< awk '/flu/{print $1, 0.4; }' <IN>" using 1:2 notitle with points,\
|
||||
"< awk '/wz1/{print $1, 0.2; }' <IN>" using 1:2 notitle with points,\
|
||||
"< awk '/wz2/{print $1, 0.0; }' <IN>" using 1:2 notitle with points
|
||||
|
@ -3,7 +3,7 @@
|
||||
# FileLog definition:
|
||||
# define FileLog fs20log fs20dev /var/log/fs20dev-%Y-%U.log
|
||||
#
|
||||
set terminal png size 800,200 crop
|
||||
set terminal png transparent size 800,200 crop
|
||||
set output '<OUT>.png'
|
||||
set xdata time
|
||||
set timefmt "%Y-%m-%d_%H:%M:%S"
|
||||
|
Loading…
Reference in New Issue
Block a user