diff --git a/controls_NukiSmart.txt b/controls_NukiSmart.txt index cf97fab..652aa76 100644 --- a/controls_NukiSmart.txt +++ b/controls_NukiSmart.txt @@ -1,4 +1,4 @@ -UPD 2021-12-10_20:21:10 9332 FHEM/73_NUKIBridge.pm -UPD 2021-12-10_20:22:28 7681 FHEM/74_NUKIDevice.pm -UPD 2021-12-10_19:44:48 42801 lib/FHEM/Devices/Nuki/Bridge.pm -UPD 2021-12-10_20:17:22 16247 lib/FHEM/Devices/Nuki/Device.pm +UPD 2021-12-10_20:47:57 9332 FHEM/73_NUKIBridge.pm +UPD 2021-12-10_20:47:57 7681 FHEM/74_NUKIDevice.pm +UPD 2021-12-10_21:46:37 42734 lib/FHEM/Devices/Nuki/Bridge.pm +UPD 2021-12-10_21:57:25 16311 lib/FHEM/Devices/Nuki/Device.pm diff --git a/hooks/pre-commit b/hooks/pre-commit index 4d23534..0ee3e50 100755 --- a/hooks/pre-commit +++ b/hooks/pre-commit @@ -4,25 +4,13 @@ use File::Basename; use POSIX qw(strftime); use strict; -my @filenames = ( 'FHEM/73_AutoShuttersControl.pm', - 'lib/FHEM/Automation/ShuttersControl.pm', - 'lib/FHEM/Automation/ShuttersControl/Dev.pm', - 'lib/FHEM/Automation/ShuttersControl/Roommate.pm', - 'lib/FHEM/Automation/ShuttersControl/Shutters.pm', - 'lib/FHEM/Automation/ShuttersControl/Shading.pm', - 'lib/FHEM/Automation/ShuttersControl/EventProcessingFunctions.pm', - 'lib/FHEM/Automation/ShuttersControl/Helper.pm', - 'lib/FHEM/Automation/ShuttersControl/Window.pm', - 'lib/FHEM/Automation/ShuttersControl/Dev/Attr.pm', - 'lib/FHEM/Automation/ShuttersControl/Dev/Readings.pm', - 'lib/FHEM/Automation/ShuttersControl/Shutters/Attr.pm', - 'lib/FHEM/Automation/ShuttersControl/Shutters/Readings.pm', - 'lib/FHEM/Automation/ShuttersControl/Window/Attr.pm', - 'lib/FHEM/Automation/ShuttersControl/Window/Readings.pm', - 'lib/FHEM/Automation/ShuttersControl/Rainprotection.pm' +my @filenames = ( 'FHEM/73_NUKIBridge.pm', + 'FHEM/74_NUKIDevice.pm', + 'lib/FHEM/Devices/Nuki/Bridge.pm', + 'lib/FHEM/Devices/Nuki/Device.pm' ); -my $controlsfile = 'controls_AutoShuttersControl.txt'; +my $controlsfile = 'controls_NukiSmart.txt'; open(FH, ">$controlsfile") || return("Can't open $controlsfile: $!"); diff --git a/lib/FHEM/Devices/Nuki/Bridge.pm b/lib/FHEM/Devices/Nuki/Bridge.pm index 2e367ad..9c0555c 100644 --- a/lib/FHEM/Devices/Nuki/Bridge.pm +++ b/lib/FHEM/Devices/Nuki/Bridge.pm @@ -426,27 +426,27 @@ sub Set { given ($cmd) { when ('getdevicelist') { - return 'usage: getDeviceList' if ( defined($arg) ); + return 'usage: getDeviceList' if ($arg); $endpoint = 'list'; } when ('info') { - return 'usage: info' if ( defined($arg) ); + return 'usage: info' if ($arg); $endpoint = 'info'; } when ('fwupdate') { - return 'usage: fwUpdate' if ( defined($arg) ); + return 'usage: fwUpdate' if ($arg); $endpoint = 'fwupdate'; } when ('reboot') { - return 'usage: freboot' if ( defined($arg) ); + return 'usage: freboot' if ($arg); $endpoint = 'reboot'; } when ('clearlog') { - return 'usage: clearLog' if ( defined($arg) ); + return 'usage: clearLog' if ($arg); $endpoint = 'clearlog'; } when ('factoryreset') { - return 'usage: factoryReset' if ( defined($arg) ); + return 'usage: factoryReset' if ($arg); $endpoint = 'factoryreset'; } @@ -1037,7 +1037,7 @@ sub CGI() { $hash->{WEBHOOK_LAST} = ::TimeNow(); ::Log3( $name, 3, -"NUKIBridge WEBHOOK ($name) - Received webhook for matching NukiId at device $name" +"NUKIBridge WEBHOOK ($name) - Received webhook for matching NukiId at IODev $name" ); ::Dispatch( $hash, $json, undef ); diff --git a/lib/FHEM/Devices/Nuki/Device.pm b/lib/FHEM/Devices/Nuki/Device.pm index a0619bc..ad0c529 100644 --- a/lib/FHEM/Devices/Nuki/Device.pm +++ b/lib/FHEM/Devices/Nuki/Device.pm @@ -191,6 +191,7 @@ my %doorsensorStates = ( sub Define { my $hash = shift; my $def = shift // return; + my $version; return $@ unless ( FHEM::Meta::SetInternals($hash) ); @@ -455,8 +456,8 @@ sub Parse { return $dhash->{NAME}; } else { - ::Log3( $dname, 4, - "NUKIDevice ($dname) - autocreate new device " + ::Log3( $name, 4, + "NUKIDevice ($name) - autocreate new device " . ::makeDeviceName( $decode_json->{name} ) . " with nukiId $decode_json->{nukiId}, model $decode_json->{deviceType}" ); @@ -521,7 +522,7 @@ sub SmartlockState { delete $hash->{helper}{lockAction}; } - return; + return $decode_json; } sub WriteReadings { @@ -529,7 +530,7 @@ sub WriteReadings { my $decode_json = shift; my $name = $hash->{NAME}; - SmartlockState(); + $decode_json = SmartlockState( $hash, $decode_json ); ::readingsBeginUpdate($hash);