diff --git a/73_NUKIBridge.pm b/73_NUKIBridge.pm index 21bd09d..7a49442 100755 --- a/73_NUKIBridge.pm +++ b/73_NUKIBridge.pm @@ -235,7 +235,6 @@ sub Define($$) { $hash->{NOTIFYDEV} = 'global,' . $name; $hash->{VERSION} = version->parse($VERSION)->normal; $hash->{BRIDGEAPI} = FHEM::Meta::Get( $hash, 'x_apiversion' ); - $hash->{helper}->{aliveCount} = 0; $hash->{helper}->{actionQueue} = []; $hash->{helper}->{iowrite} = 0; my $infix = 'NUKIBridge'; @@ -397,10 +396,14 @@ sub Notify($$) { FirstRun($hash) if ( ( - grep /^INITIALIZED$/, @{$events} - or grep /^REREADCFG$/, @{$events} - or grep /^MODIFIED.$name$/, @{$events} - or grep /^DEFINED.$name$/, @{$events} + grep /^INITIALIZED$/, + @{$events} + or grep /^REREADCFG$/, + @{$events} + or grep /^MODIFIED.$name$/, + @{$events} + or grep /^DEFINED.$name$/, + @{$events} ) and $devname eq 'global' and $init_done @@ -573,10 +576,11 @@ sub Write($@) { }; $hash->{helper}->{lastDeviceAction} = $obj - if ( ( defined($param) - and $param) - or (defined($nukiId) - and $nukiId) ); + if ( + ( defined($param) and $param ) + or ( defined($nukiId) + and $nukiId ) + ); unshift( @{ $hash->{helper}->{actionQueue} }, $obj ); @@ -703,9 +707,7 @@ sub Distribution($$$) { if ( $err ne '' ) { if ( $param->{endpoint} eq 'info' ) { readingsBulkUpdate( $hash, 'state', 'not connected' ); -# if ( $hash->{helper}{aliveCount} > 1 ); Log3( $name, 5, "NUKIBridge ($name) - Bridge ist offline" ); -# $hash->{helper}{aliveCount} = $hash->{helper}{aliveCount} + 1; } readingsBulkUpdate( $hash, 'lastError', $err ) @@ -794,7 +796,7 @@ sub Distribution($$$) { and $hash->{helper}->{lastDeviceAction} ); readingsEndUpdate( $hash, 1 ); - + readingsSingleUpdate( $hash, 'state', 'connected', 1 ); Log3( $name, 5, "NUKIBridge ($name) - Bridge ist online" ); @@ -909,8 +911,6 @@ sub ResponseProcessing($$$) { InfoProcessing( $hash, $decode_json ) if ( $endpoint eq 'info' ); - - $hash->{helper}{aliveCount} = 0; } else { Log3( @@ -1336,7 +1336,7 @@ sub ParseJSON($$) { ], "release_status": "under develop", "license": "GPL_2", - "version": "v1.9.13", + "version": "v1.9.14", "x_apiversion": "1.9", "author": [ "Marko Oldenburg " diff --git a/74_NUKIDevice.pm b/74_NUKIDevice.pm index f4a86c4..d92ee5f 100755 --- a/74_NUKIDevice.pm +++ b/74_NUKIDevice.pm @@ -30,7 +30,6 @@ package main; use strict; use warnings; - package FHEM::NUKIDevice; use strict; @@ -217,14 +216,14 @@ sub Initialize($) { $hash->{Match} = '^{.*}$'; - $hash->{SetFn} = 'FHEM::NUKIDevice::Set'; - $hash->{DefFn} = 'FHEM::NUKIDevice::Define'; - $hash->{UndefFn} = 'FHEM::NUKIDevice::Undef'; - $hash->{NotifyFn} = 'FHEM::NUKIDevice::Notify'; - $hash->{AttrFn} = 'FHEM::NUKIDevice::Attr'; - $hash->{ParseFn} = 'FHEM::NUKIDevice::Parse'; + $hash->{SetFn} = 'FHEM::NUKIDevice::Set'; + $hash->{DefFn} = 'FHEM::NUKIDevice::Define'; + $hash->{UndefFn} = 'FHEM::NUKIDevice::Undef'; + $hash->{NotifyFn} = 'FHEM::NUKIDevice::Notify'; + $hash->{AttrFn} = 'FHEM::NUKIDevice::Attr'; + $hash->{ParseFn} = 'FHEM::NUKIDevice::Parse'; - $hash->{AttrList} = + $hash->{AttrList} = 'IODev ' . 'model:opener,smartlock ' . 'disable:1 ' @@ -236,7 +235,7 @@ sub Initialize($) { sub Define($$) { my ( $hash, $def ) = @_; my @a = split( '[ \t][ \t]*', $def ); - + return $@ unless ( FHEM::Meta::SetInternals($hash) ); use version 0.60; our $VERSION = FHEM::Meta::Get( $hash, 'version' ); @@ -266,7 +265,7 @@ sub Define($$) { } $iodev = $hash->{IODev}->{NAME}; - + $hash->{BRIDGEAPI} = $defs{$iodev}->{BRIDGEAPI}; my $d = $modules{NUKIDevice}{defptr}{$nukiId}; @@ -291,9 +290,9 @@ sub Define($$) { $modules{NUKIDevice}{defptr}{$nukiId} = $hash; GetUpdate($hash) - if ( ReadingsVal($name,'success','none') eq 'none' + if ( ReadingsVal( $name, 'success', 'none' ) eq 'none' and $init_done ); - + return undef; } @@ -363,10 +362,14 @@ sub Notify($$) { GetUpdate($hash) if ( ( - grep /^INITIALIZED$/, @{$events} - or grep /^REREADCFG$/, @{$events} - or grep /^MODIFIED.$name$/, @{$events} - or grep /^DEFINED.$name$/, @{$events} + grep /^INITIALIZED$/, + @{$events} + or grep /^REREADCFG$/, + @{$events} + or grep /^MODIFIED.$name$/, + @{$events} + or grep /^DEFINED.$name$/, + @{$events} ) and $devname eq 'global' and $init_done @@ -430,7 +433,8 @@ sub GetUpdate($) { my $name = $hash->{NAME}; if ( !IsDisabled($name) ) { - IOWrite( $hash, 'lockState', undef, $hash->{NUKIID}, $hash->{DEVICETYPE} ); + IOWrite( $hash, 'lockState', undef, $hash->{NUKIID}, + $hash->{DEVICETYPE} ); Log3( $name, 2, "NUKIDevice ($name) - GetUpdate Call IOWrite" ); }