projects
/
weathermon.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
a637d5d
)
Добавлена опциональная авторизация MQTT
author
Roman Bazalevsky
<rvb@rvb.name>
Thu, 15 Sep 2016 14:45:13 +0000
(17:45 +0300)
committer
Roman Bazalevsky
<rvb@rvb.name>
Thu, 15 Sep 2016 14:45:13 +0000
(17:45 +0300)
weathermon.lua
patch
|
blob
|
history
diff --git
a/weathermon.lua
b/weathermon.lua
index c97983058796ddaf275bcc6c9417d8d69b6da35a..5e193487d37bbdeeca22f122a8ed4f3b35a50a92 100755
(executable)
--- 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_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
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)
command = command.." \""..url.."\""
os.execute(command)
+ print()
end
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_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
mqtt_client:connect(mqtt_id)
json = require( "json" )
end