From 30d962ef34c7facd2185600689b7bfb343153f2c Mon Sep 17 00:00:00 2001 From: Sebastian Date: Fri, 2 Apr 2021 14:43:44 +0200 Subject: [PATCH] fix url --- FHEM/73_GardenaSmartBridge.pm | 30 ++++++++++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) diff --git a/FHEM/73_GardenaSmartBridge.pm b/FHEM/73_GardenaSmartBridge.pm index df2978b..1d8ead9 100644 --- a/FHEM/73_GardenaSmartBridge.pm +++ b/FHEM/73_GardenaSmartBridge.pm @@ -425,6 +425,11 @@ sub Set { StorePassword( $hash, $name, $aArg->[0] ); } + elsif ( lc $cmd eq 'debug_devices_list' ) { + $hash->{helper}{debug_device_list} = 'set'; + Log3 $name, 2, Dumper($hash->{helper}); + Write($hash, undef, undef, undef, undef); + } elsif ( lc $cmd eq 'deleteaccountpassword' ) { return "usage: $cmd" if ( scalar( @{$aArg} ) != 0 ); @@ -438,6 +443,8 @@ sub Set { if ( not defined( ReadPassword( $hash, $name ) ) ); $list .= " deleteAccountPassword:noArg" if ( defined( ReadPassword( $hash, $name ) ) ); + #$list .= " debug_devices_list:noArg" + # if ( AttrVal( $name, "debugJSON", "none") ne "none" ); return "Unknown argument $cmd, choose one of $list"; } @@ -749,6 +756,25 @@ sub ResponseProcessing { return; } + elsif ( defined($hash->{helper}{debug_device_list} ) ) + { + Log3 $name, 4, "Debug Devices List"; + my $msg; + $msg = "test krams"; + + my @buffer = split( '"devices":\[', $json ); + my ( $json, $tail ) = ParseJSON( $hash, $buffer[1] ); + $decode_json = eval { decode_json($json) }; + while ( ( my ( $t, $v ) ) = each %{ $decode_json} ) + { + + Log3 $name, 2, "DEBUG $t und $v"; + + } + + undef($hash->{helper}{debug_device_list}); + return $msg; + } elsif (defined( $decode_json->{devices} ) && ref( $decode_json->{devices} ) eq 'ARRAY' && scalar( @{ $decode_json->{devices} } ) > 0 ) @@ -1153,7 +1179,7 @@ sub createHttpValueStrings { if ( $payload eq '{}' ) { $method = 'GET'; $payload = ''; - $uri .= '/locations/?locatioId=null&user_id=' . $hash->{helper}{user_id} + $uri .= '/locations?locatioId=null&user_id=' . $hash->{helper}{user_id} if ( exists( $hash->{helper}{user_id} ) && !defined( $hash->{helper}{locations_id} ) ); readingsSingleUpdate( $hash, 'state', 'fetch locationId', 1 ) @@ -1164,7 +1190,7 @@ sub createHttpValueStrings { && defined( $hash->{helper}{locations_id} ) ); } - $uri .= '/auth/token' if ( !defined( $hash->{helper}{session_id} ) ); + $uri = '/auth/token' if ( !defined( $hash->{helper}{session_id} ) ); if ( defined( $hash->{helper}{locations_id} ) ) { if ( defined($abilities) && $abilities eq 'mower_settings' ) {