mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-01-31 06:39:11 +00:00
Fhemweb.pl fixes
git-svn-id: https://svn.fhem.de/fhem/trunk@34 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
07161ce44b
commit
d5b4420c33
@ -316,5 +316,10 @@
|
|||||||
- disable attribute for at/notify/filelog
|
- disable attribute for at/notify/filelog
|
||||||
See HISTORY for details and reasoning
|
See HISTORY for details and reasoning
|
||||||
- added rename command
|
- added rename command
|
||||||
|
- webpgm2 adapted to the new syntax, added device specific attribute
|
||||||
|
and "set" support, gnuplot files are configurable, links to the
|
||||||
|
documentation added.
|
||||||
|
support.
|
||||||
|
|
||||||
|
|
||||||
- TODO: bugfix: more thorough serial line initialization
|
- TODO: bugfix: more thorough serial line initialization
|
||||||
|
@ -68,12 +68,12 @@ my %models = (
|
|||||||
fs20tk => 'sender',
|
fs20tk => 'sender',
|
||||||
fs20uts => 'sender',
|
fs20uts => 'sender',
|
||||||
fs20ze => 'sender',
|
fs20ze => 'sender',
|
||||||
|
fs20ms2 => 'sender',
|
||||||
|
|
||||||
fs20as1 => 'simple',
|
fs20as1 => 'simple',
|
||||||
fs20as4 => 'simple',
|
fs20as4 => 'simple',
|
||||||
fs20di => 'dimmer',
|
fs20di => 'dimmer',
|
||||||
fs20du => 'dimmer',
|
fs20du => 'dimmer',
|
||||||
fs20ms2 => 'simple',
|
|
||||||
fs20rst => 'simple',
|
fs20rst => 'simple',
|
||||||
fs20sa => 'simple',
|
fs20sa => 'simple',
|
||||||
fs20sig => 'simple',
|
fs20sig => 'simple',
|
||||||
|
@ -55,3 +55,12 @@
|
|||||||
in the same format. This data is contained in the xmllist.
|
in the same format. This data is contained in the xmllist.
|
||||||
- disable attribute for at/notify/filelog
|
- disable attribute for at/notify/filelog
|
||||||
- rename added
|
- rename added
|
||||||
|
|
||||||
|
- Rudi, Tue Mar 27 20:43:15 MEST 2007
|
||||||
|
fhemweb.pl (webpgm2) changes:
|
||||||
|
- adopted to the new syntax
|
||||||
|
- better commandline support (return <pre> formatted)
|
||||||
|
- FileLog attribute logtype added, and 4 logtypes (== gnuplot files)
|
||||||
|
defined: fs20, fht, ks300_1, ks300_2
|
||||||
|
- links in the commandref.html file added
|
||||||
|
- device dependent attribute and set support
|
||||||
|
@ -250,6 +250,49 @@ split in multiple lines<br><br>
|
|||||||
this in turn makes your logfile unreadable. These messages will not be
|
this in turn makes your logfile unreadable. These messages will not be
|
||||||
generated if the FHZ attribute loglevel is set to 6.</li><br>
|
generated if the FHZ attribute loglevel is set to 6.</li><br>
|
||||||
|
|
||||||
|
<a name="logtype"></a>
|
||||||
|
<li>logtype<br>
|
||||||
|
Can be applied to FileLog devices.<br>
|
||||||
|
Used by the pgm2 webfrontend to offer gnuplot images made from the
|
||||||
|
logs. The string is made up of tokens separated by comma (,), each
|
||||||
|
token specifies a different gnuplot program. The token may contain a
|
||||||
|
colon (:), the part before the colon defines the name of the program,
|
||||||
|
the part after is the string displayed in the web frontend. Currently
|
||||||
|
following types of gnuplot programs are implemented:<br>
|
||||||
|
<ul>
|
||||||
|
<li>fs20<br>
|
||||||
|
Plots on as 1 and off as 0. The corresponding filelog definition
|
||||||
|
for the device fs20dev is:<br>
|
||||||
|
define FileLog fslog fs20dev /var/log/fs20dev-%Y-%U.log
|
||||||
|
</li>
|
||||||
|
<li>fht<br>
|
||||||
|
Plots the measured-temp/desired-temp/actuator lines. The
|
||||||
|
corresponding filelog definitions (for the FHT device named
|
||||||
|
fht1) looks like:<br>
|
||||||
|
define FileLog fhtlog1 fht1:.*(temp|actuator).*
|
||||||
|
/var/log/fht1-%Y-%U.log
|
||||||
|
</li>
|
||||||
|
<li>ks300_1<br>
|
||||||
|
Plots the temperature and humidity of a ks300. The
|
||||||
|
corresponding filelog definitions (for the KS300 device named
|
||||||
|
ks300) looks like:<br>
|
||||||
|
define FileLog ks300log ks300:.*H:.*
|
||||||
|
/var/log/ks300-%Y-%U.log
|
||||||
|
</li>
|
||||||
|
<li>ks300_2<br>
|
||||||
|
Plots the rain (per hour and per day) and wind values of a
|
||||||
|
ks300. The corresponding filelog definition is the same as
|
||||||
|
above, both programs evaluate the same log.
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
The corresponding gnuplot files must be installed, see the fhemweb.pl
|
||||||
|
configuration for the destination directory.<br>
|
||||||
|
|
||||||
|
Example:<br>
|
||||||
|
attr fhtlog1 logtype ks300_1:Temp/Hum,ks300_2:Rain/Wind
|
||||||
|
</li><br>
|
||||||
|
|
||||||
|
|
||||||
<a name="model"></a>
|
<a name="model"></a>
|
||||||
<li>model<br>
|
<li>model<br>
|
||||||
Can be applied to FHZ/FS20/FHT/HMS/KS300/WS300 devices.<br>
|
Can be applied to FHZ/FS20/FHT/HMS/KS300/WS300 devices.<br>
|
||||||
@ -267,7 +310,6 @@ split in multiple lines<br><br>
|
|||||||
<ul>
|
<ul>
|
||||||
<li>FHT: fht80b</li>
|
<li>FHT: fht80b</li>
|
||||||
<li>FS20:
|
<li>FS20:
|
||||||
fs20hgs
|
|
||||||
fs20hgs
|
fs20hgs
|
||||||
fs20pira
|
fs20pira
|
||||||
fs20piri
|
fs20piri
|
||||||
@ -339,7 +381,7 @@ split in multiple lines<br><br>
|
|||||||
Notes:<br>
|
Notes:<br>
|
||||||
</ul>
|
</ul>
|
||||||
<li>See <a href="#delattr">delattr</a> to delete attributes.</li>
|
<li>See <a href="#delattr">delattr</a> to delete attributes.</li>
|
||||||
<ul>
|
</ul>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<a name="defattr"></a>
|
<a name="defattr"></a>
|
||||||
@ -967,6 +1009,7 @@ split in multiple lines<br><br>
|
|||||||
Instead of <name> you can also use an enumeration (separated by comma)
|
Instead of <name> you can also use an enumeration (separated by comma)
|
||||||
or ranges (separated by -), see the FS20 examples.
|
or ranges (separated by -), see the FS20 examples.
|
||||||
|
|
||||||
|
<a name="FHZset"></a>
|
||||||
<h4>Type FHZ:</h4>
|
<h4>Type FHZ:</h4>
|
||||||
<ul>
|
<ul>
|
||||||
<code>set FHZ <variable> [<value>]</code>
|
<code>set FHZ <variable> [<value>]</code>
|
||||||
@ -1000,6 +1043,7 @@ split in multiple lines<br><br>
|
|||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
|
|
||||||
|
<a name="FH20set"></a>
|
||||||
<h4>Type FS20:</h4>
|
<h4>Type FS20:</h4>
|
||||||
<ul>
|
<ul>
|
||||||
<code>set <name> <value> [<time>]</code>
|
<code>set <name> <value> [<time>]</code>
|
||||||
@ -1082,6 +1126,7 @@ split in multiple lines<br><br>
|
|||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
|
|
||||||
|
<a name="FHTset"></a>
|
||||||
<h4>Type FHT:</h4>
|
<h4>Type FHT:</h4>
|
||||||
<ul>
|
<ul>
|
||||||
<code>set <name> <valuetype> <value></code>
|
<code>set <name> <valuetype> <value></code>
|
||||||
@ -1148,6 +1193,7 @@ split in multiple lines<br><br>
|
|||||||
</ul>
|
</ul>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
|
<a name="WS300set"></a>
|
||||||
<h4>Type WS300:</h4>
|
<h4>Type WS300:</h4>
|
||||||
<ul>
|
<ul>
|
||||||
<code>set WS300Device <interval(min.)> <height(m)> <rainvalume(ml)>
|
<code>set WS300Device <interval(min.)> <height(m)> <rainvalume(ml)>
|
||||||
|
@ -130,18 +130,19 @@ description and <a href="faq.html">faq.html</a> for the F.A.Q.
|
|||||||
and <a href="pgm2-2.png">temperature logs</a><br><br>
|
and <a href="pgm2-2.png">temperature logs</a><br><br>
|
||||||
|
|
||||||
<ul>
|
<ul>
|
||||||
<li>Copy the file <code>fhemweb.pl</code> to your cgi-bin directory
|
<li>Copy the file fhemweb.pl and *.gplot to your cgi-bin directory
|
||||||
(/home/httpd/cgi-bin), and all the icons (*.gif) to your httpd icons
|
(/home/httpd/cgi-bin), the icons (*.gif) to your httpd icons
|
||||||
directory (/home/httpd/icons).<br>
|
(/home/httpd/icons), and commandref.html to the html directory
|
||||||
|
(/home/httpd/html).<br>
|
||||||
Note: The program looks for icons in the following order:
|
Note: The program looks for icons in the following order:
|
||||||
<device-name>.<state>, <device-name>,
|
<device-name>.<state>, <device-name>,
|
||||||
<device-type>.<state>, <device-type><br>
|
<device-type>.<state>, <device-type><br>
|
||||||
</li>
|
</li>
|
||||||
<li>Edit <code>fhemweb.pl</code>, and check the "Config" section.</li>
|
<li>Edit <code>fhemweb.pl</code>, and check the "Config" section.</li>
|
||||||
<li>If you want to have access to the FHT temperature logs, then
|
<li>If you want to have access to plotted logs, then make sure that
|
||||||
make sure that gnuplot is installed and you log the temperatures like
|
gnuplot is installed and set the logtype for the FileLog device
|
||||||
in example/04_log. Note: There is still a bug with displaying empty
|
(see commandref.html and example/04_log).
|
||||||
logfiles.</li>
|
</li>
|
||||||
<li>Call <your-site>/cgi-bin/fhemweb.pl
|
<li>Call <your-site>/cgi-bin/fhemweb.pl
|
||||||
</ul>
|
</ul>
|
||||||
For special features like assigning devices to rooms see the README file.
|
For special features like assigning devices to rooms see the README file.
|
||||||
|
@ -19,9 +19,13 @@ define ks1 KS300 1234 250 # type KS300, with 250ml rain / counter
|
|||||||
# Log temperature and actuator changes into a file, its name changes weekly
|
# Log temperature and actuator changes into a file, its name changes weekly
|
||||||
define wzlog FileLog /var/tmp/wz-%Y-%U.log wz:.*(temp|actuator).*
|
define wzlog FileLog /var/tmp/wz-%Y-%U.log wz:.*(temp|actuator).*
|
||||||
|
|
||||||
|
# Make it accessible from fhemweb.pl (webpgm2)
|
||||||
|
attr wzlog logtype fht:Temp
|
||||||
|
|
||||||
# ks300 log
|
# ks300 log
|
||||||
define kslog FileLog /var/log/wz-%Y-%U.log ks1:.*H:.*
|
define kslog FileLog /var/log/wz-%Y-%U.log ks1:.*H:.*
|
||||||
define avglog FileLog /var/log/avg.log ks1:.*avg.*
|
define avglog FileLog /var/log/avg.log ks1:.*avg.*
|
||||||
|
attr kslog logtype ks300_1:Temp/Hum,ks300_2:Rain/Wind
|
||||||
|
|
||||||
##############################
|
##############################
|
||||||
# Alternative log method. It does the same, but it is somewhat slower as it
|
# Alternative log method. It does the same, but it is somewhat slower as it
|
||||||
|
14
fhem/fhem.pl
14
fhem/fhem.pl
@ -135,11 +135,11 @@ my $reread_active = 0;
|
|||||||
my $AttrList = "room";
|
my $AttrList = "room";
|
||||||
|
|
||||||
|
|
||||||
$modules{Internal}{ORDER} = -1;
|
$modules{_internal_}{ORDER} = -1;
|
||||||
$modules{Internal}{AttrList} = "configfile logfile modpath " .
|
$modules{_internal_}{AttrList} = "configfile logfile modpath " .
|
||||||
"pidfilename port statefile userattr verbose:1,2,3,4,5 version";
|
"pidfilename port statefile title userattr " .
|
||||||
|
"verbose:1,2,3,4,5 version";
|
||||||
|
|
||||||
doGlobalDef($ARGV[0]);
|
|
||||||
|
|
||||||
my %cmds = (
|
my %cmds = (
|
||||||
"?" => { Fn=>"CommandHelp",
|
"?" => { Fn=>"CommandHelp",
|
||||||
@ -200,6 +200,8 @@ if(int(@ARGV) != 1 && int(@ARGV) != 2) {
|
|||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
doGlobalDef($ARGV[0]);
|
||||||
|
|
||||||
###################################################
|
###################################################
|
||||||
# Client code
|
# Client code
|
||||||
if(int(@ARGV) == 2) {
|
if(int(@ARGV) == 2) {
|
||||||
@ -1584,8 +1586,8 @@ doGlobalDef($)
|
|||||||
|
|
||||||
$devcount = 0;
|
$devcount = 0;
|
||||||
$defs{global}{NR} = $devcount++;
|
$defs{global}{NR} = $devcount++;
|
||||||
$defs{global}{TYPE} = "Internal";
|
$defs{global}{TYPE} = "_internal_";
|
||||||
$defs{global}{STATE} = "Internal";
|
$defs{global}{STATE} = "<no definition>";
|
||||||
$defs{global}{DEF} = "<no definition>";
|
$defs{global}{DEF} = "<no definition>";
|
||||||
|
|
||||||
CommandAttr(undef, "global verbose 3");
|
CommandAttr(undef, "global verbose 3");
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
See the main doc (fhem.html) for the first documentation and installation.
|
See the main doc (fhem.html) for the first documentation and installation.
|
||||||
|
|
||||||
If you want to show anly a part of your devices on a single screen
|
If you want to show only a part of your devices on a single screen
|
||||||
(i.e divide them into separate rooms), then assign each device the
|
(i.e divide them into separate rooms), then assign each device the
|
||||||
room attribute in the config file:
|
room attribute in the config file:
|
||||||
|
|
||||||
attr ks300 room garden
|
attr ks300 room garden
|
||||||
attr ks300-log room garden
|
attr ks300-log room garden
|
||||||
|
|
||||||
The attribute of the FHZ device will be used as title on the first
|
The attribute title of the global device will be used as title on the first
|
||||||
screen, which shows the list of all rooms. Devices in the room
|
screen, which shows the list of all rooms. Devices in the room
|
||||||
"hidden" will not be shown. Devices without a room attribute go
|
"hidden" will not be shown. Devices without a room attribute go
|
||||||
to the room "misc".
|
to the room "misc".
|
||||||
|
22
fhem/webfrontend/pgm2/fht.gplot
Normal file
22
fhem/webfrontend/pgm2/fht.gplot
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
#
|
||||||
|
# Display the measured temp and the actuator.
|
||||||
|
# FileLog definition:
|
||||||
|
# define FileLog fhtlog1 fht1:.*(temp|actuator).* /var/log/fht1-%Y-%U.log
|
||||||
|
#
|
||||||
|
set terminal png
|
||||||
|
set output '<OUT>.png'
|
||||||
|
set xdata time
|
||||||
|
set timefmt "%Y-%m-%d_%H:%M:%S"
|
||||||
|
set xlabel " "
|
||||||
|
set ytics nomirror
|
||||||
|
set y2tics
|
||||||
|
set title '<IN>'
|
||||||
|
set grid
|
||||||
|
|
||||||
|
set ylabel "Temperature (Celsius)"
|
||||||
|
set y2label "Actuator (%)"
|
||||||
|
plot \
|
||||||
|
"< awk '/measured/{print $1, $4; s=1}' <IN>"\
|
||||||
|
using 1:2 axes x1y1 title 'Measured temperature' with lines,\
|
||||||
|
"< awk '/actuator/ {print $1, $4+0; have=1} /measured/ {s=$1} END { if(!have) print (s, 0)}' <IN>"\
|
||||||
|
using 1:2 axes x1y2 title 'Actuator (%)' with lines
|
17
fhem/webfrontend/pgm2/fs20.gplot
Normal file
17
fhem/webfrontend/pgm2/fs20.gplot
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
#
|
||||||
|
# Display the on and off values off an FS20 device
|
||||||
|
# FileLog definition:
|
||||||
|
# define FileLog fs20log fs20dev /var/log/fs20dev-%Y-%U.log
|
||||||
|
#
|
||||||
|
set terminal png
|
||||||
|
set output '<OUT>.png'
|
||||||
|
set xdata time
|
||||||
|
set timefmt "%Y-%m-%d_%H:%M:%S"
|
||||||
|
set xlabel " "
|
||||||
|
set ytics nomirror
|
||||||
|
set title '<IN>'
|
||||||
|
set grid
|
||||||
|
set yrange [-0.2:1.2]
|
||||||
|
|
||||||
|
plot "< awk '{print $1, $3==\"on\"? 1 : 0; }' <IN>"\
|
||||||
|
using 1:2 title 'On/Off' with steps
|
19
fhem/webfrontend/pgm2/ks300_1.gplot
Normal file
19
fhem/webfrontend/pgm2/ks300_1.gplot
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
#
|
||||||
|
# Display the Temperature and the humidity values of a KS300.
|
||||||
|
# FileLog definition:
|
||||||
|
# define FileLog ks300log ks300:.*H:.* /var/log/ks300-%Y-%U.log
|
||||||
|
#
|
||||||
|
set terminal png
|
||||||
|
set output '<OUT>.png'
|
||||||
|
set xdata time
|
||||||
|
set timefmt "%Y-%m-%d_%H:%M:%S"
|
||||||
|
set xlabel " "
|
||||||
|
set ytics nomirror
|
||||||
|
set y2tics
|
||||||
|
set title '<IN>'
|
||||||
|
set grid
|
||||||
|
|
||||||
|
set ylabel "Temperature (Celsius)"
|
||||||
|
set y2label "Humidity (%)"
|
||||||
|
plot "<IN>" using 1:4 axes x1y1 title 'Temperature' with lines,\
|
||||||
|
"<IN>" using 1:6 axes x1y2 title 'Rel. Humidity (%)' with lines
|
20
fhem/webfrontend/pgm2/ks300_2.gplot
Normal file
20
fhem/webfrontend/pgm2/ks300_2.gplot
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
#
|
||||||
|
# Display the Wind and the Rain values of a KS300.
|
||||||
|
# FileLog definition:
|
||||||
|
# define FileLog ks300log ks300:.*H:.* /var/log/ks300-%Y-%U.log
|
||||||
|
#
|
||||||
|
set terminal png
|
||||||
|
set output '<OUT>.png'
|
||||||
|
set xdata time
|
||||||
|
set timefmt "%Y-%m-%d_%H:%M:%S"
|
||||||
|
set xlabel " "
|
||||||
|
set ytics nomirror
|
||||||
|
set y2tics
|
||||||
|
set title '<IN>'
|
||||||
|
set grid
|
||||||
|
|
||||||
|
set ylabel "Wind (Km/h)"
|
||||||
|
set y2label "Rain (l/m2)"
|
||||||
|
plot "<IN>" using 1:8 axes x1y1 title 'Wind' with lines,\
|
||||||
|
"<grep -v avg_ <IN> | perl -ane '@a = split(\"[_:]\", $F[0]); if(defined($lh) && $lh ne $a[1]) { printf(\"${ld}_$lh:30:00 %f\n\", $hv); $hv = 0; } if($lv) { $hv += ($F[9]-$lv); } $lh = $a[1]; $ld = $a[0]; $lv = $F[9]; END { printf(\"${ld}_$lh:30:00 %f\n\", $hv) }'" using 1:2 axes x1y2 title 'Rain/h' with histeps,\
|
||||||
|
"<grep -v avg_ <IN> | perl -ane '@a = split(\"[_]\", $F[0]); if(defined($ld) && $ld ne $a[0]) { printf(\"${ld}_12:00:00 %f\n\", $dv); $dv = 0; } if($lv) { $dv += ($F[9]-$lv); } $ld = $a[0]; $lv = $F[9]; END {printf(\"${ld}_12:00:00 %f\n\", $dv)}'" using 1:2 axes x1y2 title 'Rain/day' with histeps
|
Loading…
Reference in New Issue
Block a user