2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-03-10 03:06:37 +00:00

fhem.pl: enable Dispatch to Parse raw data by multiple modules (Forum #95446)

git-svn-id: https://svn.fhem.de/fhem/trunk@18316 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
rudolfkoenig 2019-01-18 16:52:03 +00:00
parent ea9c409726
commit 03c5f3d8f8
4 changed files with 18 additions and 3 deletions

View File

@ -399,6 +399,9 @@ MQTT2_CLIENT_Write($$$)
{
my ($hash, $function, $topicMsg) = @_;
return "Ignoring the message as $hash->{NAME} is not yet connected"
if($hash->{connecting});
if($function eq "publish") {
my ($topic, $msg) = split(" ", $topicMsg, 2);
my $retain;
@ -416,6 +419,7 @@ MQTT2_CLIENT_Write($$$)
my $name = $hash->{NAME};
Log3 $name, 1, "$name: ERROR: Ignoring function $function";
}
return undef;
}
sub

View File

@ -476,6 +476,7 @@ MQTT2_SERVER_Write($$$)
} else {
Log3 $name, 1, "$name: ERROR: Ignoring function $function";
}
return undef;
}
sub

View File

@ -203,7 +203,9 @@ MQTT2_DEVICE_Parse($$)
return "";
}
return keys %fnd;
my @ret = keys %fnd;
unshift(@ret, "[NEXT]"); # for MQTT_GENERIC_BRIDGE
return @ret;
}
# compatibility: the first version was implemented as MQTT2_JSON and published.

View File

@ -3871,10 +3871,18 @@ Dispatch($$;$$)
}
no strict "refs"; $readingsUpdateDelayTrigger = 1;
@found = &{$modules{$m}{ParseFn}}($hash,$dmsg);
my @tfound = &{$modules{$m}{ParseFn}}($hash,$dmsg);
use strict "refs"; $readingsUpdateDelayTrigger = 0;
$parserMod = $m;
last if(int(@found));
if(@tfound && $tfound[0]) {
if($tfound[0] && $tfound[0] eq "[NEXT]") { # not a goodDeviceName, #95446
shift(@tfound);
push @found, @tfound; # continue feeding other modules
} else {
push @found, @tfound;
last;
}
}
}
if((!int(@found) || !defined($found[0])) && !$nounknown) {