From b595ec3e2bd8ed1a491e6f731881f7aa2926e65a Mon Sep 17 00:00:00 2001 From: Marko Oldenburg Date: Sat, 30 Sep 2017 21:21:41 +0200 Subject: [PATCH] better error handling --- 74_XiaomiFlowerSens.pm | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/74_XiaomiFlowerSens.pm b/74_XiaomiFlowerSens.pm index 39a8a71..386f878 100644 --- a/74_XiaomiFlowerSens.pm +++ b/74_XiaomiFlowerSens.pm @@ -46,7 +46,7 @@ use JSON; use Blocking; -my $version = "1.1.46"; +my $version = "1.1.47"; my %readings = (); my %CallBatteryFirmwareAge = ( '8h' => 28800, '16h' => 57600, @@ -392,7 +392,7 @@ sub XiaomiFlowerSens_ExecGatttool_Run($) { Log3 $name, 4, "XiaomiFlowerSens ($name) - ExecGatttool_Run: gatttool result ".join(",", @gtResult); - $gtResult[1] = 'none' + $gtResult[1] = 'none response data' unless( defined($gtResult[1]) ); my $json_notification = XiaomiFlowerSens_encodeJSON($gtResult[1]); @@ -428,10 +428,10 @@ sub XiaomiFlowerSens_ExecGatttool_Done($) { } 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}) - 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) unless( $gattCmd eq 'read' );