mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-03-10 09:16:53 +00:00
10_MQTT2_DEVICE.pm: check regexp syntax for readingsList (Forum #90145)
git-svn-id: https://svn.fhem.de/fhem/trunk@18610 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
cfa30aaead
commit
ff572c3a7f
@ -398,7 +398,10 @@ MQTT2_DEVICE_Attr($$)
|
|||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
MQTT2_DEVICE_addReading($dev, $param) if($atype eq "reading");
|
if($atype eq "reading") {
|
||||||
|
my $ret = MQTT2_DEVICE_addReading($dev, $param);
|
||||||
|
return $ret if($ret);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if($attrName eq "bridgeRegexp" && $type eq "set") {
|
if($attrName eq "bridgeRegexp" && $type eq "set") {
|
||||||
@ -461,9 +464,12 @@ MQTT2_DEVICE_addReading($$)
|
|||||||
MQTT2_DEVICE_delReading($name);
|
MQTT2_DEVICE_delReading($name);
|
||||||
foreach my $line (split("\n", $param)) {
|
foreach my $line (split("\n", $param)) {
|
||||||
my ($re,$code) = split(" ", $line,2);
|
my ($re,$code) = split(" ", $line,2);
|
||||||
|
eval { "Hallo" =~ m/^$re$/ };
|
||||||
|
return "Bad regexp: $@" if($@);
|
||||||
$modules{MQTT2_DEVICE}{defptr}{re}{$re}{"$name,$code"} = $code
|
$modules{MQTT2_DEVICE}{defptr}{re}{$re}{"$name,$code"} = $code
|
||||||
if($re && $code);
|
if($re && $code);
|
||||||
}
|
}
|
||||||
|
return undef;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user