diff --git a/FHEM/73_GardenaSmartBridge.pm b/FHEM/73_GardenaSmartBridge.pm index a161d5b..fa9134d 100644 --- a/FHEM/73_GardenaSmartBridge.pm +++ b/FHEM/73_GardenaSmartBridge.pm @@ -62,7 +62,7 @@ use warnings; use POSIX; use FHEM::Meta; -#use Data::Dumper; +use Data::Dumper; use HttpUtils; @@ -923,21 +923,28 @@ qq{GardenaSmartBridge ($name) - got result from asynchronous parsing} CleanSubprocess($hash); - for my $json ( @{$response} ) { + if ( ref( @{$response} ) eq 'ARRAY' ) { + for my $json ( @{$response} ) { - ################# - $decode_json = eval { decode_json($json) }; - if ($@) { - Log3 $name, 5, + ################# + $decode_json = eval { decode_json($json) }; + if ($@) { + Log3 $name, 5, "GardenaSmartBridge ($name) - JSON error while request: $@"; - } + } - Dispatch( $hash, $json, undef ) - if ( $decode_json->{category} ne 'gateway' ); - WriteReadings( $hash, $decode_json ) - if ( defined( $decode_json->{category} ) - && $decode_json->{category} eq 'gateway' ); + Dispatch( $hash, $json, undef ) + if ( $decode_json->{category} ne 'gateway' ); + WriteReadings( $hash, $decode_json ) + if ( defined( $decode_json->{category} ) + && $decode_json->{category} eq 'gateway' ); + } } + + Log3 $name, 3, +"GardenaSmartBridge ($name) - It looks like so is no Array reference at response"; + Log3 $name, 3, + "GardenaSmartBridge ($name) - Response ist: " . Dumper $response; } } } @@ -949,19 +956,19 @@ qq{GardenaSmartBridge ($name) - got result from asynchronous parsing} sub ResponseSubprocessing { my $subprocess = shift; my $buffer = $subprocess->{buffer}; - my $response = []; + my @response = (); my ( $json, $tail ) = ParseJSON($buffer); while ($json) { if ( defined($tail) and $tail ) { - push @{$response}, $json; + push @response, $json; } ( $json, $tail ) = ParseJSON($tail); } - $subprocess->writeToParent($response); + $subprocess->writeToParent( \@response ); return; } diff --git a/controls_GardenaSmartDevice.txt b/controls_GardenaSmartDevice.txt index 2b02a72..f791c4a 100644 --- a/controls_GardenaSmartDevice.txt +++ b/controls_GardenaSmartDevice.txt @@ -1,2 +1,2 @@ -UPD 2022-02-01_09:23:35 49566 FHEM/73_GardenaSmartBridge.pm +UPD 2022-02-01_09:54:04 49897 FHEM/73_GardenaSmartBridge.pm UPD 2022-01-31_19:35:42 56993 FHEM/74_GardenaSmartDevice.pm