make ping regexp less restrictive, added detailed debugging log for fritzbox-checks
git-svn-id: https://fhem.svn.sourceforge.net/svnroot/fhem/trunk/fhem@2814 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
@@ -415,6 +415,9 @@ PRESENCE_DoLocalPingScan($)
|
|||||||
if($pingtool)
|
if($pingtool)
|
||||||
{
|
{
|
||||||
$retcode = $pingtool->ping($device, 5);
|
$retcode = $pingtool->ping($device, 5);
|
||||||
|
|
||||||
|
Log GetLogLevel($name, 5), "PRESENCE ($name) - pingtool returned $retcode";
|
||||||
|
|
||||||
$return = "$name|$local|".($retcode ? "present" : "absent");
|
$return = "$name|$local|".($retcode ? "present" : "absent");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -426,7 +429,9 @@ PRESENCE_DoLocalPingScan($)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
$temp = qx(ping -c 4 $device);
|
$temp = qx(ping -c 4 $device);
|
||||||
$return = "$name|$local|".($temp =~ /\d+ bytes from/ ? "present" : "absent");
|
|
||||||
|
Log GetLogLevel($name, 5), "PRESENCE ($name) - ping command returned with output:\n$temp";
|
||||||
|
$return = "$name|$local|".($temp =~ /\d+ [Bb]ytes (from|von)/ ? "present" : "absent");
|
||||||
}
|
}
|
||||||
|
|
||||||
return $return;
|
return $return;
|
||||||
@@ -456,6 +461,7 @@ PRESENCE_DoLocalFritzBoxScan($)
|
|||||||
# only use the cached $number if it has still the correct device name
|
# only use the cached $number if it has still the correct device name
|
||||||
if($cached_name eq $device)
|
if($cached_name eq $device)
|
||||||
{
|
{
|
||||||
|
Log GetLogLevel($name, 5), "PRESENCE ($name) - checking with cached number ($number)";
|
||||||
$status = qx(/usr/bin/ctlmgr_ctl r landevice settings/landevice$number/speed);
|
$status = qx(/usr/bin/ctlmgr_ctl r landevice settings/landevice$number/speed);
|
||||||
if(not $status =~ /^\s*\d+\s*$/)
|
if(not $status =~ /^\s*\d+\s*$/)
|
||||||
{
|
{
|
||||||
@@ -463,6 +469,10 @@ PRESENCE_DoLocalFritzBoxScan($)
|
|||||||
}
|
}
|
||||||
return ($status == 0)? "$name|$local|absent|$number" : "$name|$local|present|$number"; ###MH
|
return ($status == 0)? "$name|$local|absent|$number" : "$name|$local|present|$number"; ###MH
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Log GetLogLevel($name, 5), "PRESENCE ($name) - cached device name ($cached_name) does not match expected name ($device). perform a full scan";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
my $max = qx(/usr/bin/ctlmgr_ctl r landevice settings/landevice/count);
|
my $max = qx(/usr/bin/ctlmgr_ctl r landevice settings/landevice/count);
|
||||||
@@ -486,9 +496,12 @@ PRESENCE_DoLocalFritzBoxScan($)
|
|||||||
|
|
||||||
chomp $net_device;
|
chomp $net_device;
|
||||||
|
|
||||||
|
Log GetLogLevel($name, 5), "PRESENCE ($name) - checking device number $number ($net_device)";
|
||||||
if($net_device eq $device)
|
if($net_device eq $device)
|
||||||
{
|
{
|
||||||
$status=qx(/usr/bin/ctlmgr_ctl r landevice settings/landevice$number/speed);
|
$status=qx(/usr/bin/ctlmgr_ctl r landevice settings/landevice$number/speed);
|
||||||
|
|
||||||
|
Log GetLogLevel($name, 5), "PRESENCE ($name) - speed for device number $net_device is $status";
|
||||||
last;
|
last;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user