add configAuth option enable/disable publication of the local IP and
port via discovery URL
This commit is contained in:
		@@ -1,4 +1,4 @@
 | 
				
			|||||||
UPD 2021-11-27_22:52:03 9217 FHEM/73_NUKIBridge.pm
 | 
					UPD 2021-11-27_22:52:03 9217 FHEM/73_NUKIBridge.pm
 | 
				
			||||||
UPD 2021-11-27_21:36:27 7569 FHEM/74_NUKIDevice.pm
 | 
					UPD 2021-11-27_21:36:27 7569 FHEM/74_NUKIDevice.pm
 | 
				
			||||||
UPD 2021-11-27_22:52:20 40367 lib/FHEM/Devices/Nuki/Bridge.pm
 | 
					UPD 2021-11-27_23:33:54 40749 lib/FHEM/Devices/Nuki/Bridge.pm
 | 
				
			||||||
UPD 2021-11-27_22:56:00 15826 lib/FHEM/Devices/Nuki/Device.pm
 | 
					UPD 2021-11-27_22:56:00 15826 lib/FHEM/Devices/Nuki/Device.pm
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -411,6 +411,8 @@ sub Set {
 | 
				
			|||||||
    my $arg  = shift // '';
 | 
					    my $arg  = shift // '';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    my $endpoint;
 | 
					    my $endpoint;
 | 
				
			||||||
 | 
					    my $param;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if ( lc($cmd) eq 'getdevicelist' ) {
 | 
					    if ( lc($cmd) eq 'getdevicelist' ) {
 | 
				
			||||||
        return 'usage: getDeviceList' if ($arg);
 | 
					        return 'usage: getDeviceList' if ($arg);
 | 
				
			||||||
@@ -441,21 +443,25 @@ sub Set {
 | 
				
			|||||||
        return 'usage: callbackRemove' if ( split( m{\s+}xms, $arg ) > 1 );
 | 
					        return 'usage: callbackRemove' if ( split( m{\s+}xms, $arg ) > 1 );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        my $id = ( defined($arg) ? $arg : 0 );
 | 
					        my $id = ( defined($arg) ? $arg : 0 );
 | 
				
			||||||
 | 
					        $endpoint   = 'callback/remove';
 | 
				
			||||||
 | 
					        $param      = '{"param":"' . $id . '"}';
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    elsif ( lc($cmd) eq 'configauth' ) {
 | 
				
			||||||
 | 
					        return 'usage: configAuth' if ( split( m{\s+}xms, $arg ) > 1 );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        Write( $hash, 'callback/remove', '{"param":"' . $id . '"}' )
 | 
					        my $configAuth = 'enable=' . ($arg eq 'enable' ? 1 : 0);
 | 
				
			||||||
          if ( !::IsDisabled($name) );
 | 
					        $endpoint   = 'configAuth';
 | 
				
			||||||
 | 
					        $param      = '{"param":"' . $configAuth . '"}';
 | 
				
			||||||
        return;
 | 
					 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    else {
 | 
					    else {
 | 
				
			||||||
        my $list = '';
 | 
					        my $list = '';
 | 
				
			||||||
        $list .= 'info:noArg getDeviceList:noArg ';
 | 
					        $list .= 'info:noArg getDeviceList:noArg ';
 | 
				
			||||||
        $list .= 'clearLog:noArg fwUpdate:noArg reboot:noArg factoryReset:noArg'
 | 
					        $list .= 'clearLog:noArg fwUpdate:noArg reboot:noArg factoryReset:noArg configAuth:enable,disable'
 | 
				
			||||||
          if ( ::ReadingsVal( $name, 'bridgeType', 'Software' ) eq 'Hardware' );
 | 
					          if ( ::ReadingsVal( $name, 'bridgeType', 'Software' ) eq 'Hardware' );
 | 
				
			||||||
        return ( 'Unknown argument ' . $cmd . ', choose one of ' . $list );
 | 
					        return ( 'Unknown argument ' . $cmd . ', choose one of ' . $list );
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    Write( $hash, $endpoint, undef )
 | 
					    Write( $hash, $endpoint, $param )
 | 
				
			||||||
      if ( !::IsDisabled($name) );
 | 
					      if ( !::IsDisabled($name) );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return;
 | 
					    return;
 | 
				
			||||||
@@ -597,6 +603,10 @@ sub CreateUri {
 | 
				
			|||||||
            && $deviceType == 2 );
 | 
					            && $deviceType == 2 );
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
 | 
					    $uri .= '&' . $param
 | 
				
			||||||
 | 
					      if ( defined($param)
 | 
				
			||||||
 | 
					        && $endpoint eq 'configAuth' );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    $uri .= '&id=' . $param
 | 
					    $uri .= '&id=' . $param
 | 
				
			||||||
      if ( defined($param)
 | 
					      if ( defined($param)
 | 
				
			||||||
        && $endpoint eq 'callback/remove' );
 | 
					        && $endpoint eq 'callback/remove' );
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user