1
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-05-04 22:19:38 +00:00

added get devices to 30_HUEBridge

fixed warning for switched off bulbs


git-svn-id: https://svn.fhem.de/fhem/trunk/fhem@2838 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
justme-1968 2013-03-01 20:14:32 +00:00
parent 6ca5d92eeb
commit b7f9a3534e
2 changed files with 31 additions and 2 deletions

View File

@ -21,6 +21,7 @@ sub HUEBridge_Initialize($)
#Consumer
$hash->{DefFn} = "HUEBridge_Define";
$hash->{SetFn} = "HUEBridge_Set";
$hash->{GetFn} = "HUEBridge_Get";
$hash->{UndefFn} = "HUEBridge_Undefine";
$hash->{AttrList}= "key loglevel:0,1,2,3,4,5";
}
@ -132,6 +133,26 @@ HUEBridge_Set($@)
}
}
sub
HUEBridge_Get($@)
{
my ($hash, $name, $cmd) = @_;
return "$name: get needs at least one parameter" if( !defined($cmd) );
# usage check
if($cmd eq 'devices') {
my $result = HUEBridge_Call($hash, 'lights', undef);
my $ret = "";
foreach my $key ( sort keys %$result ) {
$ret .= $key .": ". $result->{$key}{name} ."\n";
}
return $ret;
} else {
return "Unknown argument $cmd, choose one of devices";
}
}
sub
HUEBridge_GetUpdate($)
{
@ -422,6 +443,13 @@ HUEBridge_HTTP_Request($$$@)
</ul>
</ul><br>
<a name="HUEBridge_Get"></a>
<b>Set</b>
<ul>
<li>devices<br>
list the devices known to the bridge.</li>
</ul><br>
<a name="HUEBridge_Set"></a>
<b>Set</b>
<ul>

View File

@ -445,7 +445,8 @@ HUEDevice_GetUpdate($)
my $ct = $state->{'ct'};
my $hue = $state->{'hue'};
my $sat = $state->{'sat'};
my $xy = $state->{'xy'}->[0] .",". $state->{'xy'}->[1];
my $xy = ",";
$xy = $state->{'xy'}->[0] .",". $state->{'xy'}->[1] if( defined($state->{'xy'}) );
if( defined($colormode) && $colormode ne $hash->{fhem}{colormode} ) {readingsBulkUpdate($hash,"colormode",$colormode);}
if( defined($bri) && $bri != $hash->{fhem}{bri} ) {readingsBulkUpdate($hash,"bri",$bri);}
@ -460,7 +461,7 @@ HUEDevice_GetUpdate($)
if( defined($hue) && $hue != $hash->{fhem}{hue} ) {readingsBulkUpdate($hash,"hue",$hue);}
if( defined($sat) && $sat != $hash->{fhem}{sat} ) {readingsBulkUpdate($hash,"sat",$sat);}
if( $xy eq "," ) {readingsBulkUpdate($hash,"xy","");}
elsif( $xy != $hash->{fhem}{xy} ) {readingsBulkUpdate($hash,"xy",$xy);}
elsif( $xy ne $hash->{fhem}{xy} ) {readingsBulkUpdate($hash,"xy",$xy);}
my $s = '';
if( $on )