2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-04-21 07:56:03 +00:00

00_MQTT2_CLIENT.pm: delete readingList when setting bridgeRegexp (Forum #84790)

git-svn-id: https://svn.fhem.de/fhem/trunk@17712 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
rudolfkoenig 2018-11-09 09:24:03 +00:00
parent ab50bff79f
commit 9b3432965f
2 changed files with 13 additions and 3 deletions

View File

@ -270,7 +270,7 @@ MQTT2_CLIENT_Read($@)
if(AttrVal($name, "verbose", 1) >= 5) { if(AttrVal($name, "verbose", 1) >= 5) {
my $pltxt = $pl; my $pltxt = $pl;
$pltxt =~ s/([^ -~])/"(".ord($1).")"/ge; $pltxt =~ s/([^ -~])/"(".ord($1).")"/ge;
Log3 $name, 5, "$cpt: $pltxt"; Log3 $name, 5, "$name: received $cpt $pltxt";
} }
#################################### ####################################
@ -328,6 +328,7 @@ MQTT2_CLIENT_doPublish($$$$)
my $name = $hash->{NAME}; my $name = $hash->{NAME};
return if(IsDisabled($name)); return if(IsDisabled($name));
$val = "" if(!defined($val)); $val = "" if(!defined($val));
Log3 $name, 5, "$name: sending PUBLISH $topic $val";
addToWritebuffer($hash, addToWritebuffer($hash,
pack("C",0x30). pack("C",0x30).
MQTT2_CLIENT_calcRemainingLength(2+length($topic)+length($val)). MQTT2_CLIENT_calcRemainingLength(2+length($topic)+length($val)).

View File

@ -332,6 +332,12 @@ MQTT2_DEVICE_Attr($$)
return "$dev $attrName regexp error: $@" if($@); return "$dev $attrName regexp error: $@" if($@);
$modules{MQTT2_DEVICE}{defptr}{bridge}{$par1} = $par2; $modules{MQTT2_DEVICE}{defptr}{bridge}{$par1} = $par2;
} }
if($init_done) {
my $name = $hash->{NAME};
AnalyzeCommandChain(undef,
"deleteattr $name readingList; deletereading $name .*");
}
} }
return undef; return undef;
@ -437,9 +443,12 @@ MQTT2_DEVICE_Undef($$)
will create different MQTT2_DEVICE instances for different hex numbers in will create different MQTT2_DEVICE instances for different hex numbers in
the topic. Note: the newClientId is enclosed in "", as it is a perl the topic. Note: the newClientId is enclosed in "", as it is a perl
expression, should be unique, and the automatically created device will expression, should be unique, and the automatically created device will
be created also with this name. be created also with this name.<br>
<br>
Multiple tuples of &lt;regexp&gt; newClientId are separated by newline. Multiple tuples of &lt;regexp&gt; newClientId are separated by newline.
<br>
Note: setting bridgeRegexp will remove th readingList attribute and all
readings.
</li><br> </li><br>
<a name="devicetopic"></a> <a name="devicetopic"></a>