mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-03-10 03:06:37 +00:00
devStateIcon added
git-svn-id: https://svn.fhem.de/fhem/trunk@2168 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
660bccc177
commit
e4380147bd
@ -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,
|
||||
|
@ -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()
|
||||
</li>
|
||||
<br>
|
||||
|
||||
<a name="devStateIcon"></a>
|
||||
<li>devStateIcon<br>
|
||||
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.<br>
|
||||
Example:<br>
|
||||
<ul>
|
||||
attr lamp devStateIcon on:closed off:open<br>
|
||||
attr lamp devStateIcon .*:noIcon<br>
|
||||
</ul>
|
||||
</li>
|
||||
<br>
|
||||
|
||||
</ul>
|
||||
|
||||
See also <a href="#room">room</a> and <a href="#group">group</a> attributes.
|
||||
|
Loading…
x
Reference in New Issue
Block a user