From 09010cada12fe99ea932b0a4422a750cde22d8f9 Mon Sep 17 00:00:00 2001 From: martinp876 <> Date: Thu, 5 Jun 2014 14:21:43 +0000 Subject: [PATCH] bugs git-svn-id: https://svn.fhem.de/fhem/trunk@6069 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/FHEM/00_HMLAN.pm | 14 ++++++++++---- fhem/FHEM/10_CUL_HM.pm | 3 +++ 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/fhem/FHEM/00_HMLAN.pm b/fhem/FHEM/00_HMLAN.pm index d28b32215..03c8d3e63 100755 --- a/fhem/FHEM/00_HMLAN.pm +++ b/fhem/FHEM/00_HMLAN.pm @@ -149,7 +149,9 @@ sub HMLAN_RemoveHMPair($) {#################################################### my($in ) = shift; my(undef,$name) = split(':',$in); my $hash = $defs{$name}; + RemoveInternalTimer("hmPairForSec:$name"); delete($hash->{hmPair}); + delete($hash->{hmPairSerial}); } sub HMLAN_Notify(@) {########################################################## my ($hash,$dev) = @_; @@ -217,8 +219,8 @@ sub HMLAN_Attr(@) {############################################################ } elsif($aName eq "hmId"){ if ($cmd eq "set"){ - my $owner = InternalVal($name,"owner_CCU",undef); - return "device owned by $owner" if ($owner); + my $owner_ccu = InternalVal($name,"owner_CCU",undef); + return "device owned by $owner_ccu" if ($owner_ccu); return "wrong syntax: hmId must be 6-digit-hex-code (3 byte)" if ($aVal !~ m/^[A-F0-9]{6}$/i); } @@ -334,19 +336,23 @@ sub HMLAN_Set($@) {############################################################ if($type eq "hmPairForSec") { #################################### return "Usage: set $name hmPairForSec " if(!$arg || $arg !~ m/^\d+$/); + HMLAN_RemoveHMPair("hmPairForSec:$name"); $hash->{hmPair} = 1; - InternalTimer(gettimeofday()+$arg, "HMLAN_RemoveHMPair", "hmPairForSec:".$name, 1); + InternalTimer(gettimeofday()+$arg, "HMLAN_RemoveHMPair", "hmPairForSec:$name", 1); } elsif($type eq "hmPairSerial") { ################################ return "Usage: set $name hmPairSerial <10-character-serialnumber>" if(!$arg || $arg !~ m/^.{10}$/); - my $id = AttrVal($hash->{NAME}, "hmId", "123456"); + my $id = InternalVal($hash->{NAME}, "owner", "123456"); $hash->{HM_CMDNR} = $hash->{HM_CMDNR} ? ($hash->{HM_CMDNR}+1)%256 : 1; HMLAN_Write($hash, undef, sprintf("As15%02X8401%s000000010A%s", $hash->{HM_CMDNR}, $id, unpack('H*', $arg))); + HMLAN_RemoveHMPair("hmPairForSec:$name"); + $hash->{hmPair} = 1; $hash->{hmPairSerial} = $arg; + InternalTimer(gettimeofday()+20, "HMLAN_RemoveHMPair", "hmPairForSec:".$name, 1); } return ("",1);# no not generate trigger outof command } diff --git a/fhem/FHEM/10_CUL_HM.pm b/fhem/FHEM/10_CUL_HM.pm index 301b23bc5..f8167dbcb 100755 --- a/fhem/FHEM/10_CUL_HM.pm +++ b/fhem/FHEM/10_CUL_HM.pm @@ -6423,7 +6423,9 @@ sub CUL_HM_storeRssi(@){ } sub CUL_HM_UpdtCentral($){ my $name = shift; + return if(!$init_done); my $id = CUL_HM_name2Id($name); + delete $defs{$_}{owner_CCU} # remove assignments in IO dev to this CCU foreach (grep !/^$/, map{InternalVal($_,"owner_CCU","") eq $name ? $_ : ""} @@ -6453,6 +6455,7 @@ sub CUL_HM_UpdtCentral($){ # --- search for peers to CCU and potentially device this channel foreach my $ccuBId (CUL_HM_noDup(grep /$id/ ,map{split ",",AttrVal($_,"peerIDs","")}keys %defs)){ + next if (length($ccuBId) !=8); my $btnS = substr($ccuBId,6,2); my $btn = hex($btnS) + 0; next if (!$btn);