mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-04-07 19:04:20 +00:00
10_MQTT2_DEVICE.pm: fix autocreate of strange topic strings (Forum #96189)
git-svn-id: https://svn.fhem.de/fhem/trunk@18361 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
39b7fa75e2
commit
1e9fa37d04
@ -181,13 +181,17 @@ MQTT2_DEVICE_Parse($$)
|
|||||||
$add = ($1 ? $1 : $topic);
|
$add = ($1 ? $1 : $topic);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$add = makeReadingName($add); # Convert non-valid characters to _
|
||||||
|
$topic =~ s,([\^\$\[\]()\.\\]),\\$1,g;
|
||||||
|
|
||||||
for my $ch (@{$cidArr}) {
|
for my $ch (@{$cidArr}) {
|
||||||
my $nn = $ch->{NAME};
|
my $nn = $ch->{NAME};
|
||||||
next if(!AttrVal($nn, "autocreate", 1));
|
next if(!AttrVal($nn, "autocreate", 1));
|
||||||
my $rl = AttrVal($nn, "readingList", "");
|
my $rl = AttrVal($nn, "readingList", "");
|
||||||
$rl .= "\n" if($rl);
|
$rl .= "\n" if($rl);
|
||||||
my $regexpCid = ($cid eq $newCid ? "$cid:" : "");
|
my $regex = ($cid eq $newCid ? "$cid:" : "").$topic.":.*";
|
||||||
CommandAttr(undef, "$nn readingList $rl${regexpCid}$topic:.* $add");
|
CommandAttr(undef, "$nn readingList $rl$regex $add")
|
||||||
|
if(index($rl, $regex) == -1); # Forum #84372
|
||||||
setReadingsVal($defs{$nn}, "associatedWith", $parentBridge, TimeNow())
|
setReadingsVal($defs{$nn}, "associatedWith", $parentBridge, TimeNow())
|
||||||
if($parentBridge);
|
if($parentBridge);
|
||||||
}
|
}
|
||||||
@ -502,6 +506,8 @@ JSEND
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#########################
|
||||||
|
# Used for the graphical representation in Bridge devices. See Fn above.
|
||||||
sub
|
sub
|
||||||
MQTT2_DEVICE_nlData($)
|
MQTT2_DEVICE_nlData($)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user