Bugfix: Error message in inform when multi-channel hm device is created

git-svn-id: https://fhem.svn.sourceforge.net/svnroot/fhem/trunk/fhem@1177 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
rudolfkoenig
2012-01-07 09:00:32 +00:00
parent 24437a97bc
commit 8be181ebad

32
fhem.pl
View File

@@ -2124,21 +2124,23 @@ DoTrigger($$)
################
# Inform
$max = int(@{$defs{$dev}{CHANGED}}); # can be enriched in the notifies
foreach my $c (keys %client) { # Do client loop first, is cheaper
next if(!$client{$c}{inform} || $client{$c}{inform} eq "raw");
my $tn = TimeNow();
if($attr{global}{mseclog}) {
my ($seconds, $microseconds) = gettimeofday();
$tn .= sprintf(".%03d", $microseconds/1000);
}
my $re = $client{$c}{informRegexp};
for(my $i = 0; $i < $max; $i++) {
my $state = $defs{$dev}{CHANGED}[$i];
next if($re && $state !~ m/$re/);
syswrite($client{$c}{fd},
($client{$c}{inform} eq "timer" ? "$tn " : "") .
"$defs{$dev}{TYPE} $dev $state\n");
if($defs{$dev}{CHANGED}) { # It gets deleted sometimes (?)
$max = int(@{$defs{$dev}{CHANGED}}); # can be enriched in the notifies
foreach my $c (keys %client) { # Do client loop first, is cheaper
next if(!$client{$c}{inform} || $client{$c}{inform} eq "raw");
my $tn = TimeNow();
if($attr{global}{mseclog}) {
my ($seconds, $microseconds) = gettimeofday();
$tn .= sprintf(".%03d", $microseconds/1000);
}
my $re = $client{$c}{informRegexp};
for(my $i = 0; $i < $max; $i++) {
my $state = $defs{$dev}{CHANGED}[$i];
next if($re && $state !~ m/$re/);
syswrite($client{$c}{fd},
($client{$c}{inform} eq "timer" ? "$tn " : "") .
"$defs{$dev}{TYPE} $dev $state\n");
}
}
}