diff --git a/docs/commandref.html b/docs/commandref.html index f4dbdf5ce..b4494f30f 100644 --- a/docs/commandref.html +++ b/docs/commandref.html @@ -5328,7 +5328,8 @@ isday +
+
  • multiprocess
    + This defines if the Renderer works in a multiprocessing mode.
    + You can set multiprocessing either to ON / OFF and the renderer will draw the + time-scheduled tasks either in multiprocessing mode, or not. + NOTE: Direct GET calls, except for a general GET (for all weblinks) will be renderer + in an interactive mode, meaning that the FHEM-Loop will be block as long as the graphics are rendered. + If you want to use multiprocessing, set the RENDERER and multiprocessing to ON and the + weblink-graphics will be rendered in the background. +

  • diff --git a/webfrontend/pgm5/02_FHEMRENDERER.pm b/webfrontend/pgm5/02_FHEMRENDERER.pm index fbaee2063..a2a0595c7 100644 --- a/webfrontend/pgm5/02_FHEMRENDERER.pm +++ b/webfrontend/pgm5/02_FHEMRENDERER.pm @@ -84,6 +84,7 @@ my $__data; # Filecontent from browser when editing a file my $__svgloaded; # Do not load the SVG twice my $__lastxmllist; # last time xmllist was parsed my $FHEMRENDERER_tmpfile; # TempDir & File for the rendered graphics +my $__mp; ##################################### sub @@ -94,7 +95,7 @@ FHEMRENDERER_Initialize($) # $hash->{ReadFn} = "FHEMRENDERER_Read"; $hash->{DefFn} = "FHEMRENDERER_Define"; $hash->{UndefFn} = "FHEMRENDERER_Undef"; - $hash->{AttrList}= "loglevel:0,1,2,3,4,5,6 plotmode:gnuplot,gnuplot-scroll plotsize refresh tmpfile status"; + $hash->{AttrList}= "loglevel:0,1,2,3,4,5,6 plotmode:gnuplot,gnuplot-scroll plotsize refresh tmpfile status multiprocess"; $hash->{SetFn} = "FHEMRENDERER_Set"; $hash->{GetFn} = "FHEMRENDERER_Get"; } @@ -121,6 +122,7 @@ FHEMRENDERER_Define($$) $__timeinterval = FHEMRENDERER_getAttr("refresh", "00:10:00"); $__plotmode = FHEMRENDERER_getAttr("plotmode", "gnuplot"); $__plotsize = FHEMRENDERER_getAttr("plotsize", "800,200"); + $__mp = FHEMRENDERER_getAttr("multiprocess", "off"); $FHEMRENDERER_tmpfile = FHEMRENDERER_getAttr("tmpfile", "/tmp/"); FHEMRENDERER_setAttr("status", "off"); @@ -174,6 +176,7 @@ FHEMRENDERER_Get($@) my $ret = undef; my $v; my $t; + my $pid; FHEMRENDERER_parseXmlList(0); @@ -183,8 +186,9 @@ FHEMRENDERER_Get($@) $__plotmode = FHEMRENDERER_getAttr("plotmode", "gnuplot"); $__plotsize = FHEMRENDERER_getAttr("plotsize", "800,200"); $FHEMRENDERER_tmpfile = FHEMRENDERER_getAttr("tmpfile", "/tmp/"); - - if (@a <= 2) { + $__mp = FHEMRENDERER_getAttr("multiprocess", "off"); + + if (@a <= 2) { if (@a == 2) { my ($p,$v) = split("=",$a[1], 2); @@ -197,6 +201,16 @@ FHEMRENDERER_Get($@) } } + if ($__mp ne "off") { + $pid = fork(); + if (not defined $pid) { + return ("ERROR: No MultiProcessing possible"); + } + if ($pid > 0) { + return $ret; + } + } + foreach my $type (sort keys %__types) { if($type eq "weblink") { foreach my $d (sort keys %__devs ) { @@ -255,7 +269,11 @@ FHEMRENDERER_Get($@) } else { return "\"get FHEMRENDERER\" needs either none, 1(pos) or 3-5 arguments ([file-name] device type logfile [pos=zoom=XX&off=YYY])"; } - return $ret; + if (not defined $pid) { + return $ret; + } else { + exit(0); + } } ##################### diff --git a/webfrontend/pgm5/README-FHEMRENDERER.txt b/webfrontend/pgm5/README-FHEMRENDERER.txt index 6ce0002e4..55756e624 100644 --- a/webfrontend/pgm5/README-FHEMRENDERER.txt +++ b/webfrontend/pgm5/README-FHEMRENDERER.txt @@ -47,12 +47,15 @@ The FHEMRENDERER uses attributes to control the behaviour: room Unsorted status off tmpfile /tmp/ + multiprocess off These attributes have the following meaning: plotmode, plotsize: Control gnuplot and the desired output refresh: type HH:MM:SS, is the time-interval in which the re-rendering is done status: Tells if the timer-based re-rendering is on/off tmpfile: Is the path (and prefix, if given) of the graphic-files, that will be rendered +multiprocess: You can set "on" or "off". If multiprocess is "on" the time-scheduled renderings will be done in a + mutli-process manner, and FHEM will not be blocked by the rendering process. NOTE: The timer-based rendering renders ONLY those fileplots, for which you have defined a WebLink ! See WebLink for more details on how to define. @@ -88,6 +91,7 @@ DEFINE room Unsorted status off tmpfile /tmp/ + multiprocess off NOTE: The Logfile will report (with LogLevel 2) that the FHEMRENDERER has been defined. @@ -169,6 +173,7 @@ ATTR refresh Timer-Interval for rerendering (HH:MM:SS) status Status of the Timer (off/on) tmpfile Path and prefix of for the rendered graphics (e.g. /tmp/) + multiprocess on / off