2 Commits

Author SHA1 Message Date
728319d81e Refactor command handler return logic for clarity
Improved the command handler functions within the Nuki Bridge module
by standardizing return statements for consistency. Each command now
immediately returns after assigning its respective endpoint, ensuring
clearer control flow. This change simplifies the readability of the
code and ensures that all command handlers consistently exit without
proceeding further when their conditions are met.

Additionally, unnecessary checks for the endpoint were removed,
streamlining the handling of responses. These adjustments should help
reduce confusion and make future modifications easier, without
introducing any breaking changes.
2025-10-16 19:50:36 +02:00
feb1e1fdd5 Update Nuki Bridge version and fix callback handling
Improved the Nuki Bridge module by updating the version to v2.1.1,
indicating a minor enhancement likely related to internal changes or
bug fixes.

Additionally, in the `Set` and `Get` methods, updated the return
conditions to exclude the endpoint from the results when it
matches the output from the command handlers. This change ensures
that the endpoint is not returned as part of the command
responses, which could lead to confusion and unintended behavior
for users interacting with the API.

These modifications enhance the clarity and reliability of the
responses provided by the Nuki Bridge API.
2025-10-16 18:36:58 +02:00
3 changed files with 19 additions and 7 deletions

View File

@@ -267,7 +267,7 @@ sub Initialize {
],
"release_status": "stable",
"license": "GPL_2",
"version": "v2.1.0",
"version": "v2.1.1",
"x_apiversion": "1.13.0",
"author": [
"Marko Oldenburg <leongaultier@gmail.com>"

View File

@@ -1,4 +1,4 @@
UPD 2025-10-14_11:00:54 10358 FHEM/73_NUKIBridge.pm
UPD 2025-10-15_06:53:37 11100 FHEM/74_NUKIDevice.pm
UPD 2025-10-14_11:00:54 42820 lib/FHEM/Devices/Nuki/Bridge.pm
UPD 2025-10-15_06:43:51 16775 lib/FHEM/Devices/Nuki/Device.pm
UPD 2025-10-16_18:43:02 10358 FHEM/73_NUKIBridge.pm
UPD 2025-10-15_06:55:14 11100 FHEM/74_NUKIDevice.pm
UPD 2025-10-16_19:50:02 43040 lib/FHEM/Devices/Nuki/Bridge.pm
UPD 2025-10-15_06:55:14 16775 lib/FHEM/Devices/Nuki/Device.pm

View File

@@ -429,26 +429,32 @@ sub Set {
getdevicelist => sub {
return 'usage: getDeviceList' if $arg;
$endpoint = 'list';
return;
},
info => sub {
return 'usage: info' if $arg;
$endpoint = 'info';
return;
},
fwupdate => sub {
return 'usage: fwUpdate' if $arg;
$endpoint = 'fwupdate';
return;
},
reboot => sub {
return 'usage: reboot' if $arg;
$endpoint = 'reboot';
return;
},
clearlog => sub {
return 'usage: clearLog' if $arg;
$endpoint = 'clearlog';
return;
},
factoryreset => sub {
return 'usage: factoryReset' if $arg;
$endpoint = 'factoryreset';
return;
},
callbackremove => sub {
return 'usage: callbackRemove'
@@ -456,6 +462,7 @@ sub Set {
my $id = defined $arg ? $arg : 0;
$endpoint = 'callback/remove';
$param = '{"param":"' . $id . '"}';
return;
},
configauth => sub {
return 'usage: configAuth'
@@ -463,12 +470,14 @@ sub Set {
my $configAuth = 'enable=' . ( $arg eq 'enable' ? 1 : 0 );
$endpoint = 'configAuth';
$param = '{"param":"' . $configAuth . '"}';
return;
},
);
if ( exists $handlers{$cmd} ) {
my $result = $handlers{$cmd}->();
return $result if defined $result && length $result;
return $result
if defined $result && length $result;
}
else {
my $list = 'info:noArg getDeviceList:noArg ';
@@ -498,16 +507,19 @@ sub Get {
logfile => sub {
return 'usage: logFile' if defined $arg;
$endpoint = 'log';
return;
},
callbacklist => sub {
return 'usage: callbackList' if defined $arg;
$endpoint = 'callback/list';
return;
},
);
if ( exists $handlers{$cmd} ) {
my $result = $handlers{$cmd}->();
return $result if defined $result && length $result;
return $result
if defined $result && length $result;
}
else {
my $list = 'callbackList:noArg ';