mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-03-13 17:26:34 +00:00
Making regexp in Client-List of iodevs work in Dispatch
git-svn-id: https://svn.fhem.de/fhem/trunk@3236 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
69ab88695c
commit
1c524fbb57
34
fhem/fhem.pl
34
fhem/fhem.pl
@ -1388,6 +1388,7 @@ AssignIoPort($)
|
|||||||
my @fnd = grep { $hash->{TYPE} =~ m/^$_$/; } split(":", $cl);
|
my @fnd = grep { $hash->{TYPE} =~ m/^$_$/; } split(":", $cl);
|
||||||
if(@fnd) {
|
if(@fnd) {
|
||||||
$hash->{IODev} = $defs{$p};
|
$hash->{IODev} = $defs{$p};
|
||||||
|
delete($defs{$p}{".clientArray"}); # Force a recompute
|
||||||
last;
|
last;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2582,21 +2583,19 @@ Dispatch($$$)
|
|||||||
|
|
||||||
my @found;
|
my @found;
|
||||||
|
|
||||||
my $cl = $hash->{Clients};
|
my $clientArray = $hash->{".clientArray"};
|
||||||
$cl = $iohash->{Clients} if(!$cl);
|
$clientArray = computeClientArray($hash, $iohash) if(!$clientArray);
|
||||||
foreach my $m (sort { $modules{$a}{ORDER} cmp $modules{$b}{ORDER} }
|
|
||||||
grep {defined($modules{$_}{ORDER})} keys %modules) {
|
|
||||||
|
|
||||||
next if(!(defined($cl) && $cl =~ m/:$m:/));
|
|
||||||
|
|
||||||
|
foreach my $m (@{$clientArray}) {
|
||||||
# Module is not loaded or the message is not for this module
|
# Module is not loaded or the message is not for this module
|
||||||
next if(!$modules{$m}{Match} || $dmsg !~ m/$modules{$m}{Match}/i);
|
next if($dmsg !~ m/$modules{$m}{Match}/i);
|
||||||
|
|
||||||
no strict "refs"; $readingsUpdateDelayTrigger = 1;
|
no strict "refs"; $readingsUpdateDelayTrigger = 1;
|
||||||
@found = &{$modules{$m}{ParseFn}}($hash,$dmsg);
|
@found = &{$modules{$m}{ParseFn}}($hash,$dmsg);
|
||||||
use strict "refs"; $readingsUpdateDelayTrigger = 0;
|
use strict "refs"; $readingsUpdateDelayTrigger = 0;
|
||||||
last if(int(@found));
|
last if(int(@found));
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!int(@found)) {
|
if(!int(@found)) {
|
||||||
my $h = $hash->{MatchList}; $h = $iohash->{MatchList} if(!$h);
|
my $h = $hash->{MatchList}; $h = $iohash->{MatchList} if(!$h);
|
||||||
if(defined($h)) {
|
if(defined($h)) {
|
||||||
@ -3339,4 +3338,25 @@ fhemTimeLocal($$$$$$) {
|
|||||||
return $t-fhemTzOffset($t);
|
return $t-fhemTzOffset($t);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sub
|
||||||
|
computeClientArray($$)
|
||||||
|
{
|
||||||
|
my ($hash, $iohash) = @_;
|
||||||
|
my @a = ();
|
||||||
|
my @mRe = split(":", $hash->{Clients} ? $hash->{Clients}:$iohash->{Clients});
|
||||||
|
|
||||||
|
foreach my $m (sort { $modules{$a}{ORDER} cmp $modules{$b}{ORDER} }
|
||||||
|
grep { defined($modules{$_}{ORDER}) } keys %modules) {
|
||||||
|
foreach my $re (@mRe) {
|
||||||
|
if($m =~ m/^$re$/) {
|
||||||
|
push @a, $m if($modules{$m}{Match});
|
||||||
|
last;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$hash->{".clientArray"} = \@a;
|
||||||
|
return \@a;
|
||||||
|
}
|
||||||
|
|
||||||
1;
|
1;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user