MQTT success but unstable

All ESP8266 boards running MicroPython.
Official boards are the Adafruit Huzzah and Feather boards.
Target audience: MicroPython users with an ESP8266 board.
Post Reply
kit
Posts: 4
Joined: Thu Nov 09, 2017 3:41 pm

MQTT success but unstable

Post by kit » Thu Nov 09, 2017 4:20 pm

I have a trouble with a garage door openner on NodeMCU through MQTT.

For example, No problem to test it after debugging at night.
1) MQTT broker: publish & subscribe OK
2) Cell Phone : MQTT client, Connected OK, publish & subscribe OK
3) Flask MQTT web server: OK
4) NodeMCU: subscribe OK, => Relay work
which means I had no trouble with that I can control the garage door using a relay and NodeMCU on the internet.

In the morning, when trying to test again.
4) a relay connected on Node MCU not work. Because not possible to connect to USB port. I can not do check out what has a problem.
1)-3) no problem. I can check it out 2) no problem.

I have checked out NodeMCU's wifi connecting on my router. It has occupied one IP and no problem on that.

After push the 'rst' switch on NodeMCU, problem gone out and OK to run.

Is there any one to experience like this? unstable. It would be appreciated if you give me any advice/solution for this or hint.

User avatar
pythoncoder
Posts: 5956
Joined: Fri Jul 18, 2014 8:01 am
Location: UK
Contact:

Re: MQTT success but unstable

Post by pythoncoder » Thu Nov 09, 2017 6:20 pm

Peter Hinch
Index to my micropython libraries.

kit
Posts: 4
Joined: Thu Nov 09, 2017 3:41 pm

Re: MQTT success but unstable

Post by kit » Fri Nov 10, 2017 2:53 am

I saw the post "unstable MQTT on ESP8266"(+4days)", I get to know you also had the same experience and have tried to fix that. Thanks for your sharing with your experience. And, your reply to the post on 'stackissue' is helpful for my case.

http://stackissue.com/micropython/micro ... -2568.html

I'd better off use your asynchronous non-blocking MQTT driver the above. Surely, I am not familiar with cross-compiling, so it might be a challenge. Or I am considering to go to ESP32 with that.

User avatar
pythoncoder
Posts: 5956
Joined: Fri Jul 18, 2014 8:01 am
Location: UK
Contact:

Re: MQTT success but unstable

Post by pythoncoder » Fri Nov 10, 2017 10:59 am

I should point out the stackissue thread dates from long ago. In particular my final comments re abandoning attempts to make MQTT reliable on the ESP8266 deserve some explanation.

I revisited MQTT last winter and found it easier to get deterministic results. It emerged that the ESP8266 firmware was still flaky when I made my first attempt. By the time of my second attempt the firmware issues had been fixed and the ESP8266 had become a reliable platform.
Peter Hinch
Index to my micropython libraries.

kit
Posts: 4
Joined: Thu Nov 09, 2017 3:41 pm

Re: MQTT success but unstable

Post by kit » Fri Nov 10, 2017 7:24 pm

@pythoncoder It's good news for me to listen to your second attempt's result last winter. I've searched and learned how to compile, flash from source,and cross compiling.

Except for 'boot.py' and 'main.py', I have done cross compiling my previous codes into my module, and finally I put those both files. For now, I can't say that it's successful or not. But, I am sure to say that it gets better because it keeps going for a couple of hours since 'rst'.

I am thinking to develop a program using your robust MQTT module next time. Thanks.

Post Reply