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->{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 )
@ -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 <leongaultier@gmail.com>"

View File

@ -30,7 +30,6 @@ package main;
use strict;
use warnings;
package FHEM::NUKIDevice;
use strict;
@ -291,7 +290,7 @@ 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" );
}