25.11.2022, 08:57
Hello, i'm new to the LUA language and to the LM interface and i need a bit of help.
Right now i have the following script in wich i get a string from a MQTT Topic and now i want to get that string and send it via BacNet to another system.
broker = '172.30.10.185' -- default port is 1883
username = 'icosaedro' -- device serial
password = 'hola' -- device credentials
topic = "Habitacion_02/a848faf8cb70/status"
mqtt = require('mosquitto')
client = mqtt.new()
client.ON_CONNECT = function(status, rc, err)
if status then
log('connect ok')
client:subscribe(topic)
else
log('connect error', rc, err)
end
end
client.ON_MESSAGE = function(mid, topic, data)
log('message',topic, data)
end
client:login_set(username, password)
client:connect(broker)
client:loop_forever()
Firts of all i would like to know if i'm doing "Overexcessive" struggle and i can just put the string in a variable and then send it to a bacnet object or how can i get the value from the log and create a bacnet object that i could send later from another software.
Thank you very much!!
Right now i have the following script in wich i get a string from a MQTT Topic and now i want to get that string and send it via BacNet to another system.
broker = '172.30.10.185' -- default port is 1883
username = 'icosaedro' -- device serial
password = 'hola' -- device credentials
topic = "Habitacion_02/a848faf8cb70/status"
mqtt = require('mosquitto')
client = mqtt.new()
client.ON_CONNECT = function(status, rc, err)
if status then
log('connect ok')
client:subscribe(topic)
else
log('connect error', rc, err)
end
end
client.ON_MESSAGE = function(mid, topic, data)
log('message',topic, data)
end
client:login_set(username, password)
client:connect(broker)
client:loop_forever()
Firts of all i would like to know if i'm doing "Overexcessive" struggle and i can just put the string in a variable and then send it to a bacnet object or how can i get the value from the log and create a bacnet object that i could send later from another software.
Thank you very much!!
Martí.