diff --git a/fhem/docs/commandref.html b/fhem/docs/commandref.html index 188077218..df989a0b9 100644 --- a/fhem/docs/commandref.html +++ b/fhem/docs/commandref.html @@ -5544,11 +5544,10 @@ Readings and STATE of temperature/humidity sensors are compatible with the CUL_W
define <name> weblink [link|fileplot|image]
+ define <name> weblink [link|fileplot|image|iframe]
<argument>
This is a placeholder used with webpgm2 to be able to integrate links
@@ -5558,8 +5557,9 @@ Readings and STATE of temperature/humidity sensors are compatible with the CUL_W
Examples:
define homepage weblink link http://www.fhem.de
+ define webcam_picture weblink image http://w.x.y.z/current.jpg
+ define interactive_webcam weblink iframe http://w.x.y.z/webcam.cgi
define MyPlot weblink fileplot <logdevice>:<gnuplot-file>:<logfile>
- define webcam weblink image http://w.x.y.z/current.jpg
@@ -5582,6 +5582,17 @@ Readings and STATE of temperature/humidity sensors are compatible with the CUL_W
Attributes
+
+ - htmlattr
+ HTML attributes to be used for link, image and iframe type of links. E.g.:
+
+
+ define yw weblink wl_im1 iframe http://weather.yahooapis.com/forecastrss?w=650272&u=c
+ attr yw weblink htmlattr width="480" height="560"
+
+
+
+
- fixedrange
- plotsize
- plotmode
@@ -5597,6 +5608,36 @@ Readings and STATE of temperature/humidity sensors are compatible with the CUL_W
individual curves, by accessing the corresponding values from the data
hash, see the example below:
+
+ - Fixed text for the right and left axis:
+
+ - Fhem config:
+ attr wl_1 label "Temperature"::"Humidity"
+ - .gplot file entry:
+ set ylabel <L1>
+ set y2label <L2>
+
+ - Title with maximum and current values of the 1st curve (FileLog)
+
+ - Fhem config:
+ attr wl_1 label "Max $data{max1}, Current $data{currval1}"
+ - .gplot file entry:
+ set title <L1>
+
+
+
+
+ - label
+ Double-Colon separated list of values. The values will be used to replace
+ <L#> type of strings in the .gplot file, with # beginning at 1
+ (<L1>, <L2>, etc.). Each value will be evaluated as a perl
+ expression, so you have access e.g. to the Value functions.
+
+ If the plotmode is gnuplot-scroll or SVG, you can also use the min, max,
+ avg, cnt, sum, lastv (last value) and lastd (last date) values of the
+ individual curves, by accessing the corresponding values from the data
+ hash, see the example below:
+
- Fixed text for the right and left axis:
@@ -5703,6 +5744,10 @@ Readings and STATE of temperature/humidity sensors are compatible with the CUL_W
then requests from all interfaces (not only localhost / 127.0.0.1) are
serviced.
To enable listening on IPV6 see the comments here.
+
+ Feature: http://host:port/fhem/icons/<devicename> will return
+ the icon associated with the current status of <devicename>.
+
diff --git a/fhem/webfrontend/pgm2/01_FHEMWEB.pm b/fhem/webfrontend/pgm2/01_FHEMWEB.pm
index f88069597..55b8af2bb 100755
--- a/fhem/webfrontend/pgm2/01_FHEMWEB.pm
+++ b/fhem/webfrontend/pgm2/01_FHEMWEB.pm
@@ -7,31 +7,33 @@ use IO::Socket;
#########################
# Forward declaration
+sub FW_AnswerCall($);
+sub FW_calcWeblink($$);
+sub FW_dev2image($);
sub FW_digestCgi($);
sub FW_doDetail($);
+sub FW_fatal($);
sub FW_fileList($);
+sub FW_logWrapper($);
sub FW_makeTable($$$$$$$$);
-sub FW_updateHashes();
-sub FW_showRoom();
+sub FW_ReadIcons();
+sub FW_roomOverview($);
+sub FW_select($$$);
sub FW_showArchive($);
sub FW_showLog($);
-sub FW_logWrapper($);
+sub FW_showRoom();
sub FW_showWeblink($$$);
-sub FW_select($$$);
-sub FW_textfield($$);
+sub FW_style($$);
sub FW_submit($$);
sub FW_substcfg($$$$$$);
-sub FW_style($$);
-sub FW_roomOverview($);
-sub FW_fatal($);
-sub pF($@);
-sub pO(@);
-sub pH(@);
-sub pHPlain(@);
-sub pHJava(@);
-sub FW_AnswerCall($);
+sub FW_textfield($$);
+sub FW_updateHashes();
sub FW_zoomLink($$$);
-sub FW_calcWeblink($$);
+sub pF($@);
+sub pH(@);
+sub pHJava(@);
+sub pHPlain(@);
+sub pO(@);
use vars qw($FW_dir); # moddir (./FHEM), needed by SVG
use vars qw($FW_ME); # webname (default is fhem), needed by 97_GROUP
@@ -328,13 +330,20 @@ FW_AnswerCall($)
} elsif($arg =~ m,^$FW_ME/icons/(.*)$, ||
$arg =~ m,^$FW_ME/(.*.png)$,) {
- open(FH, "$FW_dir/$1") || return;
+ my $img = $1;
+ my $cachable = 1;
+ if(!open(FH, "$FW_dir/$img")) {
+ FW_ReadIcons();
+ $img = FW_dev2image($img);
+ $cachable = 0;
+ return if(!$img || !open(FH, "$FW_dir/$img"));
+ }
binmode (FH); # necessary for Windows
pO join("", );
close(FH);
- my @f_ext = split(/\./,$1); #kpb
+ my @f_ext = split(/\./,$img); #kpb
$FW_RETTYPE = "image/$f_ext[-1]";
- return 1;
+ return $cachable;
} elsif($arg =~ m,^$FW_ME/(.*).js,) { #kpb java include
open(FH, "$FW_dir/$1.js") || return;
@@ -772,20 +781,7 @@ sub
FW_showRoom()
{
# (re-) list the icons
- if(!$FW_iconsread || (time() - $FW_iconsread) > 5) {
- %FW_icons = ();
- if(opendir(DH, $FW_dir)) {
- my @files = readdir(DH);
- closedir(DH);
- foreach my $l (sort @files) { # Order: .gif,.jpg,.png
- next if($l !~ m/\.(png|gif|jpg)$/i);
- my $x = $l;
- $x =~ s/\.[^.]+$//; # Cut .gif/.jpg
- $FW_icons{$x} = $l;
- }
- }
- $FW_iconsread = time();
- }
+ FW_ReadIcons();
pO "