2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-03-03 04:36:36 +00:00

use new devStateIcon feature to show device color in room overview

git-svn-id: https://svn.fhem.de/fhem/trunk@2810 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
justme-1968 2013-02-25 19:52:48 +00:00
parent 7fcecd16ce
commit 96e83e5c09
2 changed files with 23 additions and 2 deletions

View File

@ -1,8 +1,10 @@
- SVN
- change: 30_HUEDevice: use new devStateIcon feature to show device color
in room overview
- feature: added example Setup SQL and configuration for SQLite
- change: modified MySQL Setup SQL to use 512 characters in EVENT column
- feature: added new Javascript Frontend based on ExtJS (by Johannes)
- feature: new Modules 30_HUEDevice and 31_HUEBridge for phillips hue and
- feature: new Modules 30_HUEBridge and 31_HUEDevice for phillips hue and
smartlink devices (by justme1968)
- change: SYSSTAT: allow remote monitoring by ssh
- change: SYSSTAT: allow less frequent updates for diskusage

View File

@ -60,6 +60,9 @@ sub HUEDevice_Define($$)
$hash->{fhem}{hue} = -1;
$hash->{fhem}{sat} = -1;
CommandAttr(undef,$name.' devStateIcon {CommandGet("","'.$name.' devStateIcon")}') if( !defined( AttrVal($hash->{NAME}, "devStateIcon", undef) ) );
AssignIoPort($hash);
if(defined($hash->{IODev}->{NAME})) {
Log 3, "$name: I/O device is " . $hash->{IODev}->{NAME};
@ -332,9 +335,20 @@ HUEDevice_Get($@)
}
}
return $ret;
} elsif ( $cmd eq "devStateIcon" ) {
return '<div id="'.$name.'" align="center" class="col2">'.
'<img src="/fhem/icons/off" alt="off" title="off"'.
'</div>' if( ReadingsVal($name,"state","off") eq "off" );
return '<div id="'.$name.'" align="center" class="col2">'.
'<img src="/fhem/icons/'.$hash->{STATE}.'" alt="'.$hash->{STATE}.'" title="'.$hash->{STATE}.'"'.
'</div>' if( AttrVal($hash->{NAME}, "model", "") eq "LWL001" );
return '<div id="'.$name.'" class="block" style="width:32px;height:19px;'.
'border:1px solid #fff;border-radius:8px;background-color:#'.CommandGet("","$name rgb").';"></div>';
}
return "Unknown argument $cmd, choose one of rgb";
return "Unknown argument $cmd, choose one of rgb devStateIcon";
}
@ -453,6 +467,7 @@ HUEDevice_GetUpdate($)
my $percent = int( $state->{'bri'} * 100 / 254 );
if( $bri != $hash->{fhem}{bri} ) {readingsBulkUpdate($hash,"level", $percent . ' %');}
if( $bri != $hash->{fhem}{bri} ) {readingsBulkUpdate($hash,"pct", $percent);}
if( $percent > 0
&& $percent < 100 ) {
$s = $dim_values{int($percent/7)};
@ -566,6 +581,8 @@ HUEDevice_GetUpdate($)
<b>Get</b>
<ul>
<li>rgb</li>
<li>devStateIcon<br>
returns html code that can be used to create an icon that represents the device color in the room overview.</li>
</ul><br>
<a name="HUEDevice_Attr"></a>
@ -573,6 +590,8 @@ HUEDevice_GetUpdate($)
<ul>
<li>subType<br>
dimmer or switch, default is dimmer.</li>
<li>devStateIcon<br>
will be initialized to <code>{CommandGet("","&lt;name&gt; devStateIcon")}</code> as default to show device color in room overview.</li>
</ul>
</ul><br>