mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-03-04 05:16:45 +00:00
00_HMUARTLGW.pm: minimize keepAlive sub-device
git-svn-id: https://svn.fhem.de/fhem/trunk@15596 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
fc32a83abe
commit
e2b290c02d
@ -213,7 +213,7 @@ sub HMUARTLGW_DoInit($)
|
||||
TEMPORARY => 1,
|
||||
directReadFn => \&HMUARTLGW_Read,
|
||||
DevType => "LGW-KeepAlive",
|
||||
lgwHash => $hash,
|
||||
'.lgwHash' => $hash,
|
||||
};
|
||||
|
||||
$attr{$keepAlive->{NAME}}{room} = "hidden";
|
||||
@ -312,7 +312,7 @@ sub HMUARTLGW_Undefine($$;$)
|
||||
sub HMUARTLGW_Reopen($;$)
|
||||
{
|
||||
my ($hash, $noclose) = @_;
|
||||
$hash = $hash->{lgwHash} if ($hash->{lgwHash});
|
||||
$hash = $hash->{'.lgwHash'} if ($hash->{'.lgwHash'});
|
||||
my $name = $hash->{NAME};
|
||||
|
||||
Log3($hash, 4, "HMUARTLGW ${name} Reopen");
|
||||
@ -330,7 +330,7 @@ sub HMUARTLGW_Ready($)
|
||||
|
||||
Log3($hash, 4, "HMUARTLGW ${name} ready: ${state}");
|
||||
|
||||
if ((!$hash->{lgwHash}) && $state eq "disconnected") {
|
||||
if ((!$hash->{'.lgwHash'}) && $state eq "disconnected") {
|
||||
#don't immediately reconnect when we just connected, delay
|
||||
#for 5s because remote closed the connection on us
|
||||
if (defined($hash->{LastOpen}) &&
|
||||
@ -410,7 +410,7 @@ sub HMUARTLGW_LGW_Init($)
|
||||
$hash->{CNT} = hex($1);
|
||||
|
||||
my $lgwName = $name;
|
||||
$lgwName = $hash->{lgwHash}->{NAME} if ($hash->{lgwHash});
|
||||
$lgwName = $hash->{'.lgwHash'}->{NAME} if ($hash->{'.lgwHash'});
|
||||
|
||||
my $lgwPw = AttrVal($lgwName, "lgwPw", undef);
|
||||
|
||||
@ -1751,6 +1751,8 @@ sub HMUARTLGW_Get($@)
|
||||
my ( $hash, $name, $cmd, @args ) = @_;
|
||||
my $ret = "";
|
||||
|
||||
return "Unknown argument ${cmd}, choose one of " if ($hash->{DevType} eq "LGW-KeepAlive");
|
||||
|
||||
if ($cmd eq "assignIDs") {
|
||||
foreach my $peer (keys(%{$hash->{Peers}})) {
|
||||
next if ($hash->{Peers}{$peer} !~ m/^\+/);
|
||||
@ -1784,6 +1786,8 @@ sub HMUARTLGW_Set($@)
|
||||
|
||||
return "\"set\" needs at least one parameter" if (!$cmd);
|
||||
|
||||
return "Unknown argument ${cmd}, choose one of " if ($hash->{DevType} eq "LGW-KeepAlive");
|
||||
|
||||
if ($cmd eq "hmPairForSec") {
|
||||
$arg = 60 if(!$arg || $arg !~ m/^\d+$/);
|
||||
HMUARTLGW_RemoveHMPair("hmPairForSec:$name");
|
||||
@ -1843,6 +1847,8 @@ sub HMUARTLGW_Attr(@)
|
||||
|
||||
Log3($hash, 5, "HMUARTLGW ${name} Attr ${cmd} ${aName} ".(($aVal)?$aVal:""));
|
||||
|
||||
return "Attribute ${cmd} not supported on keepAlive-subdevice" if ($hash->{DevType} eq "LGW-KeepAlive");
|
||||
|
||||
if ($aName eq "hmId") {
|
||||
if ($cmd eq "set") {
|
||||
my $owner_ccu = InternalVal($name, "owner_CCU", undef);
|
||||
@ -2392,7 +2398,7 @@ sub HMUARTLGW_updateCoPro($$) {
|
||||
sub HMUARTLGW_getVerbLvl($$$$) {
|
||||
my ($hash, $src, $dst, $def) = @_;
|
||||
|
||||
$hash = $hash->{lgwHash} if (defined($hash->{lgwHash}));
|
||||
$hash = $hash->{'.lgwHash'} if (defined($hash->{'.lgwHash'}));
|
||||
|
||||
#Lookup IDs on change
|
||||
if (defined($hash->{Helper}{Log}{Resolve}) && $init_done) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user