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

10_MQTT2_DEVICE.pm: do not escape value for perl

fhem.pl: check if associatedWith exists


git-svn-id: https://svn.fhem.de/fhem/trunk@18381 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
rudolfkoenig 2019-01-22 18:29:59 +00:00
parent bad461dc84
commit 3e7bab9506
2 changed files with 4 additions and 4 deletions

View File

@ -179,9 +179,9 @@ MQTT2_DEVICE_Parse($$)
if(!$add) {
$topic =~ m,.*/([^/]+),;
$add = ($1 ? $1 : $topic);
$add = makeReadingName($add); # Convert non-valid characters to _
}
$add = makeReadingName($add); # Convert non-valid characters to _
$topic =~ s,([\^\$\[\]()\.\\]),\\$1,g;
for my $ch (@{$cidArr}) {
@ -193,7 +193,7 @@ MQTT2_DEVICE_Parse($$)
CommandAttr(undef, "$nn readingList $rl$regex $add")
if(index($rl, $regex) == -1); # Forum #84372
setReadingsVal($defs{$nn}, "associatedWith", $parentBridge, TimeNow())
if($parentBridge);
if($parentBridge && $defs{$nn});
}
MQTT2_DEVICE_Parse($iodev, $msg);
}, undef);

View File

@ -2651,7 +2651,7 @@ CommandRename($$)
my $aw = ReadingsVal($d, "associatedWith", "");
next if($aw !~ m/\b$old\b/);
$aw =~ s/\b$old\b/$new/;
setReadingsVal($defs{$d}, "associatedWith", $aw, TimeNow());
setReadingsVal($defs{$d}, "associatedWith", $aw, TimeNow()) if($defs{$d});
}
addStructChange("rename", $new, $param);
@ -5664,7 +5664,7 @@ getPawList($)
}
}
my $aw = ReadingsVal($d, "associatedWith", ""); # Explicit link
push(@dob, split("[ ,]",$aw)) if($aw);
push(@dob, grep { $defs{$_} } split("[ ,]",$aw)) if($aw);
return @dob;
}