From 5b1a0461f5fc83f463b610cd4cb0acd7fddcbe92 Mon Sep 17 00:00:00 2001 From: markusbloch Date: Sun, 18 Aug 2013 11:54:05 +0000 Subject: [PATCH] PRESENCE: recognize execution failure of ping-check git-svn-id: svn://svn.code.sf.net/p/fhem/code/trunk@3736 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/FHEM/73_PRESENCE.pm | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/fhem/FHEM/73_PRESENCE.pm b/fhem/FHEM/73_PRESENCE.pm index e441e0a4e..0163a3f54 100755 --- a/fhem/FHEM/73_PRESENCE.pm +++ b/fhem/FHEM/73_PRESENCE.pm @@ -533,10 +533,18 @@ PRESENCE_DoLocalPingScan($) } else { - $temp = qx(ping -c $count $device); - - Log3 $name, 5, "PRESENCE ($name) - ping command returned with output:\n$temp"; - $return = "$name|$local|".($temp =~ /\d+ [Bb]ytes (from|von)/ ? "present" : "absent"); + $temp = qx(ping -c $count $device); + + chomp $temp; + if($temp ne "") + { + Log3 $name, 5, "PRESENCE ($name) - ping command returned with output:\n$temp"; + $return = "$name|$local|".($temp =~ /\d+ [Bb]ytes (from|von)/ ? "present" : "absent"); + } + else + { + $return = "$name|$local|error|Could not execute ping command: \"ping -c $count $device\""; + } } return $return;