automatisches löschen der Bridge nach letzter Device Instanz löschung, Code Bereinigung

This commit is contained in:
Marko Oldenburg 2015-11-25 21:52:40 +01:00
parent 72afe0656f
commit 4b9457bab3

View File

@ -35,7 +35,7 @@ use Time::HiRes qw(gettimeofday);
use HttpUtils;
use TcpServerUtils;
my $version = "0.9.6";
my $version = "0.9.7";
@ -121,7 +121,7 @@ sub AMAD_Undef($$) {
if( $hash->{BRIDGE} ) {
delete $modules{AMAD}{defptr}{BRIDGE};
my $ret = TcpServer_Close( $hash );
TcpServer_Close( $hash );
} else {
delete $modules{AMAD}{defptr}{$hash->{HOST}};
@ -131,10 +131,9 @@ sub AMAD_Undef($$) {
my $hash = $modules{AMAD}{defptr}{$d};
my $host = $hash->{HOST};
if( $host ) {
return if( $host );
my $name = $hash->{NAME};
CommandDelete( undef, $name ) if( $hash->{BRIDGE} );
}
CommandDelete( undef, $name );
}
}
}
@ -1013,11 +1012,11 @@ sub AMAD_CommBridge_Read($) {
if( $fhemcmd =~ /^{.*}$/ ) {
response = $fhemCmd if( ReadingsVal( $bname, "expertMode", 0 ) eq "1" );
$response = $fhemCmd if( ReadingsVal( $bname, "expertMode", 0 ) eq "1" );
} else {
response = "header lines: \r\n AMADCommBridge receive no typical FHEM function\r\n FHEM to do nothing\r\n";
$response = "header lines: \r\n AMADCommBridge receive no typical FHEM function\r\n FHEM to do nothing\r\n";
}
$c = $hash->{CD};