Add ability to connect to protected MQTT server

Signed-off-by: Gérondal Thibault <contact@tycale.be>
This commit is contained in:
Gérondal Thibault
2018-12-29 20:17:33 +01:00
parent 97cf57d0a3
commit 56478b1559
2 changed files with 7 additions and 3 deletions

View File

@@ -1,5 +1,7 @@
{
"host": "localhost",
"port": 1883,
"topic": "tuya/"
}
"topic": "tuya/",
"mqtt_user": "",
"mqtt_pass": ""
}

View File

@@ -27,7 +27,9 @@ try {
const mqtt_client = mqtt.connect({
host: CONFIG.host,
port: CONFIG.port
port: CONFIG.port,
username: CONFIG.mqtt_user,
password: CONFIG.mqtt_pass,
});
mqtt_client.on('connect', function (err) {