From b49f7e3f56325a5ed76cdace07551d998b424fe0 Mon Sep 17 00:00:00 2001 From: markusbloch Date: Tue, 14 May 2013 16:47:09 +0000 Subject: [PATCH] minor logging optimizations for mode fritzbox git-svn-id: https://svn.fhem.de/fhem/trunk@3178 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/FHEM/73_PRESENCE.pm | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/fhem/FHEM/73_PRESENCE.pm b/fhem/FHEM/73_PRESENCE.pm index 45e09eacc..356435fdf 100755 --- a/fhem/FHEM/73_PRESENCE.pm +++ b/fhem/FHEM/73_PRESENCE.pm @@ -567,6 +567,11 @@ PRESENCE_DoLocalFritzBoxScan($) { Log GetLogLevel($name, 5), "PRESENCE ($name) - checking with cached number the $check_command state ($number)"; $status = qx(/usr/bin/ctlmgr_ctl r landevice settings/landevice$number/$check_command); + + chomp $status; + + Log GetLogLevel($name, 5), "PRESENCE ($name) - ctlmgr_ctl (cached: $number) returned: $status"; + if(not $status =~ /^\s*\d+\s*$/) { return "$name|$local|error|could not execute ctlmgr_ctl (cached)"; @@ -583,6 +588,8 @@ PRESENCE_DoLocalFritzBoxScan($) chomp $max; + Log GetLogLevel($name, 5), "PRESENCE ($name) - ctlmgr_ctl (getting device count) returned: $max"; + if(not $max =~ /^\s*\d+\s*$/) { return "$name|$local|error|could not execute ctlmgr_ctl"; @@ -605,6 +612,8 @@ PRESENCE_DoLocalFritzBoxScan($) { $status=qx(/usr/bin/ctlmgr_ctl r landevice settings/landevice$number/$check_command); + chomp $status; + Log GetLogLevel($name, 5), "PRESENCE ($name) - $check_command for device number $net_device is $status"; last; } @@ -612,8 +621,6 @@ PRESENCE_DoLocalFritzBoxScan($) $number++; sleep 0.2; } - - chomp $status; return ($status == 0 ? "$name|$local|absent" : "$name|$local|present").($number <= $max ? "|$number" : ""); }