mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-05-04 22:19:38 +00:00
Attributes inn title & co
git-svn-id: https://svn.fhem.de/fhem/trunk/fhem@370 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
523e56be3d
commit
ee232ed25a
@ -8,7 +8,7 @@ use POSIX;
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
sub SVG_render($$$$$$$);
|
sub SVG_render($$$$$);
|
||||||
sub time_to_sec($);
|
sub time_to_sec($);
|
||||||
sub fmtTime($$);
|
sub fmtTime($$);
|
||||||
|
|
||||||
@ -24,20 +24,25 @@ SVG_Initialize($)
|
|||||||
|
|
||||||
#####################################
|
#####################################
|
||||||
sub
|
sub
|
||||||
SVG_render($$$$$$$)
|
SVG_render($$$$$)
|
||||||
{
|
{
|
||||||
my ($file, $wh, $from, $to, $confp, $dp, $plot) = @_;
|
my ($from, $to, $confp, $dp, $plot) = @_;
|
||||||
|
|
||||||
my ($ow,$oh) = split(",", $wh); # Original width
|
|
||||||
my $th = 16; # "Font" height
|
my $th = 16; # "Font" height
|
||||||
my ($x, $y) = (3*$th, 1.2*$th); # Rect offset
|
my ($x, $y) = (3*$th, 1.2*$th); # Rect offset
|
||||||
my ($w, $h) = ($ow-2*$x, $oh-2*$y); # Rect size
|
|
||||||
my %conf; # gnuplot file settings
|
my %conf; # gnuplot file settings
|
||||||
|
|
||||||
# Convert the configuration to a "readable" form -> array to hash
|
# Convert the configuration to a "readable" form -> array to hash
|
||||||
map { chomp; my @a=split(" ",$_, 3);
|
map { chomp; my @a=split(" ",$_, 3);
|
||||||
if($a[0] && $a[0] eq "set") { $conf{$a[1]} = $a[2]; } } @{$confp};
|
if($a[0] && $a[0] eq "set") { $conf{$a[1]} = $a[2]; } } @{$confp};
|
||||||
|
|
||||||
|
my $ps = "800,400";
|
||||||
|
$ps = $1 if($conf{terminal} =~ m/.*size[ ]*([^ ]*)/);
|
||||||
|
$conf{title} =~ s/'//g;
|
||||||
|
|
||||||
|
my ($ow,$oh) = split(",", $ps); # Original width
|
||||||
|
my ($w, $h) = ($ow-2*$x, $oh-2*$y); # Rect size
|
||||||
|
|
||||||
# Html Header
|
# Html Header
|
||||||
pO "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
|
pO "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
|
||||||
pO "<?xml-stylesheet href=\"$__ME/svg_style.css\" type=\"text/css\"?>\n";
|
pO "<?xml-stylesheet href=\"$__ME/svg_style.css\" type=\"text/css\"?>\n";
|
||||||
@ -50,7 +55,7 @@ SVG_render($$$$$$$)
|
|||||||
|
|
||||||
my ($off1,$off2) = ($ow/2, 3*$y/4);
|
my ($off1,$off2) = ($ow/2, 3*$y/4);
|
||||||
pO "<text x=\"$off1\" y=\"$off2\"
|
pO "<text x=\"$off1\" y=\"$off2\"
|
||||||
class=\"title\" text-anchor=\"middle\">$file</text>\n";
|
class=\"title\" text-anchor=\"middle\">$conf{title}</text>\n";
|
||||||
|
|
||||||
my $t = ($conf{ylabel} ? $conf{ylabel} : "");
|
my $t = ($conf{ylabel} ? $conf{ylabel} : "");
|
||||||
$t =~ s/"//g;
|
$t =~ s/"//g;
|
||||||
@ -105,7 +110,6 @@ SVG_render($$$$$$$)
|
|||||||
$l = substr($$dp, $dpoff, $ndpoff-$dpoff);
|
$l = substr($$dp, $dpoff, $ndpoff-$dpoff);
|
||||||
}
|
}
|
||||||
$dpoff = $ndpoff+1;
|
$dpoff = $ndpoff+1;
|
||||||
|
|
||||||
if($l =~ m/^#/) {
|
if($l =~ m/^#/) {
|
||||||
my $a = $axes[$idx];
|
my $a = $axes[$idx];
|
||||||
$hmin{$a} = $min if(!defined($hmin{$a}) || $hmin{$a} > $min);
|
$hmin{$a} = $min if(!defined($hmin{$a}) || $hmin{$a} > $min);
|
||||||
@ -352,6 +356,9 @@ sub
|
|||||||
time_to_sec($)
|
time_to_sec($)
|
||||||
{
|
{
|
||||||
my ($str) = @_;
|
my ($str) = @_;
|
||||||
|
if(!$str) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
my ($y,$m,$d,$h,$mi,$s) = split("[-_:]", $str);
|
my ($y,$m,$d,$h,$mi,$s) = split("[-_:]", $str);
|
||||||
$s = 0 if(!$s);
|
$s = 0 if(!$s);
|
||||||
$mi= 0 if(!$mi);
|
$mi= 0 if(!$mi);
|
||||||
|
@ -1,77 +0,0 @@
|
|||||||
Installation:
|
|
||||||
=============
|
|
||||||
- copy the gif files to the destination directory
|
|
||||||
cp *.gif /home/httpd/icons
|
|
||||||
- copy docs/commandref.html to the doc directory
|
|
||||||
cp ../..docs/commandref.html /home/httpd/html
|
|
||||||
- check if the above directories are set correctly in 01_FHEMWEB.pm
|
|
||||||
vi 01_FHEMWEB.pm
|
|
||||||
- copy 01_FHEMWEB.pm to the fhem module directory
|
|
||||||
cp *.pm /usr/local/lib/FHEM
|
|
||||||
- restart fhem.pl
|
|
||||||
- define a new FHEMWEB instance in fhem
|
|
||||||
define WEB FHEMWEB 8080 global
|
|
||||||
|
|
||||||
Now you can access it from the web browser via
|
|
||||||
http://<yourhost>:8080/fhem
|
|
||||||
|
|
||||||
Additional features:
|
|
||||||
====================
|
|
||||||
- Rooms: If you have more than 10 devices/logs/notifies/etc. then it make sense
|
|
||||||
to divide them into "rooms". For this purpose assign the attribute room to
|
|
||||||
each device.
|
|
||||||
- hide devices: Devices in the room "hidden" will not be shown. Devices without
|
|
||||||
a room attribute go to the room "Unsorted".
|
|
||||||
- Title: You can set the title of the webpage with
|
|
||||||
attr global title "My-Title"
|
|
||||||
- If you set the attribute model of an FS20 device, and the device is an
|
|
||||||
FS20-sender, then you will not be able to switch it from the frontend.
|
|
||||||
- You can first set an attribute to an arbitrary (wrong) value, then click on
|
|
||||||
the attribute: you will be guided to the correct place in the documentation;
|
|
||||||
now you can chnage the attribute value to the correct one.
|
|
||||||
- To log the HTTP requests in the logfile, either set the global verbose to a
|
|
||||||
value greater than 3 or set the HTTP device loglevel to a lower value
|
|
||||||
attr <FHEMWEBDEVICE> loglevel 2
|
|
||||||
|
|
||||||
|
|
||||||
Graphs for plotted logs (gnuplot):
|
|
||||||
==================================
|
|
||||||
- Set FHEMWEB_gnuplot in 01_FHEMWEB.pm to the gnuplot binary
|
|
||||||
- copy the gnuplot files to the gnuplot scripts to the gnuplot directory
|
|
||||||
cp *.gplot /home/httpd/cgi-bin
|
|
||||||
- copy 99_weblink.pm to the FHEM modules directory and restart fhem.pl
|
|
||||||
- assign the logtype attribute to your FileLog device.
|
|
||||||
Look at the XXX.gplot file, how the FileLog should be defined, and
|
|
||||||
set the corresponding logtype attribute to XXX.
|
|
||||||
You can use more than one logtype, see commandref.html for more.
|
|
||||||
- To show more than one plot on one page, convert them to weblink, and assign
|
|
||||||
each weblink the same room. If a weblink is created for the CURRENT logfile,
|
|
||||||
it will always use the CURRENT logfile.
|
|
||||||
|
|
||||||
Password/HTTPS:
|
|
||||||
===============
|
|
||||||
- These features are implemented by apache, and apache must be configured to
|
|
||||||
redirect the page to 01_FHEMWEB.pm. For this purpose add the following lines
|
|
||||||
to your httpd.conf:
|
|
||||||
|
|
||||||
<Proxy *>
|
|
||||||
AuthType Basic
|
|
||||||
AuthName "Password Required"
|
|
||||||
AuthUserFile /home/httpd/etc/passwd
|
|
||||||
Require valid-user
|
|
||||||
Allow from 127.0.0.1
|
|
||||||
</Proxy>
|
|
||||||
ProxyPass /fhem http://localhost:<FHEMPORT>/fhem
|
|
||||||
ProxyPassReverse /fhem http://localhost:<FHEMPORT>/fhem
|
|
||||||
|
|
||||||
and then restart httpd with apachectl graceful. To create the password file,
|
|
||||||
execute htpasswd -c /home/httpd/etc/passwd <username>
|
|
||||||
|
|
||||||
- To enable HTTPS, please check the web.
|
|
||||||
In essence:
|
|
||||||
- Edit httpd.conf, add:
|
|
||||||
LoadModule ssl_module lib/apache/mod_ssl.so
|
|
||||||
Include /etc/httpd/conf/ssl.conf
|
|
||||||
- Create a server certificate
|
|
||||||
- Start httpd with the startssl option (SSL or the like must be set in one
|
|
||||||
of your system files, look at /etc/init.d/httpd).
|
|
Loading…
x
Reference in New Issue
Block a user