From a20833894d37ba5397641fe10c5449ddc8e34480 Mon Sep 17 00:00:00 2001 From: tpoitzsch Date: Sat, 7 Feb 2015 17:03:28 +0000 Subject: [PATCH] FRITZBOX: Better debugging git-svn-id: svn://svn.code.sf.net/p/fhem/code/trunk@7905 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/FHEM/72_FRITZBOX.pm | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/fhem/FHEM/72_FRITZBOX.pm b/fhem/FHEM/72_FRITZBOX.pm index 21d35e4a7..443a657e4 100644 --- a/fhem/FHEM/72_FRITZBOX.pm +++ b/fhem/FHEM/72_FRITZBOX.pm @@ -691,6 +691,8 @@ sub FRITZBOX_Readout_Run($) # Execute commands $resultArray = FRITZBOX_Readout_Query( $hash, \@readoutCmdArray, \@readoutReadings); + return "$name|Error|No STDOUT from shell command." unless defined $resultArray; + my $dectCount = $resultArray->[1]; $dectCount = 0 unless $dectCount=~ /\d/; my $radioCount = $resultArray->[2]; @@ -1053,18 +1055,21 @@ sub FRITZBOX_Readout_Query($$$) } my $resultArray = FRITZBOX_Exec( $hash, \@cmdArray); - $count = int @{$resultArray} -1; - for (0..$count) + if (defined ($resultArray)) { - $rValue = $resultArray->[$_]; - $rFormat = $readoutCmdArray->[$_][2]; - $rFormat = "" unless defined $rFormat; - $rValue = FRITZBOX_Readout_Format ($hash, $rFormat, $rValue); - $rName = $readoutCmdArray->[$_][0]; - if ($rName ne "") + $count = int @{$resultArray} -1; + for (0..$count) { - FRITZBOX_Log $hash, 5, "$rName: $rValue"; - push @{$readoutReadings}, $rName."|".$rValue; + $rValue = $resultArray->[$_]; + $rFormat = $readoutCmdArray->[$_][2]; + $rFormat = "" unless defined $rFormat; + $rValue = FRITZBOX_Readout_Format ($hash, $rFormat, $rValue); + $rName = $readoutCmdArray->[$_][0]; + if ($rName ne "") + { + FRITZBOX_Log $hash, 5, "$rName: $rValue"; + push @{$readoutReadings}, $rName."|".$rValue; + } } } @{$readoutCmdArray} = ();