remove alive counter

This commit is contained in:
Marko Oldenburg 2020-01-13 15:04:32 +01:00
parent 8e393b1bd1
commit 8f1b164dd0
2 changed files with 36 additions and 32 deletions

View File

@ -235,7 +235,6 @@ sub Define($$) {
$hash->{NOTIFYDEV} = 'global,' . $name; $hash->{NOTIFYDEV} = 'global,' . $name;
$hash->{VERSION} = version->parse($VERSION)->normal; $hash->{VERSION} = version->parse($VERSION)->normal;
$hash->{BRIDGEAPI} = FHEM::Meta::Get( $hash, 'x_apiversion' ); $hash->{BRIDGEAPI} = FHEM::Meta::Get( $hash, 'x_apiversion' );
$hash->{helper}->{aliveCount} = 0;
$hash->{helper}->{actionQueue} = []; $hash->{helper}->{actionQueue} = [];
$hash->{helper}->{iowrite} = 0; $hash->{helper}->{iowrite} = 0;
my $infix = 'NUKIBridge'; my $infix = 'NUKIBridge';
@ -397,10 +396,14 @@ sub Notify($$) {
FirstRun($hash) FirstRun($hash)
if ( if (
( (
grep /^INITIALIZED$/, @{$events} grep /^INITIALIZED$/,
or grep /^REREADCFG$/, @{$events} @{$events}
or grep /^MODIFIED.$name$/, @{$events} or grep /^REREADCFG$/,
or grep /^DEFINED.$name$/, @{$events} @{$events}
or grep /^MODIFIED.$name$/,
@{$events}
or grep /^DEFINED.$name$/,
@{$events}
) )
and $devname eq 'global' and $devname eq 'global'
and $init_done and $init_done
@ -573,10 +576,11 @@ sub Write($@) {
}; };
$hash->{helper}->{lastDeviceAction} = $obj $hash->{helper}->{lastDeviceAction} = $obj
if ( ( defined($param) if (
and $param) ( defined($param) and $param )
or (defined($nukiId) or ( defined($nukiId)
and $nukiId) ); and $nukiId )
);
unshift( @{ $hash->{helper}->{actionQueue} }, $obj ); unshift( @{ $hash->{helper}->{actionQueue} }, $obj );
@ -703,9 +707,7 @@ sub Distribution($$$) {
if ( $err ne '' ) { if ( $err ne '' ) {
if ( $param->{endpoint} eq 'info' ) { if ( $param->{endpoint} eq 'info' ) {
readingsBulkUpdate( $hash, 'state', 'not connected' ); readingsBulkUpdate( $hash, 'state', 'not connected' );
# if ( $hash->{helper}{aliveCount} > 1 );
Log3( $name, 5, "NUKIBridge ($name) - Bridge ist offline" ); Log3( $name, 5, "NUKIBridge ($name) - Bridge ist offline" );
# $hash->{helper}{aliveCount} = $hash->{helper}{aliveCount} + 1;
} }
readingsBulkUpdate( $hash, 'lastError', $err ) readingsBulkUpdate( $hash, 'lastError', $err )
@ -794,7 +796,7 @@ sub Distribution($$$) {
and $hash->{helper}->{lastDeviceAction} ); and $hash->{helper}->{lastDeviceAction} );
readingsEndUpdate( $hash, 1 ); readingsEndUpdate( $hash, 1 );
readingsSingleUpdate( $hash, 'state', 'connected', 1 ); readingsSingleUpdate( $hash, 'state', 'connected', 1 );
Log3( $name, 5, "NUKIBridge ($name) - Bridge ist online" ); Log3( $name, 5, "NUKIBridge ($name) - Bridge ist online" );
@ -909,8 +911,6 @@ sub ResponseProcessing($$$) {
InfoProcessing( $hash, $decode_json ) InfoProcessing( $hash, $decode_json )
if ( $endpoint eq 'info' ); if ( $endpoint eq 'info' );
$hash->{helper}{aliveCount} = 0;
} }
else { else {
Log3( Log3(
@ -1336,7 +1336,7 @@ sub ParseJSON($$) {
], ],
"release_status": "under develop", "release_status": "under develop",
"license": "GPL_2", "license": "GPL_2",
"version": "v1.9.13", "version": "v1.9.14",
"x_apiversion": "1.9", "x_apiversion": "1.9",
"author": [ "author": [
"Marko Oldenburg <leongaultier@gmail.com>" "Marko Oldenburg <leongaultier@gmail.com>"

View File

@ -30,7 +30,6 @@ package main;
use strict; use strict;
use warnings; use warnings;
package FHEM::NUKIDevice; package FHEM::NUKIDevice;
use strict; use strict;
@ -217,14 +216,14 @@ sub Initialize($) {
$hash->{Match} = '^{.*}$'; $hash->{Match} = '^{.*}$';
$hash->{SetFn} = 'FHEM::NUKIDevice::Set'; $hash->{SetFn} = 'FHEM::NUKIDevice::Set';
$hash->{DefFn} = 'FHEM::NUKIDevice::Define'; $hash->{DefFn} = 'FHEM::NUKIDevice::Define';
$hash->{UndefFn} = 'FHEM::NUKIDevice::Undef'; $hash->{UndefFn} = 'FHEM::NUKIDevice::Undef';
$hash->{NotifyFn} = 'FHEM::NUKIDevice::Notify'; $hash->{NotifyFn} = 'FHEM::NUKIDevice::Notify';
$hash->{AttrFn} = 'FHEM::NUKIDevice::Attr'; $hash->{AttrFn} = 'FHEM::NUKIDevice::Attr';
$hash->{ParseFn} = 'FHEM::NUKIDevice::Parse'; $hash->{ParseFn} = 'FHEM::NUKIDevice::Parse';
$hash->{AttrList} = $hash->{AttrList} =
'IODev ' 'IODev '
. 'model:opener,smartlock ' . 'model:opener,smartlock '
. 'disable:1 ' . 'disable:1 '
@ -236,7 +235,7 @@ sub Initialize($) {
sub Define($$) { sub Define($$) {
my ( $hash, $def ) = @_; my ( $hash, $def ) = @_;
my @a = split( '[ \t][ \t]*', $def ); my @a = split( '[ \t][ \t]*', $def );
return $@ unless ( FHEM::Meta::SetInternals($hash) ); return $@ unless ( FHEM::Meta::SetInternals($hash) );
use version 0.60; our $VERSION = FHEM::Meta::Get( $hash, 'version' ); use version 0.60; our $VERSION = FHEM::Meta::Get( $hash, 'version' );
@ -266,7 +265,7 @@ sub Define($$) {
} }
$iodev = $hash->{IODev}->{NAME}; $iodev = $hash->{IODev}->{NAME};
$hash->{BRIDGEAPI} = $defs{$iodev}->{BRIDGEAPI}; $hash->{BRIDGEAPI} = $defs{$iodev}->{BRIDGEAPI};
my $d = $modules{NUKIDevice}{defptr}{$nukiId}; my $d = $modules{NUKIDevice}{defptr}{$nukiId};
@ -291,9 +290,9 @@ sub Define($$) {
$modules{NUKIDevice}{defptr}{$nukiId} = $hash; $modules{NUKIDevice}{defptr}{$nukiId} = $hash;
GetUpdate($hash) GetUpdate($hash)
if ( ReadingsVal($name,'success','none') eq 'none' if ( ReadingsVal( $name, 'success', 'none' ) eq 'none'
and $init_done ); and $init_done );
return undef; return undef;
} }
@ -363,10 +362,14 @@ sub Notify($$) {
GetUpdate($hash) GetUpdate($hash)
if ( if (
( (
grep /^INITIALIZED$/, @{$events} grep /^INITIALIZED$/,
or grep /^REREADCFG$/, @{$events} @{$events}
or grep /^MODIFIED.$name$/, @{$events} or grep /^REREADCFG$/,
or grep /^DEFINED.$name$/, @{$events} @{$events}
or grep /^MODIFIED.$name$/,
@{$events}
or grep /^DEFINED.$name$/,
@{$events}
) )
and $devname eq 'global' and $devname eq 'global'
and $init_done and $init_done
@ -430,7 +433,8 @@ sub GetUpdate($) {
my $name = $hash->{NAME}; my $name = $hash->{NAME};
if ( !IsDisabled($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" ); Log3( $name, 2, "NUKIDevice ($name) - GetUpdate Call IOWrite" );
} }