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

00_MQTT: Added username password (optional).

git-svn-id: https://svn.fhem.de/fhem/trunk@12937 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
eisler 2017-01-02 20:01:32 +00:00
parent 559c2d13c9
commit 3ddbc911bd
3 changed files with 177 additions and 166 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: Added username password (optional).
- feature: 41_OREGON: support event-min-interval, event-on-change-reading,
etc. Changed module to new log function
added support for THWR800 and RTHN318 sensors

View File

@ -2,7 +2,8 @@
#
# fhem bridge to mqtt (see http://mqtt.org)
#
# Copyright (C) 2014 Norbert Truchsess
# Copyright (C) 2017 Stephan Eisler
# Copyright (C) 2014 - 2016 Norbert Truchsess
#
# This file is part of fhem.
#
@ -157,8 +158,14 @@ sub Attr($$$$) {
sub Start($) {
my $hash = shift;
my ($dev) = split("[ \t]+", $hash->{DEF});
my ($dev,$username,$password) = split("[ \t]+", $hash->{DEF});
$hash->{DeviceName} = $dev;
if(defined($username) && $username ne "") {
$hash->{username} = $username;
}
if(defined($password) && $password ne "") {
$hash->{password} = $password;
}
DevIo_CloseDev($hash);
return DevIo_OpenDev($hash, 0, "MQTT::Init");
}
@ -335,7 +342,7 @@ sub Read {
sub send_connect($) {
my $hash = shift;
return send_message($hash, message_type => MQTT_CONNECT, keep_alive_timer => $hash->{timeout});
return send_message($hash, message_type => MQTT_CONNECT, keep_alive_timer => $hash->{timeout}, user_name => $hash->{username}, password => $hash->{password});
};
sub send_publish($@) {
@ -513,6 +520,7 @@ sub client_stop($) {
1;
=pod
=item summary connects fhem to MQTT
=begin html
<a name="MQTT"></a>
@ -525,7 +533,7 @@ sub client_stop($) {
<a name="MQTTdefine"></a>
<p><b>Define</b></p>
<ul>
<p><code>define &lt;name&gt; MQTT &lt;ip:port&gt;</code></p>
<p><code>define &lt;name&gt; MQTT &lt;ip:port&gt; [&lt;username&gt;] [&lt;password&gt;]</code></p>
<p>Specifies the MQTT device.</p>
</ul>
<a name="MQTTset"></a>

View File

@ -26,7 +26,7 @@ FHEM/00_HXB.pm neubert http://forum.fhem.de Sonstige
FHEM/00_KM271.pm physikus http://forum.fhem.de Sonstiges
FHEM/00_LIRC.pm rudolfkoenig http://forum.fhem.de Sonstiges
FHEM/00_MAXLAN.pm mgehre http://forum.fhem.de MAX
FHEM/00_MQTT.pm ntruchsess http://forum.fhem.de Sonstige Systeme
FHEM/00_MQTT.pm eisler http://forum.fhem.de Sonstige Systeme
FHEM/00_MYSENSORS.pm ntruchsess http://forum.fhem.de Sonstige Systeme
FHEM/00_NetzerI2C.pm klausw http://forum.fhem.de Sonstige Systeme
FHEM/00_OWX.pm pahenning/ntruchsess http://forum.fhem.de 1Wire
@ -61,8 +61,8 @@ FHEM/10_IT.pm dancer0705/bjoernh http://forum.fhem.de InterTech
FHEM/10_Itach_IR ulimaass http://forum.fhem.de Sonstige Systeme
FHEM/10_KOPP_FC.pm raspii http://forum.fhem.de/index.php/topic,32048.30.html#lastPost
FHEM/10_MAX.pm mgehre http://forum.fhem.de MAX
FHEM/10_MQTT_BRIDGE ntruchsess http://forum.fhem.de Sonstige Systeme
FHEM/10_MQTT_DEVICE ntruchsess http://forum.fhem.de Sonstige Systeme
FHEM/10_MQTT_BRIDGE eisler http://forum.fhem.de Sonstige Systeme
FHEM/10_MQTT_DEVICE eisler http://forum.fhem.de Sonstige Systeme
FHEM/10_MYSENSORS_DEVICE ntruchsess http://forum.fhem.de Sonstige Systeme
FHEM/10_OWServer.pm neubert/mfr69bs http://forum.fhem.de 1Wire
FHEM/10_SOMFY.pm viegener http://forum.fhem.de Sonstige Systeme
@ -437,6 +437,8 @@ FHEM/YahooWeatherAPI.pm neubert http://forum.fhem.de Unterstue
FHEM/lib/Device/Firmata/* ntruchsess http://forum.fhem.de Sonstige Systeme
FHEM/lib/Device/MySensors/* ntruchsess http://forum.fhem.de Sonstige Systeme
FHEM/lib/MP3/* Reinerlein http://forum.fhem.de Multimedia
FHEM/lib/Net/MQTT.pod eisler http://forum.fhem.de Sonstige Systeme
FHEM/lib/Net/MQTT/* eisler http://forum.fhem.de Sonstige Systeme
FHEM/lib/ProtoThreads.pm ntruchsess http://forum.fhem.de FHEM Development
FHEM/lib/SHC_packet_layout.xml rr2000 http://forum.fhem.de Sonstige Systeme
FHEM/lib/SWAP/* justme1968 http://forum.fhem.de Sonstige Systeme