diff --git a/fhem/FHEM/98_SVG.pm b/fhem/FHEM/98_SVG.pm index 4e0199c01..3bdb4430c 100755 --- a/fhem/FHEM/98_SVG.pm +++ b/fhem/FHEM/98_SVG.pm @@ -68,6 +68,7 @@ SVG_Initialize($) plotWeekStartDay:0,1,2,3,4,5,6 plotfunction plotsize + plotReplace startDate title ); @@ -755,8 +756,21 @@ SVG_readgplotfile($$$) $srcDesc{all} = ""; $srcDesc{order} = \@empty; + my $specval = AttrVal($wl, "plotfunction", undef); + my $plotReplace = AttrVal($wl, "plotReplace", undef); + my ($list, $pr) = parseParams($plotReplace) if($plotReplace); + if($plotReplace) { + for my $k (keys %$pr) { + if($pr->{$k} =~ m/^{.*}$/) { + $cmdFromAnalyze = $pr->{$k}; + $pr->{$k} = eval $cmdFromAnalyze; + } + } + } + foreach my $l (@svgplotfile) { $l = "$l\n" unless $l =~ m/\n$/; + map { $l =~ s/<$_>/$pr->{$_}/ } keys %$pr if($plotReplace); my ($src, $plotfn) = (undef, undef); if($l =~ m/^#([^ ]*) (.*)$/) { if($1 eq $ldType) { @@ -773,7 +787,6 @@ SVG_readgplotfile($$$) if($plotfn) { Log 3, "$wl: space is not allowed in $ldType definition: $plotfn" if($plotfn =~ m/\s/); - my $specval = AttrVal($wl, "plotfunction", undef); if ($specval) { my @spec = split(" ",$specval); my $spec_count=1; @@ -2460,14 +2473,15 @@ plotAsPng(@) The value minAll and maxAll (representing the minimum/maximum over all values) is also available from the data hash. - - +
Deprecated, see plotReplace. +
  • 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. -
  • +
    Deprecated, see plotReplace. +
  • captionLeft
    @@ -2493,7 +2507,16 @@ plotAsPng(@) #DbLog Garage_Raumtemp:temperature::
  • - + Deprecated, see plotReplace. +
    + + +
  • plotReplace
    + space separated list of key=value pairs. value may contain spaces if + enclosed in "" or {}. value will be evaluated, if it is enclosed in {}. + In the .gplot file <key> is replaced with the corresponding value. + Replaces the title, label and plotfunction attributes. +


  • @@ -2664,6 +2687,7 @@ plotAsPng(@) Die Werte minAll und maxAll (die das Minimum/Maximum aller Werte repräsentieren) sind ebenfals im data hash vorhanden. +
    Überholt, wird durch das plotReplace Attribut abgelöst. @@ -2672,6 +2696,7 @@ plotAsPng(@) Zeichenfolge <TL> in der .gplot-Datei ersetzt wird. Standardmäßig wird als <TL> der Dateiname des Logfiles eingesetzt. +
    Überholt, wird durch das plotReplace Attribut abgelöst.
    @@ -2704,7 +2729,17 @@ plotAsPng(@) #DbLog Garage_Raumtemp:temperature:: - + Überholt, wird durch das plotReplace Attribut abgelöst. +
    + + +
  • plotReplace
    + Leerzeichen getrennte Liste von Name=Wert Paaren. Wert kann Leerzeichen + enthalten, falls es in "" oder {} eingeschlossen ist. Wert wird als + perl-Ausdruck ausgewertet, falls es in {} eingeschlossen ist. In der + .gplot Datei werden alle <Name> Zeichenketten durch den + zugehoerigen Wert ersetzt. +


  • diff --git a/fhem/fhem.pl b/fhem/fhem.pl index e5b58dc89..933e50cfe 100755 --- a/fhem/fhem.pl +++ b/fhem/fhem.pl @@ -2998,7 +2998,7 @@ SignalHandling() $data{WARNING}{$msg}++; chomp($msg); Log 1, "PERL WARNING: $msg"; - Log 3, "eval: $cmdFromAnalyze" if($cmdFromAnalyze && $msg =~ m/\(eval /); + Log 3, "eval: $cmdFromAnalyze" if($cmdFromAnalyze); stacktrace() if($attr{global}{stacktrace} && $msg !~ m/ redefined at /); $inWarnSub = 0; @@ -4856,8 +4856,8 @@ parseParams($;$) $value = $key; $key = undef; - # the key can not start with a { -> it must be a perl expression - } elsif( $key =~ m/^\s*{/ ) { + # the key can not start with a { -> it must be a perl expression # vim:} + } elsif( $key =~ m/^\s*{/ ) { # for vim: } $value = $param; $key = undef; }