Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MQTT does not reconnect after WIFI reconnecting #35

Closed
xoseperez opened this issue Jan 11, 2017 · 2 comments
Closed

MQTT does not reconnect after WIFI reconnecting #35

xoseperez opened this issue Jan 11, 2017 · 2 comments

Comments

@xoseperez
Copy link
Owner

Steps to reproduce:

  • Connect to a network and a broker
  • Issue a reconnect command (either through the web interface or the terminal)
  • The WIFI reconnects successfully but the MQTT connection keeps dropping
  • Resetting the board connects again both WIFI and MQTT without problem

Possibly, the same happens after a wifi connection drop.

Might be related to marvinroger/async-mqtt-client#30

@xoseperez
Copy link
Owner Author

Fix #35 using stable version of ESPAsyncTCP and updated version of JustWifi to prevent MQTT connection drop after wifi reconnection

@xoseperez
Copy link
Owner Author

Three issues here:

  1. As mentioned in the issue linked from the description, reverting to an old ESPAsyncTCP version fixes the drops in the MQTT connection As it turns out it was the MQTT client not being closed before trying to reconnect. Force disconnection seems to help.
  2. The JustWifi library was disabling STA mode after disconnection (why? ask the developer...). Using latest version of the library fixes that too, fetching it with GIT until PlatformIO update its library repos
  3. Issuing a reconnect from the web interface resulted in a crash. Deferring the disconnection after the HTTP request returns fixes that.

This translates into fixes in code and in the platformio.ini file. Currently in the "dev" branch. Remove the ESPAsyncTCP and JustWifi folder from .piolibdeps and rebuild the project to fetch good versions of both libraries.

xoseperez added a commit that referenced this issue Jan 24, 2018
…stWifi to prevent MQTT connection drop after wifi reconnection
xoseperez pushed a commit that referenced this issue Jan 24, 2018
Support for QuinLED 2.6

Approved-by: Xose Pérez <xose.perez@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant