2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-03-10 09:16:53 +00:00

00_MQTT2_SERVER.pm: no LWT if there is another connection with same ip+cid (Forum #90145)

git-svn-id: https://svn.fhem.de/fhem/trunk@17205 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
rudolfkoenig 2018-08-25 14:37:35 +00:00
parent 0e3457d7f0
commit 1a78533733

View File

@ -102,6 +102,19 @@ MQTT2_SERVER_Undef($@)
ReadingsVal($sname, "nrclients", 1)-1, 1);
if($hash->{lwt}) { # Last will
# skip lwt if there is another connection with the same ip+cid (tasmota??)
for my $dev (keys %defs) {
my $h = $defs{$dev};
next if($h->{TYPE} ne $hash->{TYPE} ||
$h->{NR} == $hash->{NR} ||
!$h->{cid} || $h->{cid} ne $hash->{cid} ||
!$h->{PEER} || $h->{PEER} ne $hash->{PEER});
Log3 $shash, 4,
"Closing second connection for $h->{cid}/$h->{PEER} without lwt";
return $ret;
}
my ($tp, $val) = split(':', $hash->{lwt}, 2);
MQTT2_SERVER_doPublish($hash, $shash, $tp, $val, $hash->{cflags} & 0x20);
}