Unable to connect to MQTT subscriber
Posted: Sat Feb 06, 2016 3:55 am
I am newbie in nodemcu programming.
I am unable to publish message to a subscriber from nodemcu. Modules are purchased from aliexpress.
With default lolin firmware com port is printing garbage on putty (9600 to 115200). So decided to upgrade the firmware. download two firmwares.
1.nodemcu_integer_0.9.6-dev_20150704 from offical location
2.nodemcu-master-9-modules-2016-02-05-13-08-53-integer from nodemcu-build with options(dht file gpio mqtt net node tmr uart wifi)
After upgrading above firmware i am successfully connected to wifi router and get ip.
Problem: MQTT broker is running on two systems (laptop win8.1 and orange pi with customized raspberry pi os.) I am unable to send messages from nodeMCU but other two i.e. laptop and orange pi can send messages to each others.
I have minimized the code as under.
-- code on nodemcu lolin
wifi.setmode(wifi.STATION)
wifi.sta.config ("Evo-MYK", "abcdefghij")
print(wifi.sta.getip()) <--this line show ip on the console.
m = mqtt.Client("MYK-ESP02",120,"","")
m:lwt("/lwt", "offline", 0, 0)
m:connect("192.168.1.100", 1883, 0, 1, function(client) print("connected") end) <-- this line dosen't return anything.
m:publish("home/s1","hello ....",0,0, function(client) print("sent") end) <--this line throws error not connected.
Please help!
I am unable to publish message to a subscriber from nodemcu. Modules are purchased from aliexpress.
With default lolin firmware com port is printing garbage on putty (9600 to 115200). So decided to upgrade the firmware. download two firmwares.
1.nodemcu_integer_0.9.6-dev_20150704 from offical location
2.nodemcu-master-9-modules-2016-02-05-13-08-53-integer from nodemcu-build with options(dht file gpio mqtt net node tmr uart wifi)
After upgrading above firmware i am successfully connected to wifi router and get ip.
Problem: MQTT broker is running on two systems (laptop win8.1 and orange pi with customized raspberry pi os.) I am unable to send messages from nodeMCU but other two i.e. laptop and orange pi can send messages to each others.
I have minimized the code as under.
-- code on nodemcu lolin
wifi.setmode(wifi.STATION)
wifi.sta.config ("Evo-MYK", "abcdefghij")
print(wifi.sta.getip()) <--this line show ip on the console.
m = mqtt.Client("MYK-ESP02",120,"","")
m:lwt("/lwt", "offline", 0, 0)
m:connect("192.168.1.100", 1883, 0, 1, function(client) print("connected") end) <-- this line dosen't return anything.
m:publish("home/s1","hello ....",0,0, function(client) print("sent") end) <--this line throws error not connected.
Please help!