From 9db0077d513c9b0e8f2a7f99b9809247fa5267e4 Mon Sep 17 00:00:00 2001 From: rudolfkoenig <> Date: Fri, 23 Nov 2012 18:36:24 +0000 Subject: [PATCH] devStateIcon added git-svn-id: https://svn.fhem.de/fhem/trunk/fhem@2168 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- CHANGED | 1 + FHEM/01_FHEMWEB.pm | 27 +++++++++++++++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/CHANGED b/CHANGED index e3e5251ec..0d68a0af0 100644 --- a/CHANGED +++ b/CHANGED @@ -18,6 +18,7 @@ - change: FHEMWEB closing old TCP connections - change: FHEMWEB added "Associated with" to detail-screen (Uli) - change: FHEMWEB added ETag headers (Matthias) + - change: FHEMWEB devStateIcon added - 2012-10-28 (5.3) - feature: added functions trim, ltrim, rtrim, UntoggleDirect, diff --git a/FHEM/01_FHEMWEB.pm b/FHEM/01_FHEMWEB.pm index dafd8383c..5525e4023 100755 --- a/FHEM/01_FHEMWEB.pm +++ b/FHEM/01_FHEMWEB.pm @@ -137,6 +137,7 @@ FHEMWEB_Initialize($) addToAttrList("webCmd"); addToAttrList("icon"); + addToAttrList("devStateIcon"); InternalTimer(time()+60, "FW_closeOldClients", 0, 0); } @@ -2321,6 +2322,17 @@ FW_dev2image($) $state =~ s/ .*//; # Want to be able to have icons for "on-for-timer xxx" my $icon; + my $devStateIcon = AttrVal($name, "devStateIcon", undef); + if(defined($devStateIcon)) { + my @list = split(" ", $devStateIcon); + foreach my $l (@list) { + my ($re,$iconName) = split(":", $l); + if($re && $state =~ m/^$re$/) { + return FW_getIcon($iconName); # Can be used to preserve text + } + } + } + $icon = FW_getIcon("$name.$state") if(!$icon); # lamp.Aus.png $icon = FW_getIcon("$name.$rstate") if(!$icon); # lamp.on.png $icon = FW_getIcon($name) if(!$icon); # lamp.png @@ -2917,6 +2929,21 @@ FW_closeOldClients()
+ +
  • devStateIcon
    + Space separated list of regexp/icon-name pairs. If the state of the + device matches regexp, then the corresponding icon-name will be + displayed. If icon-name does not exist in the fhem/www/images + directory, then the status text will be displayed. Note: the icon-name + must be specified without the trailing .png/.jpg suffix.
    + Example:
    + +
  • +
    + See also room and group attributes.