Open IgnacioCipo opened 2 years ago
Have you tried setting your KeepAlive to somethjng longer? Perhaps 45?
Also, I was having issues with PubSub and the current version of espressif32. In the platformio.ini file, I set my platform to:
platform = espressif32@^3.5.0
and my connection issues resolved. Good luck!
Have you tried setting your KeepAlive to somethjng longer? Perhaps 45?
Also, I was having issues with PubSub and the current version of espressif32. In the platformio.ini file, I set my platform to:
platform = espressif32@^3.5.0
and my connection issues resolved. Good luck!
Hi! I´ve tried setting KeepAlive to bigger values, but not changes. I will try changing my platformio.ini file, thank you for the advice!
Same, will not reconnect..
Oct 3 19:45:35 ESP_env 192.168.20.58 ESP:[INFO]- [MQTT] try client re-connect Oct 3 19:45:38 ESP_env 192.168.20.58 ESP:[ERROR]- [ERROR] [MQTT] failed, rc=-2
did you get any news on this @IgnacioCipo ?
Still no idea what the root cause is, really starting to piss me off
Same issue, MQTTBox and my other servers can connect to the broker just fine, esp can not.
I have tried to debug this but it seems to be deep in the wificlient library and since these are all abstracted classes, I could not really follow it to where it was failing. I basically gave up as I spent too much time on it. Someone with knowledge of these classes might have better luck tracing it, or have actual debuggers setup.
I have a suspicion its a socket issue in the esp lib
I ended up moving away from PubSubClient
in favour of this library https://github.com/paclema/MQTTClient it works very well, and is even async on the ESP32. So far, i am really enjoying working with it, especially since it uses the espressif native mqtt api's.
@ZanzyTHEbar checking it out now, thanks!
I'm using ESP32 with Platformio in Arduino code. I am sending information with a SIM800 through MQTT using Pubsubclient and TinyGSM to a .net broker using FreeRTOS. ESP32 starts and all works fine, I have a function to check if the MQTT connection is still ON, and if it disconnects, reconnects it. This is working, but after some time the MQTT connection is lost and it is not able to reconnect anymore. The only way to connect the ESP32 back to MQTT is rebooting it. I´ve checked if the problem comes from the server side where the MQTT broker is, but it is not. When ESP32 is trying to reconnect, I´ve reset the server and the problem persist. I´ve checked SIM800 connectivity and it algo is good. This is my task that checks for MQTT connection each half minute.
This are the function calling to check MQTT:
I´ve been dealing with this problem too much time. I would appreciate any tips. Thanks!