diff --git a/controls_NukiSmart.txt b/controls_NukiSmart.txt index bb62667..0d0665b 100644 --- a/controls_NukiSmart.txt +++ b/controls_NukiSmart.txt @@ -1,4 +1,4 @@ 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_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 diff --git a/lib/FHEM/Devices/Nuki/Bridge.pm b/lib/FHEM/Devices/Nuki/Bridge.pm index 32c24cb..9980924 100644 --- a/lib/FHEM/Devices/Nuki/Bridge.pm +++ b/lib/FHEM/Devices/Nuki/Bridge.pm @@ -411,6 +411,8 @@ sub Set { my $arg = shift // ''; my $endpoint; + my $param; + if ( lc($cmd) eq 'getdevicelist' ) { return 'usage: getDeviceList' if ($arg); @@ -441,21 +443,25 @@ sub Set { return 'usage: callbackRemove' if ( split( m{\s+}xms, $arg ) > 1 ); 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 . '"}' ) - if ( !::IsDisabled($name) ); - - return; + my $configAuth = 'enable=' . ($arg eq 'enable' ? 1 : 0); + $endpoint = 'configAuth'; + $param = '{"param":"' . $configAuth . '"}'; } else { my $list = ''; $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' ); return ( 'Unknown argument ' . $cmd . ', choose one of ' . $list ); } - Write( $hash, $endpoint, undef ) + Write( $hash, $endpoint, $param ) if ( !::IsDisabled($name) ); return; @@ -596,6 +602,10 @@ sub CreateUri { if ( $endpoint ne 'callback/add' && $deviceType == 2 ); } + + $uri .= '&' . $param + if ( defined($param) + && $endpoint eq 'configAuth' ); $uri .= '&id=' . $param if ( defined($param)