2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-03-03 16:56:54 +00:00

10_MQTT2_DEVICE.pm: add autocreate (Forum #94060)

00_MQTT2_SERVER.pm: change default from 0 to 1.


git-svn-id: https://svn.fhem.de/fhem/trunk@17953 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
rudolfkoenig 2018-12-11 14:44:34 +00:00
parent e9e5ebe83f
commit 107b3c3e43
3 changed files with 15 additions and 6 deletions

View File

@ -36,9 +36,9 @@ MQTT2_CLIENT_Initialize($)
no warnings 'qw';
my @attrList = qw(
autocreate
autocreate:1,0
clientId
disable:0,1
disable:1,0
disabledForIntervals
lwt
lwtRetain

View File

@ -40,7 +40,7 @@ MQTT2_SERVER_Initialize($)
no warnings 'qw';
my @attrList = qw(
SSL:0,1
autocreate
autocreate:0,1
disable:0,1
disabledForIntervals
keepaliveFactor
@ -418,7 +418,7 @@ MQTT2_SERVER_doPublish($$$$;$)
if(defined($src->{cid})) { # "real" MQTT client
my $cid = $src->{cid};
$cid =~ s,[^a-z0-9._],_,gi;
my $ac = AttrVal($tgt->{NAME}, "autocreate", undef) ? "autocreate:":"";
my $ac = AttrVal($tgt->{NAME}, "autocreate", 1) ? "autocreate:":"";
Dispatch($tgt, "$ac$cid:$tp:$val", undef, !$ac);
my $re = AttrVal($tgt->{NAME}, "rawEvents", undef);
DoTrigger($tgt->{NAME}, "$tp:$val") if($re && $tp =~ m/$re/);
@ -612,8 +612,8 @@ MQTT2_SERVER_getStr($$)
<a name="autocreate"></a>
<li>autocreate<br>
If set, MQTT2_DEVICES will be automatically created upon receiving an
unknown message.
MQTT2_DEVICES will be automatically created upon receiving an
unknown message. Set this value to 0 to disable autocreating.
</li><br>
</ul>

View File

@ -22,6 +22,7 @@ MQTT2_DEVICE_Initialize($)
no warnings 'qw';
my @attrList = qw(
IODev
autocreate:0,1
bridgeRegexp:textField-long
devicetopic
disable:0,1
@ -173,6 +174,7 @@ MQTT2_DEVICE_Parse($$)
for my $ch (@{$cidArr}) {
my $nn = $ch->{NAME};
next if(!AttrVal($nn, "autocreate", 1));
my $rl = AttrVal($nn, "readingList", "");
$rl .= "\n" if($rl);
my $regexpCid = ($cid eq $newCid ? "$cid:" : "");
@ -483,6 +485,13 @@ zigbee2mqtt_devStateIcon255($)
<b>Attributes</b>
<ul>
<a name="autocreate"></a>
<li>autocreate {0|1}<br>
if set to 0, disables extending the readingList, when the IODev
autocreate is also set. Default is 1, i.e. new topics will be
automatically added to the readingList.
</li>
<a name="bridgeRegexp"></a>
<li>bridgeRegexp &lt;regexp&gt; newClientId ...<br>
Used to automatically redirect some types of topics to different