local mqtt_host = "www.visionexpand.com.cn"
local mqtt_port = 1883
local mqtt_isssl = falselocal client_id = "emqx"
local pub_topic = "$thing/up/property/IQMPOB8BI9/temp/humi"
local sub_topic = "mqtt"
local uart2_data = "text"-- libgnss库初始化libgnss.clear() -- 清空数据,兼初始化
if wdt then wdt.init(9000) sys.timerLoopStart(wdt.feed, 3000) endsys.taskInit(function() if rtos.bsp() == "AIR780E"
then device_id = mobile.imei() sys.waitUntil("IP_READY", 30000)
pub_topic = "$thing/up/property/IQMPOB8BI9/temp/humi" sub_topic = "mqtt"
end log.info("mqtt", "pub", pub_topic) log.info("mqtt", "sub", sub_topic)
local mqttc = mqtt.create(nil, mqtt_host, mqtt_port, mqtt_isssl, nil)
mqttc:auth(client_id, nil, nil) mqttc:autoreconn(true, 3000) mqttc:on(function(mqtt_client, event, data, payload)
if event == "conack" then sys.publish("mqtt_conack") mqtt_client:subscribe(sub_topic)
elseif event == "recv"

最低0.47元/天 解锁文章
2058

被折叠的 条评论
为什么被折叠?



