mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-04-21 01:46:08 +00:00
prepare HMLAN for ID handling
git-svn-id: https://svn.fhem.de/fhem/trunk@5860 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
afe6077552
commit
34d525beac
@ -401,7 +401,7 @@ sub HMLAN_Write($$$) {#########################################################
|
|||||||
substr($msg, 16, 6));
|
substr($msg, 16, 6));
|
||||||
|
|
||||||
if ( $mtype eq "02" && $src eq $hash->{owner} && length($msg) == 24
|
if ( $mtype eq "02" && $src eq $hash->{owner} && length($msg) == 24
|
||||||
&& $hash->{assignedIDs} =~ m/$dst/){
|
&& defined $hash->{assIDs}{$dst}){
|
||||||
# Acks are generally send by HMLAN autonomously
|
# Acks are generally send by HMLAN autonomously
|
||||||
# Special
|
# Special
|
||||||
Log3 $hash, 5, "HMLAN: Skip ACK";
|
Log3 $hash, 5, "HMLAN: Skip ACK";
|
||||||
@ -419,14 +419,34 @@ sub HMLAN_Write($$$) {#########################################################
|
|||||||
HMLAN_SimpleWrite($hash, $IDadd);
|
HMLAN_SimpleWrite($hash, $IDadd);
|
||||||
$hash->{helper}{$dst}{name} = CUL_HM_id2Name($dst);
|
$hash->{helper}{$dst}{name} = CUL_HM_id2Name($dst);
|
||||||
$hash->{assIDs}{$dst} = 1;
|
$hash->{assIDs}{$dst} = 1;
|
||||||
$hash->{assignedIDs}=join(',',keys %{$hash->{assIDs}});
|
my @asId = HMLAN_noDup(keys %{$hash->{assIDs}});
|
||||||
$hash->{assignedIDsCnt}=scalar(keys %{$hash->{assIDs}});
|
$hash->{assignedIDs}=join(',',@asId);
|
||||||
|
$hash->{assignedIDsCnt}=scalar(@asId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
elsif($msg =~ m /init:(......)/){
|
elsif($msg =~ m /init:(......)/){
|
||||||
if ($modules{CUL_HM}{defptr}{$1} &&
|
my $dst = $1;
|
||||||
$modules{CUL_HM}{defptr}{$1}{helper}{io}{newChn} ){
|
if ($modules{CUL_HM}{defptr}{$dst} &&
|
||||||
HMLAN_SimpleWrite($hash,$modules{CUL_HM}{defptr}{$1}{helper}{io}{newChn});
|
$modules{CUL_HM}{defptr}{$dst}{helper}{io}{newChn} ){
|
||||||
|
HMLAN_SimpleWrite($hash,$modules{CUL_HM}{defptr}{$dst}{helper}{io}{newChn});
|
||||||
|
$hash->{helper}{$dst}{name} = CUL_HM_id2Name($dst);
|
||||||
|
$hash->{assIDs}{$dst} = 1;
|
||||||
|
my @asId = HMLAN_noDup(keys %{$hash->{assIDs}});
|
||||||
|
$hash->{assignedIDs}=join(',',@asId);
|
||||||
|
$hash->{assignedIDsCnt}=scalar(@asId);
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
elsif($msg =~ m /remove:(......)/){
|
||||||
|
my $dst = $1;
|
||||||
|
if ($modules{CUL_HM}{defptr}{$dst} &&
|
||||||
|
$modules{CUL_HM}{defptr}{$dst}{helper}{io}{newChn} ){
|
||||||
|
HMLAN_SimpleWrite($hash,"-$dst");
|
||||||
|
delete $hash->{helper}{$dst};
|
||||||
|
delete $hash->{assIDs}{$dst};
|
||||||
|
my @asId = HMLAN_noDup(keys %{$hash->{assIDs}});
|
||||||
|
$hash->{assignedIDs}=join(',',@asId);
|
||||||
|
$hash->{assignedIDsCnt}=scalar(@asId);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -750,6 +770,7 @@ sub HMLAN_SimpleWrite(@) {#####################################################
|
|||||||
$msg .= "\r\n" unless($nonl);
|
$msg .= "\r\n" unless($nonl);
|
||||||
syswrite($hash->{TCPDev}, $msg) if($hash->{TCPDev});
|
syswrite($hash->{TCPDev}, $msg) if($hash->{TCPDev});
|
||||||
}
|
}
|
||||||
|
|
||||||
sub HMLAN_DoInit($) {##########################################################
|
sub HMLAN_DoInit($) {##########################################################
|
||||||
my ($hash) = @_;
|
my ($hash) = @_;
|
||||||
my $name = $hash->{NAME};
|
my $name = $hash->{NAME};
|
||||||
@ -758,7 +779,7 @@ sub HMLAN_DoInit($) {##########################################################
|
|||||||
delete $hash->{READINGS}{state};
|
delete $hash->{READINGS}{state};
|
||||||
|
|
||||||
HMLAN_SimpleWrite($hash, "A$id") if($id ne "999999");
|
HMLAN_SimpleWrite($hash, "A$id") if($id ne "999999");
|
||||||
HMLAN_SimpleWrite($hash, "C");
|
HMLAN_assignIDs($hash);
|
||||||
HMLAN_writeAesKey($name);
|
HMLAN_writeAesKey($name);
|
||||||
my $s2000 = sprintf("%02X", HMLAN_secSince2000());
|
my $s2000 = sprintf("%02X", HMLAN_secSince2000());
|
||||||
HMLAN_SimpleWrite($hash, "T$s2000,04,00,00000000");
|
HMLAN_SimpleWrite($hash, "T$s2000,04,00,00000000");
|
||||||
@ -768,8 +789,6 @@ sub HMLAN_DoInit($) {##########################################################
|
|||||||
HMLAN_condUpdate($hash,255);
|
HMLAN_condUpdate($hash,255);
|
||||||
$hash->{helper}{q}{cap}{$_}=0 foreach (keys %{$hash->{helper}{q}{cap}});
|
$hash->{helper}{q}{cap}{$_}=0 foreach (keys %{$hash->{helper}{q}{cap}});
|
||||||
|
|
||||||
foreach (keys %{$hash->{assIDs}}){delete ($hash->{assIDs}{$_})};# clear IDs - HMLAN might have a reset
|
|
||||||
delete ($hash->{assIDs}{$_}) foreach (keys %{$hash->{assIDs}});# clear IDs - HMLAN might have a reset
|
|
||||||
$hash->{helper}{q}{keepAliveRec} = 1; # ok for first time
|
$hash->{helper}{q}{keepAliveRec} = 1; # ok for first time
|
||||||
$hash->{helper}{q}{keepAliveRpt} = 0; # ok for first time
|
$hash->{helper}{q}{keepAliveRpt} = 0; # ok for first time
|
||||||
|
|
||||||
@ -786,6 +805,15 @@ sub HMLAN_DoInit($) {##########################################################
|
|||||||
|
|
||||||
return undef;
|
return undef;
|
||||||
}
|
}
|
||||||
|
sub HMLAN_assignIDs($){
|
||||||
|
# remove all assigned IDs and assign the ones from list
|
||||||
|
my ($hash) = @_;
|
||||||
|
HMLAN_SimpleWrite($hash, "C"); #clear all assigned IDs
|
||||||
|
|
||||||
|
my @ids = split",",InternalVal($hash->{NAME},"assignedIDs","");
|
||||||
|
HMLAN_Write($hash,"","init:$_") foreach(@ids);
|
||||||
|
}
|
||||||
|
|
||||||
sub HMLAN_writeAesKey($) {#####################################################
|
sub HMLAN_writeAesKey($) {#####################################################
|
||||||
my ($name) = @_;
|
my ($name) = @_;
|
||||||
|
|
||||||
|
@ -4905,7 +4905,6 @@ sub CUL_HM_FWupdateSteps($){#steps for FW update
|
|||||||
RemoveInternalTimer("fail:SpeedChangeFailed");
|
RemoveInternalTimer("fail:SpeedChangeFailed");
|
||||||
RemoveInternalTimer("fail:Block".($step-1));
|
RemoveInternalTimer("fail:Block".($step-1));
|
||||||
if ($blocks < $step){#last block
|
if ($blocks < $step){#last block
|
||||||
CUL_HM_FWupdateSpeed($name,10);
|
|
||||||
CUL_HM_FWupdateEnd("done");
|
CUL_HM_FWupdateEnd("done");
|
||||||
Log3 $name,2,"CUL_HM fwUpdate completed";
|
Log3 $name,2,"CUL_HM fwUpdate completed";
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user