diff --git a/fhem/FHEM/01_FHEMWEB.pm b/fhem/FHEM/01_FHEMWEB.pm index 5b52c101b..a0fa4cf8b 100755 --- a/fhem/FHEM/01_FHEMWEB.pm +++ b/fhem/FHEM/01_FHEMWEB.pm @@ -1320,17 +1320,31 @@ FW_readgplotfile($$$) open(FH, $gplot_pgm) || return (FW_fatal("$gplot_pgm: $!"), undef); while(my $l = ) { $l =~ s/\r//g; + my $plotfn = undef; if($l =~ m/^#FileLog (.*)$/ && ($wltype eq "fileplot" || $wl eq "FileLog")) { - push(@filelog, $1); + $plotfn = $1; } elsif ($l =~ m/^#DbLog (.*)$/ && ($wltype eq "dbplot" || $wl eq "DbLog")) { - push(@filelog, $1); + $plotfn = $1; } elsif($l =~ "^plot" || $plot) { $plot .= $l; } else { 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//$_/g; + $spec_count++; + } + } + push(@filelog, $plotfn); + } } close(FH); diff --git a/fhem/FHEM/98_weblink.pm b/fhem/FHEM/98_weblink.pm index e9ed0e0c4..e82c9c84e 100755 --- a/fhem/FHEM/98_weblink.pm +++ b/fhem/FHEM/98_weblink.pm @@ -12,7 +12,7 @@ weblink_Initialize($) my ($hash) = @_; $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($$) Define
@@ -133,7 +134,28 @@ weblink_Define($$)
  • title
    A special form of label (see above), which replaces the string <TL> in the .gplot file. It defaults to the filename of the logfile. -
  • + + + +
  • plotfunction
    + 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. +
      Example:
      +
    • #FileLog
      + with: attr plotfunction "4:IR\x3a:0:"
      + instead of
      + #FileLog 4:IR\x3a:0: +
    • +
    • #DbLog
      + with: attr plotfunction "Garage_Raumtemp:temperature::"
      + instead of
      + #DbLog Garage_Raumtemp:temperature:: +
    • +
    +