diff --git a/fhem/CHANGED b/fhem/CHANGED index e3e5251ec..0d68a0af0 100644 --- a/fhem/CHANGED +++ b/fhem/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/FHEM/01_FHEMWEB.pm b/fhem/FHEM/01_FHEMWEB.pm index dafd8383c..5525e4023 100755 --- a/fhem/FHEM/01_FHEMWEB.pm +++ b/fhem/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.