- Wed Jun 03, 2015 12:56 pm
#19356
Using nodemcu_integer_0.9.6-dev_20150406.bin.
I seem to be having the same issue as Mehrius above.
MQTT runs very stable. Both pub and sub.
However............ I can't start the script with dofile() within any other lua script.
I too noticed that when wifi.sta.status = 1, MQTT would not start.
So, I implemented the code suggested by Mehrius. Now the code reruns init.lua until wifi.sta.status = 5. However........MQTT still hangs.
MQTT will still start and run fine using LuaLoader dofile(), ESPlorer dofile() or ESPlorer's send current line. Even with the first attempt hung.
I did notice what may be a clue!
When dofile('mqtt.lua') is run with wifi.sta.status = 1 there is a 'greater than' symbol ">" on the last line. When wifi.sta.status = 5 the is no 'greater than' symbol.
I have seen this when there is not enough memory to run a script. So. I tried a compiled version of mqtt.lua, same results.
Still, either way, running the dofile() manually starts the MQTT script correctly.
Could this '>' reveal more information?