From a6dbf072f985a4dc56c6b6ca478d9658557a2bcc Mon Sep 17 00:00:00 2001 From: markusbloch Date: Mon, 25 Feb 2013 22:21:44 +0000 Subject: [PATCH] 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 --- FHEM/73_PRESENCE.pm | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/FHEM/73_PRESENCE.pm b/FHEM/73_PRESENCE.pm index 73754da05..c9727596c 100755 --- a/FHEM/73_PRESENCE.pm +++ b/FHEM/73_PRESENCE.pm @@ -415,6 +415,9 @@ PRESENCE_DoLocalPingScan($) if($pingtool) { $retcode = $pingtool->ping($device, 5); + + Log GetLogLevel($name, 5), "PRESENCE ($name) - pingtool returned $retcode"; + $return = "$name|$local|".($retcode ? "present" : "absent"); } else @@ -426,7 +429,9 @@ PRESENCE_DoLocalPingScan($) else { $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; @@ -456,6 +461,7 @@ PRESENCE_DoLocalFritzBoxScan($) # only use the cached $number if it has still the correct device name 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); if(not $status =~ /^\s*\d+\s*$/) { @@ -463,6 +469,10 @@ PRESENCE_DoLocalFritzBoxScan($) } 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); @@ -486,9 +496,12 @@ PRESENCE_DoLocalFritzBoxScan($) chomp $net_device; + Log GetLogLevel($name, 5), "PRESENCE ($name) - checking device number $number ($net_device)"; if($net_device eq $device) { $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; }