2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-03-03 16:56:54 +00:00

SVG: endPlotNow from ChrisD

git-svn-id: https://svn.fhem.de/fhem/trunk@4067 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
rudolfkoenig 2013-10-19 07:27:51 +00:00
parent a0adc2eb0c
commit 01eb4db802
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.
- 2013-xx-xx (SVN)
- feature: endPlotNow attribute for SVG-Plots (ChrisD)
- feature: new module 51_BBB_BMP180.pm added (betateilchen)
- feature: readingsGroup: allow devStateIcon to be displayed
- feature: readingsGroup: allow multiple device readings in one line

View File

@ -114,7 +114,7 @@ FHEMWEB_Initialize($)
$hash->{ActivateInformFn} = "FW_ActivateInform";
$hash->{AttrList}=
"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 ".
"basicAuth basicAuthMsg hiddenroom hiddengroup HTTPS allowfrom CORS: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};
return if(!$hash);
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}="";
}
@ -2392,11 +2397,19 @@ FW_ActivateInform()
<a name="endPlotToday"></a>
<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
month will be shown.<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>
<li>plotfork<br>
If set, generate the logs in a parallel process. Note: do not use it

View File

@ -589,6 +589,15 @@ SVG_calcOffsets($$)
if($zoom eq "hour") {
if(AttrVal($FW_wname, "endPlotNow", undef) && !$st) {
my $t = int(($now + $off*3600 - 3600)/300.0)*300 + 300;
my @l = localtime($t);
$SVG_devs{$d}{from} =
sprintf("%04d-%02d-%02d_%02d:%02d:00",$l[5]+1900,$l[4]+1,$l[3],$l[2],$l[1]);
@l = localtime($t+3600);
$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}
@ -596,8 +605,17 @@ SVG_calcOffsets($$)
@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") {
if(AttrVal($FW_wname, "endPlotNow", undef) && !$st) {
my $t = int(($now + $off*21600 - 21600)/300.0)*300 + 300;
my @l = localtime($t);
$SVG_devs{$d}{from} =
sprintf("%04d-%02d-%02d_%02d:%02d:00",$l[5]+1900,$l[4]+1,$l[3],$l[2],$l[1]);
@l = localtime($t+21600);
$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*21600;
my @l = localtime($t);
$l[2] = int($l[2]/6)*6;
@ -607,8 +625,17 @@ SVG_calcOffsets($$)
$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") {
if(AttrVal($FW_wname, "endPlotNow", undef) && !$st) {
my $t = int(($now + $off*86400 - 86400)/900.0)*900 + 900;
my @l = localtime($t);
$SVG_devs{$d}{from} =
sprintf("%04d-%02d-%02d_%02d:%02d:00",$l[5]+1900,$l[4]+1,$l[3],$l[2],$l[1]);
@l = localtime($t+86400);
$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} =
@ -616,7 +643,7 @@ SVG_calcOffsets($$)
@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") {
my @l = localtime($now);
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,
and no scrolling for this weblinks will be possible. Needed e.g. for
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.
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.