2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-04-26 10:15:48 +00:00

70_Pushbullet.pm: improved logging

git-svn-id: https://svn.fhem.de/fhem/trunk@8033 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
fhainz 2015-02-18 18:57:11 +00:00
parent d3ec4dc5d9
commit 4db81093c1

View File

@ -424,13 +424,15 @@ sub Pushbullet_getDeviceIden($$){
while( ($nkey, $nvalue) = each%{$hash->{READINGS}} ){
while( ($rkey, $rvalue) = each%{$hash->{READINGS}{$nkey}} ){
Log3 $hash, 4, $name . ": nkey:" . $nkey . " nvalue:" . $nvalue . " rkey:" . $rkey . " rvalue:" . $rvalue if( $rvalue eq $deviceNick );
Log3 $hash, 5, $name . ": nkey:" . $nkey . " nvalue:" . $nvalue . " rkey:" . $rkey . " rvalue:" . $rvalue if( $rvalue eq $deviceNick );
$deviceIden = $nkey if( $rvalue eq $deviceNick );
}
}
Log3 $hash, 3, "$name: deviceIden konnte nicht eingelesen werden." if( !$deviceIden );
return if( !defined($deviceIden) );
if( !$deviceIden ){
Log3 $hash, 3, "$name: Can not read deviceIden from $deviceNick.";
return;
}
@deviceIdenSplit = split( /_name/, $deviceIden );
$deviceIden = $deviceIdenSplit[0];
@ -444,26 +446,24 @@ sub Pushbullet_httpCall($$$$){
my ($hash,$url,$jsonHash,$method) = @_;
my ($json,$err,$data,$decoded);
my $name = $hash->{NAME};
Log3 $hash, 5,"HASH: " . Dumper($jsonHash);
$json = JSON->new->latin1->encode($jsonHash) if( $jsonHash );
$json = JSON->new->latin1->encode($jsonHash) if( $jsonHash );
($err,$data) = HttpUtils_BlockingGet({
url => $url,
method => $method,
header => "Content-Type: application/json",
data => $json
});
Log3 $hash, 4, "JSON -> Pushbullet:" . Dumper($json);
Log3 $hash, 4, "Pushbullet -> FHEM: " . Dumper($data);
});
$data = "" if( !$data );
$json = "" if( !$json );
$data = "" if( !$data );
Log3 $hash, 4, "FHEM -> Pushbullet.com: " . $json;
Log3 $hash, 4, "Pushbullet.com -> FHEM: " . $data;
Log3 $hash, 5, '$err: ' . $err;
Log3 $hash, 5, '$method: ' . $method;
Log3 $hash, 5, '$url: ' . $url;
Log3 $hash, 5, '$data: ' . $data;
Log3 $hash, 3, "Something gone wrong" if( $data =~ "<!DOCTYPE html>" );
$err = 1 if( $data =~ "<!DOCTYPE html>" );