better error handling

This commit is contained in:
Marko Oldenburg 2017-09-30 21:21:41 +02:00
parent c0a29603f4
commit b595ec3e2b

View File

@ -46,7 +46,7 @@ use JSON;
use Blocking; use Blocking;
my $version = "1.1.46"; my $version = "1.1.47";
my %readings = (); my %readings = ();
my %CallBatteryFirmwareAge = ( '8h' => 28800, my %CallBatteryFirmwareAge = ( '8h' => 28800,
'16h' => 57600, '16h' => 57600,
@ -392,7 +392,7 @@ sub XiaomiFlowerSens_ExecGatttool_Run($) {
Log3 $name, 4, "XiaomiFlowerSens ($name) - ExecGatttool_Run: gatttool result ".join(",", @gtResult); Log3 $name, 4, "XiaomiFlowerSens ($name) - ExecGatttool_Run: gatttool result ".join(",", @gtResult);
$gtResult[1] = 'none' $gtResult[1] = 'none response data'
unless( defined($gtResult[1]) ); unless( defined($gtResult[1]) );
my $json_notification = XiaomiFlowerSens_encodeJSON($gtResult[1]); my $json_notification = XiaomiFlowerSens_encodeJSON($gtResult[1]);
@ -428,10 +428,10 @@ sub XiaomiFlowerSens_ExecGatttool_Done($) {
} }
XiaomiFlowerSens_ProcessingNotification($hash,$handle,$decode_json->{gtResult}) XiaomiFlowerSens_ProcessingNotification($hash,$handle,$decode_json->{gtResult})
if( $respstate eq 'ok' and $gattCmd eq 'read' and $decode_json->{gtResult} ne 'none' ); if( $respstate eq 'ok' and $gattCmd eq 'read' and $decode_json->{gtResult} ne 'none response data' );
XiaomiFlowerSens_ProcessingErrors($hash,$decode_json->{gtResult}) XiaomiFlowerSens_ProcessingErrors($hash,$decode_json->{gtResult})
if( ($respstate eq 'error') or ($respstate eq 'ok' and $decode_json->{gtResult} eq 'none' and $gattCmd eq 'read') ); if( ($respstate eq 'error') or ($respstate eq 'ok' and $decode_json->{gtResult} eq 'none response data' and $gattCmd eq 'read') );
XiaomiFlowerSens_CallSensData($hash) XiaomiFlowerSens_CallSensData($hash)
unless( $gattCmd eq 'read' ); unless( $gattCmd eq 'read' );