sauberes löschen der Instanzen geht nun
This commit is contained in:
parent
66440d28cd
commit
523b7211c0
15
74_AMAD.pm
15
74_AMAD.pm
@ -79,14 +79,14 @@ sub AMAD_Define($$) {
|
|||||||
my $port = 8090;
|
my $port = 8090;
|
||||||
my $interval = 180;
|
my $interval = 180;
|
||||||
|
|
||||||
$hash->{HOST} = $host;
|
$hash->{HOST} = $host if( $host );
|
||||||
$hash->{PORT} = $port;
|
$hash->{PORT} = $port;
|
||||||
$hash->{INTERVAL} = $interval if( $hash->{HOST} );
|
$hash->{INTERVAL} = $interval if( $hash->{HOST} );
|
||||||
$hash->{VERSION} = $version;
|
$hash->{VERSION} = $version;
|
||||||
$hash->{helper}{infoErrorCounter} = 0 if( $hash->{HOST} );
|
$hash->{helper}{infoErrorCounter} = 0 if( $hash->{HOST} );
|
||||||
$hash->{helper}{setCmdErrorCounter} = 0 if( $hash->{HOST} );
|
$hash->{helper}{setCmdErrorCounter} = 0 if( $hash->{HOST} );
|
||||||
|
|
||||||
if( !$hash->{HOST} ) {
|
if( ! $hash->{HOST} ) {
|
||||||
return "there is already a AMAD Bridge" if( $modules{AMAD}{defptr}{BRIDGE} );
|
return "there is already a AMAD Bridge" if( $modules{AMAD}{defptr}{BRIDGE} );
|
||||||
|
|
||||||
$hash->{BRIDGE} = 1;
|
$hash->{BRIDGE} = 1;
|
||||||
@ -96,8 +96,10 @@ sub AMAD_Define($$) {
|
|||||||
AMAD_CommBridge_Open( $hash );
|
AMAD_CommBridge_Open( $hash );
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
if( !$modules{AMAD}{defptr}{BRIDGE} ) {
|
if( ! $modules{AMAD}{defptr}{BRIDGE} ) {
|
||||||
CommandDefine( undef, "AMADCommBridge AMAD" );
|
CommandDefine( undef, "AMADCommBridge AMAD" );
|
||||||
|
Log3 $name, 3, "AMAD ($name) - there is already a AMAD Bridge";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Log3 $name, 3, "AMAD ($name) - defined with host $hash->{HOST} on port $hash->{PORT} and interval $hash->{INTERVAL} (sec)";
|
Log3 $name, 3, "AMAD ($name) - defined with host $hash->{HOST} on port $hash->{PORT} and interval $hash->{INTERVAL} (sec)";
|
||||||
@ -108,7 +110,7 @@ sub AMAD_Define($$) {
|
|||||||
|
|
||||||
InternalTimer( gettimeofday()+$hash->{INTERVAL}, "AMAD_GetUpdateTimer", $hash, 0 ) if( $hash->{HOST} );
|
InternalTimer( gettimeofday()+$hash->{INTERVAL}, "AMAD_GetUpdateTimer", $hash, 0 ) if( $hash->{HOST} );
|
||||||
|
|
||||||
#$modules{AMAD}{defptr}{$hash->$hash->{HOST}};
|
$modules{AMAD}{defptr}{$hash->{HOST}};
|
||||||
|
|
||||||
return undef;
|
return undef;
|
||||||
}
|
}
|
||||||
@ -120,14 +122,15 @@ sub AMAD_Undef($$) {
|
|||||||
|
|
||||||
if( $hash->{BRIDGE} ) {
|
if( $hash->{BRIDGE} ) {
|
||||||
delete $modules{AMAD}{defptr}{BRIDGE};
|
delete $modules{AMAD}{defptr}{BRIDGE};
|
||||||
|
|
||||||
|
my $ret = TcpServer_Close( $hash );
|
||||||
|
return $ret;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
delete $modules{AMAD}{defptr}{$hash->{HOST}};
|
delete $modules{AMAD}{defptr}{$hash->{HOST}};
|
||||||
|
|
||||||
RemoveInternalTimer( $hash );
|
RemoveInternalTimer( $hash );
|
||||||
|
|
||||||
my $ret = TcpServer_Close( $hash );
|
|
||||||
return $ret;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user