mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-05-07 22:29:19 +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:
parent
6ca5d92eeb
commit
b7f9a3534e
@ -21,6 +21,7 @@ sub HUEBridge_Initialize($)
|
|||||||
#Consumer
|
#Consumer
|
||||||
$hash->{DefFn} = "HUEBridge_Define";
|
$hash->{DefFn} = "HUEBridge_Define";
|
||||||
$hash->{SetFn} = "HUEBridge_Set";
|
$hash->{SetFn} = "HUEBridge_Set";
|
||||||
|
$hash->{GetFn} = "HUEBridge_Get";
|
||||||
$hash->{UndefFn} = "HUEBridge_Undefine";
|
$hash->{UndefFn} = "HUEBridge_Undefine";
|
||||||
$hash->{AttrList}= "key loglevel:0,1,2,3,4,5";
|
$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
|
sub
|
||||||
HUEBridge_GetUpdate($)
|
HUEBridge_GetUpdate($)
|
||||||
{
|
{
|
||||||
@ -422,6 +443,13 @@ HUEBridge_HTTP_Request($$$@)
|
|||||||
</ul>
|
</ul>
|
||||||
</ul><br>
|
</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>
|
<a name="HUEBridge_Set"></a>
|
||||||
<b>Set</b>
|
<b>Set</b>
|
||||||
<ul>
|
<ul>
|
||||||
|
@ -445,7 +445,8 @@ HUEDevice_GetUpdate($)
|
|||||||
my $ct = $state->{'ct'};
|
my $ct = $state->{'ct'};
|
||||||
my $hue = $state->{'hue'};
|
my $hue = $state->{'hue'};
|
||||||
my $sat = $state->{'sat'};
|
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($colormode) && $colormode ne $hash->{fhem}{colormode} ) {readingsBulkUpdate($hash,"colormode",$colormode);}
|
||||||
if( defined($bri) && $bri != $hash->{fhem}{bri} ) {readingsBulkUpdate($hash,"bri",$bri);}
|
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($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 "," ) {readingsBulkUpdate($hash,"xy","");}
|
||||||
elsif( $xy != $hash->{fhem}{xy} ) {readingsBulkUpdate($hash,"xy",$xy);}
|
elsif( $xy ne $hash->{fhem}{xy} ) {readingsBulkUpdate($hash,"xy",$xy);}
|
||||||
|
|
||||||
my $s = '';
|
my $s = '';
|
||||||
if( $on )
|
if( $on )
|
||||||
|
Loading…
x
Reference in New Issue
Block a user