mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-03-10 03:06:37 +00:00
allow autodetection of bridge with hue portal services
git-svn-id: https://svn.fhem.de/fhem/trunk@2893 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
0729c2a9cd
commit
979c95105c
@ -1,6 +1,7 @@
|
||||
# Add changes at the top of the list.
|
||||
|
||||
- SVN
|
||||
- change: 30_HUEDevice: allow autodetection of bridge with hue portal services
|
||||
- feature: THRESHOLD Module by Damian
|
||||
- change: 30_HUEDevice: use new devStateIcon feature to show device color
|
||||
in room overview
|
||||
|
@ -44,10 +44,30 @@ sub HUEBridge_Define($$)
|
||||
|
||||
my @args = split("[ \t]+", $def);
|
||||
|
||||
return "Usage: define <name> HUEBridge <host> [interval]" if(@args < 3);
|
||||
return "Usage: define <name> HUEBridge [<host>] [interval]" if(@args < 2);
|
||||
|
||||
my ($name, $type, $host, $interval) = @args;
|
||||
|
||||
if( !defined($host) ) {
|
||||
my $ret = HUEBridge_HTTP_Request(0,"http://www.meethue.com/api/nupnp","GET",undef,undef,undef);
|
||||
|
||||
if( defined($ret) && $ret ne '' )
|
||||
{
|
||||
my $obj = decode_json($ret);
|
||||
|
||||
if( defined($obj->[0])
|
||||
&& defined($obj->[0]->{'internalipaddress'}) ) {
|
||||
}
|
||||
$host = $obj->[0]->{'internalipaddress'};
|
||||
}
|
||||
|
||||
if( !defined($host) ) {
|
||||
return 'error detecting bridge.';
|
||||
}
|
||||
|
||||
$hash->{DEF} = $host;
|
||||
}
|
||||
|
||||
$interval= 300 unless defined($interval);
|
||||
if( $interval < 60 ) { $interval = 60; }
|
||||
|
||||
@ -434,13 +454,17 @@ HUEBridge_HTTP_Request($$$@)
|
||||
<a name="HUEBridge_Define_Define"></a>
|
||||
<b>Define</b>
|
||||
<ul>
|
||||
<code>define <name> HUEBridge <host> [<interval>]</code><br>
|
||||
<code>define <name> HUEBridge [<host>] [<interval>]</code><br>
|
||||
<br>
|
||||
|
||||
Defines a HUEBridge device with address <host>.<br><br>
|
||||
|
||||
If [<host>] is not given the module will try to autodetect the bridge with the hue portal services.<br><br>
|
||||
|
||||
The bridge status will be updated every <interval> seconds. The default and minimum is 60.<br><br>
|
||||
|
||||
After a new bridge is created the pair button on the bridge has to be pressed.<br><br>
|
||||
|
||||
Examples:
|
||||
<ul>
|
||||
<code>define bridge HUEBridge 10.0.1.1</code><br>
|
||||
|
Loading…
x
Reference in New Issue
Block a user