2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-04-07 19:04:20 +00:00

FRITZBOX: fixed: Delete->Passwd, socket->no connection

git-svn-id: https://svn.fhem.de/fhem/trunk@15454 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
tupol 2017-11-19 12:29:20 +00:00
parent 7edadd5f7b
commit 6df3887b6f

View File

@ -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.";