2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-04-16 23:06:05 +00:00

30_HUEBridge.pm: fixed bridge rediscovery, only possible for blocking http. see forum: http://forum.fhem.de/index.php/topic,11020.msg279333.html#msg279333

git-svn-id: https://svn.fhem.de/fhem/trunk@8322 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
justme-1968 2015-03-29 12:32:30 +00:00
parent b1b647b81a
commit a5764ea651

View File

@ -108,6 +108,8 @@ HUEBridge_Define($$)
if( !defined($host) ) {
$hash->{NUPNP} = 1;
HUEBridge_Detect($hash);
} else {
delete $hash->{NUPNP};
}
$interval= 300 unless defined($interval);
@ -555,20 +557,23 @@ HUEBridge_Call($$$$;$)
$json = encode_json($obj) if $obj;
# @TODO: repeat twice?
for (my $attempt=0; $attempt<2; $attempt++) {
for( my $attempt=0; $attempt<2; $attempt++ ) {
my $blocking;
my $res = undef;
if( !defined($attr{$name}{httpUtils}) ) {
$blocking = 1;
$res = HUEBridge_HTTP_Call($hash,$path,$json,$method);
} else {
$blocking = $attr{$name}{httpUtils} < 1;
$res = HUEBridge_HTTP_Call2($hash,$chash,$path,$json,$method);
}
if( defined($res) ) {
return $res;
}
return $res if( !$blocking || defined($res) );
Log3 $name, 3, "HUEBridge_Call: failed, retrying";
HUEBridge_Detect($hash);
}
Log3 $name, 3, "HUEBridge_Call: failed";
return undef;
}