ready for release #46
@@ -63,7 +63,7 @@ use warnings;
 | 
				
			|||||||
use POSIX;
 | 
					use POSIX;
 | 
				
			||||||
use FHEM::Meta;
 | 
					use FHEM::Meta;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#use Data::Dumper;
 | 
					use Data::Dumper;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
use HttpUtils;
 | 
					use HttpUtils;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -343,7 +343,7 @@ sub Notify {
 | 
				
			|||||||
    my $devtype = $dev->{TYPE};
 | 
					    my $devtype = $dev->{TYPE};
 | 
				
			||||||
    my $events  = deviceEvents( $dev, 1 );
 | 
					    my $events  = deviceEvents( $dev, 1 );
 | 
				
			||||||
    return if ( !$events );
 | 
					    return if ( !$events );
 | 
				
			||||||
Log3 $name, 1 , "AWAW: $devtype";
 | 
					    
 | 
				
			||||||
    getToken($hash)
 | 
					    getToken($hash)
 | 
				
			||||||
      if (
 | 
					      if (
 | 
				
			||||||
        (
 | 
					        (
 | 
				
			||||||
@@ -375,7 +375,6 @@ Log3 $name, 1 , "AWAW: $devtype";
 | 
				
			|||||||
            grep /^ATTR.$name.disable.0$/,
 | 
					            grep /^ATTR.$name.disable.0$/,
 | 
				
			||||||
            @{$events} or grep /^DELETEATTR.$name.interval$/,
 | 
					            @{$events} or grep /^DELETEATTR.$name.interval$/,
 | 
				
			||||||
            @{$events} or grep /^ATTR.$name.interval.[0-9]+/,
 | 
					            @{$events} or grep /^ATTR.$name.interval.[0-9]+/,
 | 
				
			||||||
            @{$events} or grep /^DELETEATTR.$name.disable$/,
 | 
					 | 
				
			||||||
            @{$events}
 | 
					            @{$events}
 | 
				
			||||||
        )
 | 
					        )
 | 
				
			||||||
        && $init_done
 | 
					        && $init_done
 | 
				
			||||||
@@ -499,8 +498,8 @@ sub Write {
 | 
				
			|||||||
"GardenaSmartBridge ($name) - Send with URL: $hash->{URL}$uri, HEADER: secret!, DATA: secret!, METHOD: $method"
 | 
					"GardenaSmartBridge ($name) - Send with URL: $hash->{URL}$uri, HEADER: secret!, DATA: secret!, METHOD: $method"
 | 
				
			||||||
    );
 | 
					    );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    #  Log3($name, 3,
 | 
					      Log3($name, 3,
 | 
				
			||||||
    #      "GardenaSmartBridge ($name) - Send with URL: $hash->{URL}$uri, HEADER: $header, DATA: $payload, METHOD: $method");
 | 
					          "GardenaSmartBridge ($name) - Send with URL: $hash->{URL}$uri, HEADER: $header, DATA: $payload, METHOD: $method");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return;
 | 
					    return;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@@ -998,7 +997,9 @@ sub getDevices {
 | 
				
			|||||||
            defined( ReadPassword( $hash, $name ) ) 
 | 
					            defined( ReadPassword( $hash, $name ) ) 
 | 
				
			||||||
          )) 
 | 
					          )) 
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
 | 
					          Log3 $name, 2, "Dumpe BeFORE".Dumper($hash);
 | 
				
			||||||
          Write( $hash, undef, undef, undef );
 | 
					          Write( $hash, undef, undef, undef );
 | 
				
			||||||
 | 
					          Log3 $name, 2,  "Dumpe daNACH".Dumper($hash);
 | 
				
			||||||
        Log3 $name, 4,
 | 
					        Log3 $name, 4,
 | 
				
			||||||
          "GardenaSmartBridge ($name) - fetch device list and device states";
 | 
					          "GardenaSmartBridge ($name) - fetch device list and device states";
 | 
				
			||||||
        } # fi gardenaAccountEmail
 | 
					        } # fi gardenaAccountEmail
 | 
				
			||||||
