SVG: endPlotNow from ChrisD

git-svn-id: https://svn.fhem.de/fhem/trunk/fhem@4067 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
rudolfkoenig 2013-10-19 07:27:51 +00:00
parent 24382d14ab
commit 5e81786d4a
3 changed files with 71 additions and 30 deletions

View File

@ -1,6 +1,7 @@
# Add changes at the top of the list. Keep it in ASCII, and 80-char wide. # Add changes at the top of the list. Keep it in ASCII, and 80-char wide.
- 2013-xx-xx (SVN) - 2013-xx-xx (SVN)
- feature: endPlotNow attribute for SVG-Plots (ChrisD)
- feature: new module 51_BBB_BMP180.pm added (betateilchen) - feature: new module 51_BBB_BMP180.pm added (betateilchen)
- feature: readingsGroup: allow devStateIcon to be displayed - feature: readingsGroup: allow devStateIcon to be displayed
- feature: readingsGroup: allow multiple device readings in one line - feature: readingsGroup: allow multiple device readings in one line

View File

@ -114,7 +114,7 @@ FHEMWEB_Initialize($)
$hash->{ActivateInformFn} = "FW_ActivateInform"; $hash->{ActivateInformFn} = "FW_ActivateInform";
$hash->{AttrList}= $hash->{AttrList}=
"webname fwcompress:0,1 ". "webname fwcompress:0,1 ".
"plotmode:gnuplot,gnuplot-scroll,SVG plotsize endPlotToday:1,0 plotfork ". "plotmode:gnuplot,gnuplot-scroll,SVG plotsize endPlotToday:1,0 endPlotNow:1,0 plotfork ".
"stylesheetPrefix touchpad:deprecated smallscreen:deprecated ". "stylesheetPrefix touchpad:deprecated smallscreen:deprecated ".
"basicAuth basicAuthMsg hiddenroom hiddengroup HTTPS allowfrom CORS:0,1 ". "basicAuth basicAuthMsg hiddenroom hiddengroup HTTPS allowfrom CORS:0,1 ".
"refresh longpoll:0,1 longpollSVG:1,0 redirectCmds:0,1 reverseLogs:0,1 ". "refresh longpoll:0,1 longpollSVG:1,0 redirectCmds:0,1 reverseLogs:0,1 ".
@ -1973,7 +1973,12 @@ FW_FlushInform($)
my $hash = $defs{$name}; my $hash = $defs{$name};
return if(!$hash); return if(!$hash);
my $c = $hash->{CD}; my $c = $hash->{CD};
print $c $hash->{INFORMBUF}; #print $c $hash->{INFORMBUF};
if(defined($hash->{".WRITEBUFFER"})) {
$hash->{".WRITEBUFFER"} .= $hash->{INFORMBUF};
} else {
$hash->{".WRITEBUFFER"} = $hash->{INFORMBUF};
}
$hash->{INFORMBUF}=""; $hash->{INFORMBUF}="";
} }
@ -2392,11 +2397,19 @@ FW_ActivateInform()
<a name="endPlotToday"></a> <a name="endPlotToday"></a>
<li>endPlotToday<br> <li>endPlotToday<br>
If this FHEMWEB attribute ist set to 1, then week and month plots will If this FHEMWEB attribute is set to 1, then week and month plots will
end today. Else the current week (starting at Sunday) or the current end today. Else the current week (starting at Sunday) or the current
month will be shown.<br> month will be shown.<br>
</li><br> </li><br>
<a name="endPlotNow"></a>
<li>endPlotNow<br>
If this FHEMWEB attribute is set to 1, then day and hour plots will
end at current time. Else the whole day, the 6 hour period starting at
0, 6, 12 or 18 hour or the whole hour will be shown. This attribute
is not used if the SVG has the attribute startDate defined.<br>
</li><br>
<a name="plotfork"></a> <a name="plotfork"></a>
<li>plotfork<br> <li>plotfork<br>
If set, generate the logs in a parallel process. Note: do not use it If set, generate the logs in a parallel process. Note: do not use it

View File

