diff --git a/fhem/FHEM/00_MQTT2_CLIENT.pm b/fhem/FHEM/00_MQTT2_CLIENT.pm
index 79cc82e05..cb08b562a 100644
--- a/fhem/FHEM/00_MQTT2_CLIENT.pm
+++ b/fhem/FHEM/00_MQTT2_CLIENT.pm
@@ -20,11 +20,7 @@ MQTT2_CLIENT_Initialize($)
{
my ($hash) = @_;
- $hash->{Clients} = ":MQTT2_DEVICE:MQTT_GENERIC_BRIDGE:";
- $hash->{MatchList}= {
- "1:MQTT2_DEVICE" => "^.*",
- "2:MQTT_GENERIC_BRIDGE" => "^.*"
- };
+ MQTT2_CLIENT_resetClients($hash);
$hash->{ReadFn} = "MQTT2_CLIENT_Read";
$hash->{DefFn} = "MQTT2_CLIENT_Define";
$hash->{AttrFn} = "MQTT2_CLIENT_Attr";
@@ -39,6 +35,7 @@ MQTT2_CLIENT_Initialize($)
my @attrList = qw(
autocreate:no,simple,complex
clientId
+ clientOrder
disable:1,0
disabledForIntervals
disconnectAfter
@@ -61,6 +58,19 @@ MQTT2_CLIENT_Initialize($)
$hash->{AttrList} = join(" ", @attrList)." ".$readingFnAttributes;
}
+sub
+MQTT2_CLIENT_resetClients($)
+{
+ my ($hash) = @_;
+
+ $hash->{Clients} = ":MQTT2_DEVICE:MQTT_GENERIC_BRIDGE:";
+ $hash->{MatchList}= {
+ "1:MQTT2_DEVICE" => "^.",
+ "2:MQTT_GENERIC_BRIDGE" => "^."
+ };
+ delete($hash->{".clientArray"});
+}
+
#####################################
sub
MQTT2_CLIENT_Define($$)
@@ -319,6 +329,20 @@ MQTT2_CLIENT_Attr(@)
}, undef, 0);
}
+ if($attrName eq "clientOrder") {
+ if($type eq "set") {
+ my @p = split(" ", $param[0]);
+ $modules{MQTT2_CLIENT}{Clients} = ":".join(":",@p).":";
+ my $cnt = 1;
+ my %h = map { ($cnt++.":$_", "^.") } @p;
+ $modules{MQTT2_CLIENT}{MatchList} = \%h;
+ delete($modules{MQTT2_CLIENT}{".clientArray"}); # Force a recompute
+ } else {
+ MQTT2_CLIENT_resetClients($modules{MQTT2_CLIENT});
+ }
+ }
+
+
return undef;
}
@@ -701,6 +725,14 @@ MQTT2_CLIENT_getStr($$)
is used, after deleting everything outside 0-9a-zA-Z
+
+
clientOrder [MQTT2_DEVICE] [MQTT_GENERIC_BRIDGE]
+ set the notification order for client modules. This is
+ relevant when autocreate is active, and the default order
+ (MQTT2_DEVICE MQTT_GENERIC_BRIDGE) is not adequate.
+ Note: Changing the attribute affects _all_ MQTT2_CLIENT instances.
+
+
disable
disabledForIntervals
disable dispatching of messages.
diff --git a/fhem/FHEM/00_MQTT2_SERVER.pm b/fhem/FHEM/00_MQTT2_SERVER.pm
index 7b40ed36e..392ebf400 100644
--- a/fhem/FHEM/00_MQTT2_SERVER.pm
+++ b/fhem/FHEM/00_MQTT2_SERVER.pm
@@ -21,11 +21,7 @@ MQTT2_SERVER_Initialize($)
{
my ($hash) = @_;
- $hash->{Clients} = ":MQTT2_DEVICE:MQTT_GENERIC_BRIDGE:";
- $hash->{MatchList}= {
- "1:MQTT2_DEVICE" => "^.*",
- "2:MQTT_GENERIC_BRIDGE" => "^.*"
- };
+ MQTT2_SERVER_resetClients($hash);
$hash->{ReadFn} = "MQTT2_SERVER_Read";
$hash->{DefFn} = "MQTT2_SERVER_Define";
$hash->{AttrFn} = "MQTT2_SERVER_Attr";
@@ -40,6 +36,7 @@ MQTT2_SERVER_Initialize($)
SSL:0,1
autocreate:no,simple,complex
clientId
+ clientOrder
disable:1,0
disabledForIntervals
ignoreRegexp
@@ -53,6 +50,19 @@ MQTT2_SERVER_Initialize($)
$hash->{AttrList} = join(" ", @attrList)." ".$readingFnAttributes;
}
+sub
+MQTT2_SERVER_resetClients($)
+{
+ my ($hash) = @_;
+
+ $hash->{Clients} = ":MQTT2_DEVICE:MQTT_GENERIC_BRIDGE:";
+ $hash->{MatchList}= {
+ "1:MQTT2_DEVICE" => "^.",
+ "2:MQTT_GENERIC_BRIDGE" => "^."
+ };
+ delete($hash->{".clientArray"});
+}
+
#####################################
sub
MQTT2_SERVER_Define($$)
@@ -148,6 +158,19 @@ MQTT2_SERVER_Attr(@)
return "bad $devName ignoreRegexp: $re: $@" if($@);
}
+ if($attrName eq "clientOrder") {
+ if($type eq "set") {
+ my @p = split(" ", $param[0]);
+ $modules{MQTT2_SERVER}{Clients} = ":".join(":",@p).":";
+ my $cnt = 1;
+ my %h = map { ($cnt++.":$_", "^.") } @p;
+ $modules{MQTT2_SERVER}{MatchList} = \%h;
+ delete($modules{MQTT2_SERVER}{".clientArray"}); # Force a recompute
+ } else {
+ MQTT2_SERVER_resetClients($modules{MQTT2_SERVER});
+ }
+ }
+
return undef;
}
@@ -645,6 +668,14 @@ MQTT2_SERVER_ReadDebug($$)
attributes.
+
+ clientOrder [MQTT2_DEVICE] [MQTT_GENERIC_BRIDGE]
+ set the notification order for client modules. This is
+ relevant when autocreate is active, and the default order
+ (MQTT2_DEVICE MQTT_GENERIC_BRIDGE) is not adequate.
+ Note: Changing the attribute affects _all_ MQTT2_SERVER instances.
+
+
disable
disabledForIntervals
disable distribution of messages. The server itself will accept and store