mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-05-04 22:19:38 +00:00
37_harmony.pm: try to fallback to xmpp if no discovery response is received. (segmented network)
git-svn-id: https://svn.fhem.de/fhem/trunk/fhem@18027 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
295d1e2c9a
commit
1191d74eda
@ -61,7 +61,7 @@ sub
|
|||||||
harmony_startDiscovery()
|
harmony_startDiscovery()
|
||||||
{
|
{
|
||||||
if( defined($modules{harmony}{defptr}{'harmony:discovery'}) ) {
|
if( defined($modules{harmony}{defptr}{'harmony:discovery'}) ) {
|
||||||
fhem( "set harmony:discovery discover" );
|
harmony_sendDiscovery();
|
||||||
}
|
}
|
||||||
|
|
||||||
return if( $modules{harmony}{defptr}{'harmony:discovery'} );
|
return if( $modules{harmony}{defptr}{'harmony:discovery'} );
|
||||||
@ -88,16 +88,44 @@ harmony_startDiscovery()
|
|||||||
$defs{$chash->{NAME}} = $chash;
|
$defs{$chash->{NAME}} = $chash;
|
||||||
$selectlist{$chash->{NAME}} = $chash;
|
$selectlist{$chash->{NAME}} = $chash;
|
||||||
|
|
||||||
|
harmony_sendDiscovery();
|
||||||
|
|
||||||
|
} else {
|
||||||
|
Log3 undef, 2, "harmony: failed to start discovery" ;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
Log3 undef, 2, "harmony: failed to start discovery" ;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
sub
|
||||||
|
harmony_sendDiscovery()
|
||||||
|
{
|
||||||
|
my $chash = $modules{harmony}{defptr}{'harmony:discovery'};
|
||||||
|
return if( !$chash );
|
||||||
|
Log3 undef, 3, "harmony: sending discovery" ;
|
||||||
|
|
||||||
my $sin = sockaddr_in(5224, inet_aton('255.255.255.255'));
|
my $sin = sockaddr_in(5224, inet_aton('255.255.255.255'));
|
||||||
$chash->{sendSocket}->send( "_logitech-reverse-bonjour._tcp.local.\n$chash->{PORT}", 0, $sin );
|
$chash->{sendSocket}->send( "_logitech-reverse-bonjour._tcp.local.\n$chash->{PORT}", 0, $sin );
|
||||||
|
|
||||||
} else {
|
foreach my $chash ( values %{$modules{'harmony'}{defptr}} ) {
|
||||||
Log3 undef, 2, "harmony: failed to start discovery" ;
|
next if( $chash->{NAME} eq 'harmony:discovery' );
|
||||||
}
|
next if( $chash->{ConnectionState} eq 'Connected' );
|
||||||
} else {
|
next if( !defined($chash->{ip}) );
|
||||||
Log3 undef, 2, "harmony: failed to start discovery" ;
|
next if( $chash->{remoteId} );
|
||||||
}
|
|
||||||
|
|
||||||
|
RemoveInternalTimer($chash);
|
||||||
|
InternalTimer(gettimeofday()+10, "harmony_tryXMPP", $chash, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
sub
|
||||||
|
harmony_tryXMPP($)
|
||||||
|
{
|
||||||
|
my ($hash) = @_;
|
||||||
|
my $name = $hash->{NAME};
|
||||||
|
Log3 $name, 3, "$name no discovery response received, trying fallback to xmpp" ;
|
||||||
|
|
||||||
|
harmony_connect($hash);
|
||||||
}
|
}
|
||||||
sub
|
sub
|
||||||
harmony_stopDiscovery()
|
harmony_stopDiscovery()
|
||||||
@ -376,8 +404,7 @@ harmony_Set($$@)
|
|||||||
my $list = "discover:noArg";
|
my $list = "discover:noArg";
|
||||||
|
|
||||||
if( $cmd eq "discover" ) {
|
if( $cmd eq "discover" ) {
|
||||||
my $sin = sockaddr_in(5224, inet_aton('255.255.255.255'));
|
harmony_sendDiscovery();
|
||||||
$hash->{sendSocket}->send( "_logitech-reverse-bonjour._tcp.local.\n$hash->{PORT}", 0, $sin );
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user