From 6df3887b6ffdca9b3b5b73a5e6f7fbae18f615cd Mon Sep 17 00:00:00 2001 From: tupol <> Date: Sun, 19 Nov 2017 12:29:20 +0000 Subject: [PATCH] FRITZBOX: fixed: Delete->Passwd, socket->no connection git-svn-id: https://svn.fhem.de/fhem/trunk@15454 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/FHEM/72_FRITZBOX.pm | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/fhem/FHEM/72_FRITZBOX.pm b/fhem/FHEM/72_FRITZBOX.pm index bf4a95100..0c0f74de5 100644 --- a/fhem/FHEM/72_FRITZBOX.pm +++ b/fhem/FHEM/72_FRITZBOX.pm @@ -174,6 +174,7 @@ sub FRITZBOX_Initialize($) $hash->{DefFn} = "FRITZBOX_Define"; $hash->{UndefFn} = "FRITZBOX_Undefine"; + $hash->{DeleteFn} = "FRITZBOX_Delete"; $hash->{SetFn} = "FRITZBOX_Set"; $hash->{GetFn} = "FRITZBOX_Get"; @@ -273,6 +274,17 @@ sub FRITZBOX_Undefine($$) return undef; } # end FRITZBOX_Undefine +####################################################################### +sub FRITZBOX_Delete ($$) +{ + my ( $hash, $name ) = @_; + + my $index = $hash->{TYPE}."_".$name."_passwd"; + setKeyValue($index, undef); + + return undef; +} + ####################################################################### sub FRITZBOX_Attr($@) { @@ -800,8 +812,9 @@ sub FRITZBOX_API_Check_Run($) # Getting IP of FHEM host FRITZBOX_Log $hash, 4, "Try to get my IP address."; my $socket = IO::Socket::INET->new( Proto => 'tcp', PeerAddr => $host, PeerPort => 'http(80)' ); - my $ip = $socket->sockhost; #A side-effect of making a socket connection is that our IP address is available from the 'sockhost' method - FRITZBOX_Log $hash, 4, "Could not determine my ip address" unless $ip; + my $ip; + $ip = $socket->sockhost if $socket; #A side-effect of making a socket connection is that our IP address is available from the 'sockhost' method + FRITZBOX_Log $hash, 4, "Could not determine my ip address" unless $ip; # Get a web port my $port; FRITZBOX_Log $hash, 4, "Try to get a FHEMWEB port.";