@@ -1033,16 +1034,6 @@ sub getToken {
 | 
				
			|||||||
      if ( defined( $hash->{helper}{locations_id} )
 | 
					      if ( defined( $hash->{helper}{locations_id} )
 | 
				
			||||||
        && $hash->{helper}{locations_id} );
 | 
					        && $hash->{helper}{locations_id} );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    # Write(
 | 
					 | 
				
			||||||
    #     $hash,
 | 
					 | 
				
			||||||
    #     '"sessions": {"email": "'
 | 
					 | 
				
			||||||
    #       . AttrVal( $name, 'gardenaAccountEmail', 'none' )
 | 
					 | 
				
			||||||
    #       . '","password": "'
 | 
					 | 
				
			||||||
    #       . ReadPassword( $hash, $name ) . '"}',
 | 
					 | 
				
			||||||
    #     undef,
 | 
					 | 
				
			||||||
    #     undef
 | 
					 | 
				
			||||||
    # );
 | 
					 | 
				
			||||||
    
 | 
					 | 
				
			||||||
    Write(
 | 
					    Write(
 | 
				
			||||||
         $hash,
 | 
					         $hash,
 | 
				
			||||||
         '"data": {"type":"token", "attributes":{"username": "' 
 | 
					         '"data": {"type":"token", "attributes":{"username": "' 
 | 
				
			||||||
@@ -1053,8 +1044,9 @@ sub getToken {
 | 
				
			|||||||
         undef
 | 
					         undef
 | 
				
			||||||
     );
 | 
					     );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Log3 $name, 4, '"data": {"type":"token", "attributes":{"username": "'      . AttrVal( $name, 'gardenaAccountEmail', 'none' )      . '","password": "'
 | 
					    Log3 $name, 4, '"data": {"type":"token", "attributes":{"username": "'     
 | 
				
			||||||
          . ReadPassword( $hash, $name ) . '", "client_id":"smartgarden-jwt-client"}}';
 | 
					               .AttrVal( $name, 'gardenaAccountEmail', 'none' ) . '","password": "'
 | 
				
			||||||
 | 
					               .ReadPassword( $hash, $name ) . '", "client_id":"smartgarden-jwt-client"}}';
 | 
				
			||||||
    Log3 $name, 3,
 | 
					    Log3 $name, 3,
 | 
				
			||||||
"GardenaSmartBridge ($name) - send credentials to fetch Token and locationId";
 | 
					"GardenaSmartBridge ($name) - send credentials to fetch Token and locationId";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -1226,7 +1218,8 @@ sub createHttpValueStrings {
 | 
				
			|||||||
          if ( exists( $hash->{helper}{user_id} )
 | 
					          if ( exists( $hash->{helper}{user_id} )
 | 
				
			||||||
            && !defined( $hash->{helper}{locations_id} ) );
 | 
					            && !defined( $hash->{helper}{locations_id} ) );
 | 
				
			||||||
        readingsSingleUpdate( $hash, 'state', 'fetch locationId', 1 )
 | 
					        readingsSingleUpdate( $hash, 'state', 'fetch locationId', 1 )
 | 
				
			||||||
          if ( !defined( $hash->{helper}{locations_id} ) );
 | 
					          if ( exists( $hash->{helper}{user_id} )
 | 
				
			||||||
 | 
					            && !defined( $hash->{helper}{locations_id} ) );
 | 
				
			||||||
        $uri .= '/devices'
 | 
					        $uri .= '/devices'
 | 
				
			||||||
          if (!defined($abilities)
 | 
					          if (!defined($abilities)
 | 
				
			||||||
            && defined( $hash->{helper}{locations_id} ) );
 | 
					            && defined( $hash->{helper}{locations_id} ) );
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,2 +1,2 @@
 | 
				
			|||||||
UPD 2021-06-11_19:05:32 47194 FHEM/73_GardenaSmartBridge.pm
 | 
					UPD 2021-06-16_10:11:03 47021 FHEM/73_GardenaSmartBridge.pm
 | 
				
			||||||
UPD 2021-06-09_09:52:26 55505 FHEM/74_GardenaSmartDevice.pm
 | 
					UPD 2021-06-09_09:52:26 55505 FHEM/74_GardenaSmartDevice.pm
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user