diff --git a/FHEM/00_CM11.pm b/FHEM/00_CM11.pm index 57ac37c07..c540e841d 100755 --- a/FHEM/00_CM11.pm +++ b/FHEM/00_CM11.pm @@ -671,7 +671,7 @@ CM11_Read($) $hu= "" unless(defined($hu)); my $hf = $hash->{$housecode_func}; my $dmsg= "X10:$housecode;$hu;$hf"; - Dispatch($hash, $dmsg); + Dispatch($hash, $dmsg, undef); } else { # data byte is unitcode # if a command was executed before, clear unitcode list diff --git a/FHEM/00_CUL.pm b/FHEM/00_CUL.pm index ab136f328..4534a4538 100755 --- a/FHEM/00_CUL.pm +++ b/FHEM/00_CUL.pm @@ -761,17 +761,13 @@ CUL_Read($) goto NEXTMSG; } - $hash->{RSSI} = $rssi if(defined($rssi)); $hash->{RAWMSG} = $rmsg; - my $foundp = Dispatch($hash, $dmsg); - if($foundp) { - foreach my $d (@{$foundp}) { - next if(!$defs{$d}); - $defs{$d}{"RSSI_$name"} = $rssi if($rssi); - $defs{$d}{RAWMSG} = $rmsg; - $defs{$d}{"MSGCNT_$name"}++; - } + my %addvals = (RAWMSG => $rmsg); + if(defined($rssi)) { + $hash->{RSSI} = $rssi; + $addvals{RSSI} = $rssi; } + Dispatch($hash, $dmsg, \%addvals); NEXTMSG: } diff --git a/FHEM/00_FHZ.pm b/FHEM/00_FHZ.pm index f99dfbb95..9d0ece7ca 100755 --- a/FHEM/00_FHZ.pm +++ b/FHEM/00_FHZ.pm @@ -694,14 +694,8 @@ FHZ_Read($) } $hash->{RAWMSG} = $dmsg; - my $foundp = Dispatch($hash, $dmsg); - if($foundp) { - foreach my $d (@{$foundp}) { - next if(!$defs{$d}); - $defs{$d}{RAWMSG} = $dmsg; - $defs{$d}{"MSGCNT_$name"}++; - } - } + my %addvals = (RAWMSG => $rmsg); + my $foundp = Dispatch($hash, $dmsg, \%addvals); $fhzdata = substr($fhzdata, $len); diff --git a/fhem.pl b/fhem.pl index d5df6260b..d030f7d24 100755 --- a/fhem.pl +++ b/fhem.pl @@ -48,7 +48,7 @@ sub CallFn(@); sub CommandChain($$); sub CheckDuplicate($$); sub DoClose($); -sub Dispatch($$); +sub Dispatch($$$); sub FmtDateTime($); sub FmtTime($); sub GetLogLevel(@); @@ -155,7 +155,7 @@ my $nextat; # Time when next timer will be triggered. my $intAtCnt=0; my %duplicate; # Pool of received msg for multi-fhz/cul setups my $duplidx=0; # helper for the above pool -my $cvsid = '$Id: fhem.pl,v 1.82 2009-11-12 19:08:00 rudolfkoenig Exp $'; +my $cvsid = '$Id: fhem.pl,v 1.83 2009-11-14 09:20:37 rudolfkoenig Exp $'; my $namedef = "where is either:\n" . "- a single device name\n" . @@ -2037,9 +2037,9 @@ HandleArchiving($) # Call a logical device (FS20) ParseMessage with data from a physical device # (FHZ) sub -Dispatch($$) +Dispatch($$$) { - my ($hash, $dmsg) = @_; + my ($hash, $dmsg, $addvals) = @_; my $iohash = $modules{$hash->{TYPE}}; # The phyiscal device module pointer my $name = $hash->{NAME}; @@ -2093,9 +2093,19 @@ Dispatch($$) CommandDelete(undef, $d); # Remove the device return undef; } else { + if($defs{$found}) { + if($addvals) { + foreach my $av (keys %{$addvals}) { + $defs{$found}{"${name}_$av"} = $addvals->{$av}; + } + } + $defs{$found}{"${name}_MSGCNT"}++; + $defs{$found}{LASTIODev} = $name; + } DoTrigger($found, undef); } } + $duplicate{$idx}{FND} = \@found; return \@found;