mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-03-03 10:46:53 +00:00
00_MQTT2_SERVER.pm: Implement deletion of retain topic
git-svn-id: https://svn.fhem.de/fhem/trunk@19753 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
dfa8e462c7
commit
9a06771aa9
@ -154,7 +154,7 @@ MQTT2_SERVER_Set($@)
|
||||
if($a[0] eq "publish") {
|
||||
shift(@a);
|
||||
my $retain;
|
||||
if(@a>2 && $a[0] eq "-r") {
|
||||
if(@a>1 && $a[0] eq "-r") {
|
||||
$retain = 1;
|
||||
shift(@a);
|
||||
}
|
||||
@ -405,9 +405,14 @@ MQTT2_SERVER_doPublish($$$$;$)
|
||||
$src = $server if(!defined($src));
|
||||
|
||||
if($retain) {
|
||||
my $now = gettimeofday();
|
||||
my %h = ( ts=>$now, val=>$val );
|
||||
$server->{retain}{$tp} = \%h;
|
||||
if(!defined($val) || $val eq "") {
|
||||
delete($server->{retain}{$tp});
|
||||
} else {
|
||||
my $now = gettimeofday();
|
||||
my %h = ( ts=>$now, val=>$val );
|
||||
$server->{retain}{$tp} = \%h;
|
||||
}
|
||||
|
||||
|
||||
# Save it
|
||||
my %nots = map { $_ => $server->{retain}{$_}{val} }
|
||||
|
Loading…
x
Reference in New Issue
Block a user