2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-01-31 12:49:34 +00:00

added jscolor

use webCmdFn for colorpicker


git-svn-id: https://svn.fhem.de/fhem/trunk@3107 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
justme-1968 2013-04-23 11:34:54 +00:00
parent 05e0d87f9f
commit 4a3577b38c
8 changed files with 1044 additions and 1 deletions

View File

@ -1,5 +1,7 @@
# Add changes at the top of the list. Keep it in ASCII # Add changes at the top of the list. Keep it in ASCII
- SVN - SVN
- feature: HUEDevice: use webCmdFn for colorpicker
added jscolor for colorpicker
- feature: FHEMWEB: module specific summaryFn/detailFn + defineable webCmdFn - feature: FHEMWEB: module specific summaryFn/detailFn + defineable webCmdFn
- change: ESA2000: adapted device detection , rename readings - change: ESA2000: adapted device detection , rename readings
- change: stucture triggers on each change, see event-on-change-reading - change: stucture triggers on each change, see event-on-change-reading

View File

@ -56,6 +56,27 @@ sub HUEDevice_Initialize($)
"$readingFnAttributes ". "$readingFnAttributes ".
"model:".join(",", sort keys %hueModels)." ". "model:".join(",", sort keys %hueModels)." ".
"subType:colordimmer,dimmer,switch"; "subType:colordimmer,dimmer,switch";
$data{webCmdFn}{colorpicker} = "HUEDevice_colorpickerFn";
$data{FWEXT}{"/"}{SCRIPT} = "/jscolor/jscolor.js";
}
sub
HUEDevice_colorpickerFn($$$)
{
my ($FW_wname, $d, $FW_room, $cmd, $values) = @_;
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 "<td colspan='2'>".
"<input class='color {pickerMode:'$mode'}' value='#$cv' onchange='setColor(this,\"$mode\",$c)'\"/>".
"</td>";
} }
sub HUEDevice_Define($$) sub HUEDevice_Define($$)
@ -455,7 +476,7 @@ HUEDevice_GetUpdate($)
} }
if( defined($hue) && $hue != $hash->{fhem}{hue} ) {readingsBulkUpdate($hash,"hue",$hue);} if( defined($hue) && $hue != $hash->{fhem}{hue} ) {readingsBulkUpdate($hash,"hue",$hue);}
if( defined($sat) && $sat != $hash->{fhem}{sat} ) {readingsBulkUpdate($hash,"sat",$sat);} if( defined($sat) && $sat != $hash->{fhem}{sat} ) {readingsBulkUpdate($hash,"sat",$sat);}
if( $xy eq "," ) {readingsBulkUpdate($hash,"xy","");} if( $xy eq "," && $xy ne $hash->{fhem}{xy} ) {readingsBulkUpdate($hash,"xy","");}
elsif( $xy ne $hash->{fhem}{xy} ) {readingsBulkUpdate($hash,"xy",$xy);} elsif( $xy ne $hash->{fhem}{xy} ) {readingsBulkUpdate($hash,"xy",$xy);}
my $s = ''; my $s = '';

BIN
fhem/www/jscolor/arrow.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 66 B

BIN
fhem/www/jscolor/cross.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 83 B

View File

@ -0,0 +1,12 @@
<html>
<head>
<title>jscolor demo</title>
</head>
<body>
<script type="text/javascript" src="jscolor.js"></script>
Click here: <input class="color" value="66ff00">
</body>
</html>

BIN
fhem/www/jscolor/hs.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

BIN
fhem/www/jscolor/hv.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

1008
fhem/www/jscolor/jscolor.js Normal file

File diff suppressed because it is too large Load Diff