mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-03-03 16:56:54 +00:00
HUEDevice: allow color preset buttons in webCmd
git-svn-id: https://svn.fhem.de/fhem/trunk@3112 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
968cf55cf6
commit
66db915b56
@ -1,5 +1,6 @@
|
||||
# Add changes at the top of the list. Keep it in ASCII
|
||||
- SVN
|
||||
- change: HUEDevice: allow color preset buttons in webCmd
|
||||
- feature: SYSSTAT: allow (remote) monitoring raspberry pi on chip temperature
|
||||
- feature: HUEDevice: use webCmdFn for colorpicker
|
||||
added jscolor for colorpicker
|
||||
|
@ -66,18 +66,29 @@ HUEDevice_colorpickerFn($$$)
|
||||
{
|
||||
my ($FW_wname, $d, $FW_room, $cmd, $values) = @_;
|
||||
|
||||
my @args = split("[ \t]+", $cmd);
|
||||
|
||||
return undef if($values !~ m/^colorpicker,(.*)$/);
|
||||
my ($mode) = ($1);
|
||||
$mode = "RGB" if( !defined($mode) );
|
||||
my $srf = $FW_room ? "&room=$FW_room" : "";
|
||||
my $srf = $FW_room ? "&room=$FW_room" : "";
|
||||
my $cv = CommandGet("","$d $cmd");
|
||||
$cmd = "" if($cmd eq "state");
|
||||
if( $args[1] ) {
|
||||
my $c = "\"$FW_ME?cmd=set $d $cmd$srf\"";
|
||||
return "<td colspan='2'>".
|
||||
'<a href='. $c .'>'.
|
||||
'<div style="width:32px;height:19px;'.
|
||||
'border:1px solid #fff;border-radius:8px;background-color:#'. $args[1] .';"></div>'.
|
||||
'</a>';
|
||||
"</td>";
|
||||
} else {
|
||||
my $c = "\"$FW_ME?cmd=set $d $cmd %$srf\"";
|
||||
return "<td colspan='2'>".
|
||||
"<input class='color {pickerMode:'$mode'}' value='#$cv' onchange='setColor(this,\"$mode\",$c)'\"/>".
|
||||
"</td>";
|
||||
}
|
||||
}
|
||||
|
||||
sub HUEDevice_Define($$)
|
||||
{
|
||||
@ -108,7 +119,7 @@ sub HUEDevice_Define($$)
|
||||
$hash->{fhem}{xy} = '';
|
||||
|
||||
|
||||
CommandAttr(undef,$name.' webCmd rgb:toggle:on:off') if( !defined( AttrVal($hash->{NAME}, "webCmd", undef) ) );
|
||||
CommandAttr(undef,$name.' webCmd rgb:rgb ff0000:rgb C8FF12:rgb 0000ff:toggle:on:off') if( !defined( AttrVal($hash->{NAME}, "webCmd", undef) ) );
|
||||
CommandAttr(undef,$name.' devStateIcon {CommandGet("","'.$name.' devStateIcon")}') if( !defined( AttrVal($hash->{NAME}, "devStateIcon", undef) ) );
|
||||
|
||||
AssignIoPort($hash);
|
||||
@ -619,9 +630,11 @@ HUEDevice_GetUpdate($)
|
||||
<b>Attributes</b>
|
||||
<ul>
|
||||
<li>subType<br>
|
||||
dimmer or switch, default is dimmer.</li>
|
||||
colordimmer, dimmer or switch, default is initialized according to device model.</li>
|
||||
<li>devStateIcon<br>
|
||||
will be initialized to <code>{CommandGet("","<name> devStateIcon")}</code> to show device color as default in room overview.</li>
|
||||
<li>webCmd<br>
|
||||
will be initialized to <code>rgb:rgb FF0000:rgb C8FF12:rgb 0000FF:toggle:on:off</code> to show colorpicker and 3 color preset buttons in room overview.</li>
|
||||
</ul>
|
||||
|
||||
</ul><br>
|
||||
|
Loading…
x
Reference in New Issue
Block a user