2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-03-03 10:46:53 +00:00

00_MQTT: new attribute "client-id"

git-svn-id: https://svn.fhem.de/fhem/trunk@16223 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
eisler 2018-02-19 18:26:50 +00:00
parent a38d32554a
commit 209738570e
2 changed files with 12 additions and 2 deletions

View File

@ -1,5 +1,6 @@
# Add changes at the top of the list. Keep it in ASCII, and 80-char wide.
# Do not insert empty lines here, update check depends on it.
- feature: 00_MQTT: new attribute "client-id"
- feature: 93_DbRep: V7.13.0, changeValue may use perlcode {} as "new string"
- feature: 93_DbRep: V7.12.0, compression of dumpfile, restore of compressed
files possible

View File

@ -59,7 +59,7 @@ sub MQTT_Initialize($) {
$hash->{NotifyFn} = "MQTT::Notify";
$hash->{AttrFn} = "MQTT::Attr";
$hash->{AttrList} = "keep-alive "."last-will "."on-connect on-disconnect on-timeout ".$main::readingFnAttributes;
$hash->{AttrList} = "keep-alive "."last-will client-id "."on-connect on-disconnect on-timeout ".$main::readingFnAttributes;
}
package MQTT;
@ -564,9 +564,10 @@ sub send_connect($) {
my $pass = getKeyValue($name."_pass");
my $lw = AttrVal($name,"last-will",undef);
my $clientId = AttrVal($name,"client-id",undef);
my ($willqos, $willretain,$willtopic, $willmessage) = parsePublishCmdStr($lw);
return send_message($hash, message_type => MQTT_CONNECT, keep_alive_timer => $hash->{timeout}, user_name => $user, password => $pass, will_topic => $willtopic, will_message => $willmessage, will_retain => $willretain, will_qos => $willqos);
return send_message($hash, message_type => MQTT_CONNECT, keep_alive_timer => $hash->{timeout}, user_name => $user, password => $pass, client_id=>$clientId, will_topic => $willtopic, will_message => $willmessage, will_retain => $willretain, will_qos => $willqos);
};
sub send_publish($@) {
@ -878,6 +879,14 @@ sub client_stop($) {
<code>attr mqtt last-will /fhem/status crashed</code>
</p>
</li>
<li>
<p><code>attr &lt;name&gt; client-id client id</code><br/>
redefines client id
</p>
<p>example:<br/>
<code>attr mqtt client-id fhem1234567</code>
</p>
</li>
<li>
<p>on-connect, on-disconnect<br/>
<code>attr &lt;name&gt; on-connect {Perl-expression} &lt;topic&gt; &lt;message&gt;</code><br/>