@ -589,34 +589,61 @@ SVG_calcOffsets($$)
if($zoom eq "hour") { if($zoom eq "hour") {
my $t = $now + $off*3600; if(AttrVal($FW_wname, "endPlotNow", undef) && !$st) {
my @l = localtime($t); my $t = int(($now + $off*3600 - 3600)/300.0)*300 + 300;
$SVG_devs{$d}{from} my @l = localtime($t);
= sprintf("%04d-%02d-%02d_%02d:00:00",$l[5]+1900,$l[4]+1,$l[3],$l[2]); $SVG_devs{$d}{from} =
@l = localtime($t+3600); sprintf("%04d-%02d-%02d_%02d:%02d:00",$l[5]+1900,$l[4]+1,$l[3],$l[2],$l[1]);
$SVG_devs{$d}{to} @l = localtime($t+3600);
= sprintf("%04d-%02d-%02d_%02d:00:01",$l[5]+1900,$l[4]+1,$l[3],$l[2]); $SVG_devs{$d}{to} =
sprintf("%04d-%02d-%02d_%02d:%02d:01",$l[5]+1900,$l[4]+1,$l[3],$l[2],$l[1]);
} else {
my $t = $now + $off*3600;
my @l = localtime($t);
$SVG_devs{$d}{from}
= sprintf("%04d-%02d-%02d_%02d:00:00",$l[5]+1900,$l[4]+1,$l[3],$l[2]);
@l = localtime($t+3600);
$SVG_devs{$d}{to}
= sprintf("%04d-%02d-%02d_%02d:00:01",$l[5]+1900,$l[4]+1,$l[3],$l[2]);
}
} elsif($zoom eq "qday") { } elsif($zoom eq "qday") {
my $t = $now + $off*21600; if(AttrVal($FW_wname, "endPlotNow", undef) && !$st) {
my @l = localtime($t); my $t = int(($now + $off*21600 - 21600)/300.0)*300 + 300;
$l[2] = int($l[2]/6)*6; my @l = localtime($t);
$SVG_devs{$d}{from} = $SVG_devs{$d}{from} =
sprintf("%04d-%02d-%02d_%02d:00:00",$l[5]+1900,$l[4]+1,$l[3],$l[2]); sprintf("%04d-%02d-%02d_%02d:%02d:00",$l[5]+1900,$l[4]+1,$l[3],$l[2],$l[1]);
@l = localtime($t+21600); @l = localtime($t+21600);
$l[2] = int($l[2]/6)*6; $SVG_devs{$d}{to} =
$SVG_devs{$d}{to} = sprintf("%04d-%02d-%02d_%02d:%02d:01",$l[5]+1900,$l[4]+1,$l[3],$l[2],$l[1]);
sprintf("%04d-%02d-%02d_%02d:00:01",$l[5]+1900,$l[4]+1,$l[3],$l[2]); } else {
my $t = $now + $off*21600;
my @l = localtime($t);
$l[2] = int($l[2]/6)*6;
$SVG_devs{$d}{from} =
sprintf("%04d-%02d-%02d_%02d:00:00",$l[5]+1900,$l[4]+1,$l[3],$l[2]);
@l = localtime($t+21600);
$l[2] = int($l[2]/6)*6;
$SVG_devs{$d}{to} =
sprintf("%04d-%02d-%02d_%02d:00:01",$l[5]+1900,$l[4]+1,$l[3],$l[2]);
}
} elsif($zoom eq "day") { } elsif($zoom eq "day") {
my $t = $now + $off*86400; if(AttrVal($FW_wname, "endPlotNow", undef) && !$st) {
my @l = localtime($t); my $t = int(($now + $off*86400 - 86400)/900.0)*900 + 900;
$SVG_devs{$d}{from} = my @l = localtime($t);
sprintf("%04d-%02d-%02d_00:00:00",$l[5]+1900,$l[4]+1,$l[3]); $SVG_devs{$d}{from} =
@l = localtime($t+86400); sprintf("%04d-%02d-%02d_%02d:%02d:00",$l[5]+1900,$l[4]+1,$l[3],$l[2],$l[1]);
$SVG_devs{$d}{to} = @l = localtime($t+86400);
sprintf("%04d-%02d-%02d_00:00:01",$l[5]+1900,$l[4]+1,$l[3]); $SVG_devs{$d}{to} =
sprintf("%04d-%02d-%02d_%02d:%02d:01",$l[5]+1900,$l[4]+1,$l[3],$l[2],$l[1]);
} else {
my $t = $now + $off*86400;
my @l = localtime($t);
$SVG_devs{$d}{from} =
sprintf("%04d-%02d-%02d_00:00:00",$l[5]+1900,$l[4]+1,$l[3]);
@l = localtime($t+86400);
$SVG_devs{$d}{to} =
sprintf("%04d-%02d-%02d_00:00:01",$l[5]+1900,$l[4]+1,$l[3]);
}
} elsif($zoom eq "week") { } elsif($zoom eq "week") {
my @l = localtime($now); my @l = localtime($now);
my $start = (AttrVal($FW_wname, "endPlotToday", undef) ? 6 : $l[6]); my $start = (AttrVal($FW_wname, "endPlotToday", undef) ? 6 : $l[6]);
@ -1513,7 +1540,7 @@ SVG_pO($)
In plotmode gnuplot-scroll or SVG the given time-range will be used, In plotmode gnuplot-scroll or SVG the given time-range will be used,
and no scrolling for this weblinks will be possible. Needed e.g. for and no scrolling for this weblinks will be possible. Needed e.g. for
looking at last-years data without scrolling.<br><br> looking at last-years data without scrolling.<br><br>
If the value is one of day, week, month, year than set the zoom level If the value is one of day, week, month, year then set the zoom level
for this weblink independently of the user specified zoom-level. for this weblink independently of the user specified zoom-level.
This is useful for pages with multiple plots: one of the plots is best This is useful for pages with multiple plots: one of the plots is best
viewed in with the default (day) zoom, the other one with a week zoom. viewed in with the default (day) zoom, the other one with a week zoom.