plotfunction ptches by Tobias
git-svn-id: https://fhem.svn.sourceforge.net/svnroot/fhem/trunk/fhem@2136 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
@@ -1320,17 +1320,31 @@ FW_readgplotfile($$$)
|
|||||||
open(FH, $gplot_pgm) || return (FW_fatal("$gplot_pgm: $!"), undef);
|
open(FH, $gplot_pgm) || return (FW_fatal("$gplot_pgm: $!"), undef);
|
||||||
while(my $l = <FH>) {
|
while(my $l = <FH>) {
|
||||||
$l =~ s/\r//g;
|
$l =~ s/\r//g;
|
||||||
|
my $plotfn = undef;
|
||||||
if($l =~ m/^#FileLog (.*)$/ &&
|
if($l =~ m/^#FileLog (.*)$/ &&
|
||||||
($wltype eq "fileplot" || $wl eq "FileLog")) {
|
($wltype eq "fileplot" || $wl eq "FileLog")) {
|
||||||
push(@filelog, $1);
|
$plotfn = $1;
|
||||||
} elsif ($l =~ m/^#DbLog (.*)$/ &&
|
} elsif ($l =~ m/^#DbLog (.*)$/ &&
|
||||||
($wltype eq "dbplot" || $wl eq "DbLog")) {
|
($wltype eq "dbplot" || $wl eq "DbLog")) {
|
||||||
push(@filelog, $1);
|
$plotfn = $1;
|
||||||
} elsif($l =~ "^plot" || $plot) {
|
} elsif($l =~ "^plot" || $plot) {
|
||||||
$plot .= $l;
|
$plot .= $l;
|
||||||
} else {
|
} else {
|
||||||
push(@data, $l);
|
push(@data, $l);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if($plotfn) {
|
||||||
|
my $specval = AttrVal($wl, "plotfunction", undef);
|
||||||
|
if ($specval) {
|
||||||
|
my @spec = split(" ",$specval);
|
||||||
|
my $spec_count=1;
|
||||||
|
foreach (@spec) {
|
||||||
|
$plotfn =~ s/<SPEC$spec_count>/$_/g;
|
||||||
|
$spec_count++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
push(@filelog, $plotfn);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
close(FH);
|
close(FH);
|
||||||
|
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ weblink_Initialize($)
|
|||||||
my ($hash) = @_;
|
my ($hash) = @_;
|
||||||
|
|
||||||
$hash->{DefFn} = "weblink_Define";
|
$hash->{DefFn} = "weblink_Define";
|
||||||
$hash->{AttrList}= "fixedrange plotmode plotsize label title htmlattr";
|
$hash->{AttrList}= "fixedrange plotmode plotsize label title htmlattr plotfunction";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -45,7 +45,7 @@ weblink_Define($$)
|
|||||||
<a name="weblinkdefine"></a>
|
<a name="weblinkdefine"></a>
|
||||||
<b>Define</b>
|
<b>Define</b>
|
||||||
<ul>
|
<ul>
|
||||||
<code>define <name> weblink [link|fileplot|image|iframe|htmlCode]
|
<code>define <name> weblink [link|fileplot|dbplot|image|iframe|htmlCode]
|
||||||
<argument></code>
|
<argument></code>
|
||||||
<br><br>
|
<br><br>
|
||||||
This is a placeholder used with webpgm2 to be able to integrate links
|
This is a placeholder used with webpgm2 to be able to integrate links
|
||||||
@@ -60,6 +60,7 @@ weblink_Define($$)
|
|||||||
<code>define hr weblink htmlCode <hr></code><br>
|
<code>define hr weblink htmlCode <hr></code><br>
|
||||||
<code>define w_Frlink weblink htmlCode { WeatherAsHtml("w_Frankfurt") }</code><br>
|
<code>define w_Frlink weblink htmlCode { WeatherAsHtml("w_Frankfurt") }</code><br>
|
||||||
<code>define MyPlot weblink fileplot <logdevice>:<gnuplot-file>:<logfile></code><br>
|
<code>define MyPlot weblink fileplot <logdevice>:<gnuplot-file>:<logfile></code><br>
|
||||||
|
<code>define MyPlot weblink dbplot <logdevice>:<gnuplot-file></code><br>
|
||||||
</ul>
|
</ul>
|
||||||
<br>
|
<br>
|
||||||
|
|
||||||
@@ -135,6 +136,27 @@ weblink_Define($$)
|
|||||||
in the .gplot file. It defaults to the filename of the logfile.
|
in the .gplot file. It defaults to the filename of the logfile.
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
|
<a name="plotfunction"></a>
|
||||||
|
<li>plotfunction<br>
|
||||||
|
Space value separated list of values. The value will be used to replace
|
||||||
|
<SPEC#> type of strings in the .gplot file, with # beginning at 1
|
||||||
|
(<SPEC1>, <SPEC2>, etc.) in the #FileLog or #DbLog directive.
|
||||||
|
With this attribute you can use the same .gplot file for multiple devices
|
||||||
|
with the same logdevice.
|
||||||
|
<ul><b>Example:</b><br>
|
||||||
|
<li>#FileLog <SPEC1><br>
|
||||||
|
with: attr <weblinkdevice> plotfunction "4:IR\x3a:0:"<br>
|
||||||
|
instead of<br>
|
||||||
|
#FileLog 4:IR\x3a:0:
|
||||||
|
</li>
|
||||||
|
<li>#DbLog <SPEC1><br>
|
||||||
|
with: attr <weblinkdevice> plotfunction "Garage_Raumtemp:temperature::"<br>
|
||||||
|
instead of<br>
|
||||||
|
#DbLog Garage_Raumtemp:temperature::
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
|
||||||
</ul>
|
</ul>
|
||||||
<br>
|
<br>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user