-->
Page 1 of 1

Unable to connect to MQTT subscriber

PostPosted: Sat Feb 06, 2016 3:55 am
by mykhanpk
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!

Re: Unable to connect to MQTT subscriber

PostPosted: Tue Feb 09, 2016 10:18 pm
by mykhanpk
Just found that those modules default firmware

AT-based firmware detected.
AT+GMR

AT version:0.40.0.0(Aug 8 2015 14:45:58)
SDK version:1.3.0
Ai-Thinker Technology Co.,Ltd.
Build:1.3.0.2 Sep 11 2015 11:48:04
OK