mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-03-10 09:16:53 +00:00
00_MQTT2_SERVER.pm: add clientOrder attribute (Forum #117737)
git-svn-id: https://svn.fhem.de/fhem/trunk@23538 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
82fa0ca9be
commit
dc81ec9f42
@ -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
|
||||
</li></br>
|
||||
|
||||
<a name="MQTT2_CLIENTclientOrder"></a>
|
||||
<li>clientOrder [MQTT2_DEVICE] [MQTT_GENERIC_BRIDGE]<br>
|
||||
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.
|
||||
</li></br>
|
||||
|
||||
<li><a href="#disable">disable</a><br>
|
||||
<a href="#disabledForIntervals">disabledForIntervals</a><br>
|
||||
disable dispatching of messages.
|
||||
|
@ -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.
|
||||
</li></br>
|
||||
|
||||
<a name="MQTT2_SERVERclientOrder"></a>
|
||||
<li>clientOrder [MQTT2_DEVICE] [MQTT_GENERIC_BRIDGE]<br>
|
||||
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.
|
||||
</li></br>
|
||||
|
||||
<li><a href="#disable">disable</a><br>
|
||||
<a href="#disabledForIntervals">disabledForIntervals</a><br>
|
||||
disable distribution of messages. The server itself will accept and store
|
||||
|
Loading…
x
Reference in New Issue
Block a user