From 66db915b56a1dbd4a323c6a9e681b40c57a9804a Mon Sep 17 00:00:00 2001 From: justme-1968 Date: Wed, 24 Apr 2013 10:20:53 +0000 Subject: [PATCH] HUEDevice: allow color preset buttons in webCmd git-svn-id: https://svn.fhem.de/fhem/trunk@3112 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/CHANGED | 1 + fhem/FHEM/31_HUEDevice.pm | 29 +++++++++++++++++++++-------- 2 files changed, 22 insertions(+), 8 deletions(-) diff --git a/fhem/CHANGED b/fhem/CHANGED index 812d755f3..7ffb79e33 100644 --- a/fhem/CHANGED +++ b/fhem/CHANGED @@ -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 diff --git a/fhem/FHEM/31_HUEDevice.pm b/fhem/FHEM/31_HUEDevice.pm index a455a7d16..69290e91f 100644 --- a/fhem/FHEM/31_HUEDevice.pm +++ b/fhem/FHEM/31_HUEDevice.pm @@ -65,18 +65,29 @@ sub 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"); - my $c = "\"$FW_ME?cmd=set $d $cmd %$srf\""; - return "". - "". - ""; + if( $args[1] ) { + my $c = "\"$FW_ME?cmd=set $d $cmd$srf\""; + return "". + ''. + '
'. + '
'; + ""; + } else { + my $c = "\"$FW_ME?cmd=set $d $cmd %$srf\""; + return "". + "". + ""; + } } 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($) Attributes