From 554351304ba5039e6b97f33729b3909eac0618d3 Mon Sep 17 00:00:00 2001 From: Roman Bazalevsky Date: Thu, 15 Sep 2016 17:45:13 +0300 Subject: [PATCH 1/1] =?utf8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5?= =?utf8?q?=D0=BD=D0=B0=20=D0=BE=D0=BF=D1=86=D0=B8=D0=BE=D0=BD=D0=B0=D0=BB?= =?utf8?q?=D1=8C=D0=BD=D0=B0=D1=8F=20=D0=B0=D0=B2=D1=82=D0=BE=D1=80=D0=B8?= =?utf8?q?=D0=B7=D0=B0=D1=86=D0=B8=D1=8F=20MQTT?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- weathermon.lua | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/weathermon.lua b/weathermon.lua index c979830..5e19348 100755 --- a/weathermon.lua +++ b/weathermon.lua @@ -59,6 +59,9 @@ function getConfig() mqtt_topic = cur.get(config,"mqtt","topic") mqtt_alarm_topic = cur.get(config,"mqtt","alarm_topic") + mqtt_user = cur.get(config,"mqtt","user") + mqtt_passwd = cur.get(config,"mqtt","password") + if mqtt_host and not mqtt_id then mqtt_id="weather-"..web_devid end @@ -129,6 +132,7 @@ function submitValue(type,id,param,val) command = command.." \""..url.."\"" os.execute(command) + print() end @@ -216,6 +220,9 @@ getConfig() if mqtt_host then MQTT = require "paho.mqtt" mqtt_client = MQTT.client.create(mqtt_host, mqtt_port) + if mqtt_user then + mqtt_client:auth(mqtt_user, mqtt_passwd) + end mqtt_client:connect(mqtt_id) json = require( "json" ) end -- 2.34.1