mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-01-31 12:49:34 +00:00
10_MQTT2_DEVICE.pm: fix escaping readingList for autocreate (Forum #115743)
git-svn-id: https://svn.fhem.de/fhem/trunk@23171 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
fe39cf5130
commit
7a1ba34c93
@ -246,16 +246,14 @@ MQTT2_DEVICE_Parse($$)
|
||||
$add = makeReadingName($add); # Convert non-valid characters to _
|
||||
}
|
||||
|
||||
$topic =~ s,([\^\$\[\]()\.\\]),\\$1,g;
|
||||
$topic =~ s,\s,.,g;
|
||||
my $reTopic = $topic;
|
||||
$reTopic =~ s#([^A-Z0-9_/-])#"\\x".sprintf("%02x",ord($1))#ige;
|
||||
|
||||
for my $ch (@{$cidArr}) {
|
||||
my $nn = $ch->{NAME};
|
||||
next if(!AttrVal($nn, "autocreate", 1)); # device autocreate
|
||||
my $rl = AttrVal($nn, "readingList", "");
|
||||
$rl .= "\n" if($rl);
|
||||
my $reTopic = $topic;
|
||||
$reTopic =~ s#([^A-Z0-9_/-])#"\\x".sprintf("%02x",ord($1))#ige;
|
||||
my $regex = ($cid eq $newCid ? "$cid:" : "").$reTopic.":.*";
|
||||
CommandAttr(undef, "$nn readingList $rl$regex $add")
|
||||
if(index($rl, $regex) == -1); # Forum #84372
|
||||
|
Loading…
Reference in New Issue
Block a user