00_MQTT2_SERVER.pm: add lastPublish reading to avoid set-events (Forum #108630)
git-svn-id: https://svn.fhem.de/fhem/trunk@21256 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
@@ -248,6 +248,7 @@ MQTT2_CLIENT_Set($@)
|
|||||||
return "Usage: set $name publish -r topic [value]" if(@a < 1);
|
return "Usage: set $name publish -r topic [value]" if(@a < 1);
|
||||||
my $tp = shift(@a);
|
my $tp = shift(@a);
|
||||||
my $val = join(" ", @a);
|
my $val = join(" ", @a);
|
||||||
|
readingsSingleUpdate($hash, "lastPublish", "$tp:$val", 0);
|
||||||
MQTT2_CLIENT_doPublish($hash, $tp, $val, $retain);
|
MQTT2_CLIENT_doPublish($hash, $tp, $val, $retain);
|
||||||
|
|
||||||
} elsif($a[0] eq "password") {
|
} elsif($a[0] eq "password") {
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ MQTT2_SERVER_Initialize($)
|
|||||||
sslCertPrefix
|
sslCertPrefix
|
||||||
);
|
);
|
||||||
use warnings 'qw';
|
use warnings 'qw';
|
||||||
$hash->{AttrList} = join(" ", @attrList);
|
$hash->{AttrList} = join(" ", @attrList)." ".$readingFnAttributes;
|
||||||
}
|
}
|
||||||
|
|
||||||
#####################################
|
#####################################
|
||||||
@@ -162,6 +162,7 @@ MQTT2_SERVER_Set($@)
|
|||||||
return "Usage: publish -r topic [value]" if(@a < 1);
|
return "Usage: publish -r topic [value]" if(@a < 1);
|
||||||
my $tp = shift(@a);
|
my $tp = shift(@a);
|
||||||
my $val = join(" ", @a);
|
my $val = join(" ", @a);
|
||||||
|
readingsSingleUpdate($hash, "lastPublish", "$tp:$val", 0);
|
||||||
MQTT2_SERVER_doPublish($hash->{CL}, $hash, $tp, $val, $retain);
|
MQTT2_SERVER_doPublish($hash->{CL}, $hash, $tp, $val, $retain);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user