You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jan 11, 2020. It is now read-only.
I have a problem that my Basecamp device doesn't automaticall reconnect to the MQTT Broker after the broker was restarted (e.g. after a server update).
Is there a possibility to configure Basecamp to automatically reconnect WiFi and MQTT after a connection lost?
Thank you very much.
The text was updated successfully, but these errors were encountered:
I also found out that polling the "MQTT Disconnect" too frequently is messing up the MQTT Library or TCP connection. Especially no attempts should be made to reconnect while the last reconnect actions have not completely finished.
I added a delay of 30 seconds here:
vTaskDelay(30000); // wait for all OnConnect Actions are completed
In addition we should wait some 2 seconds after a disconnect has been detected:
vTaskDelay(2000); // wait until try to connect ^= Timer 2 Seconds in example FullyFeatured-ESP32.ino
All in all polling the flag "mqtt->connected()", which is internally the variable "_connected" is not a good idea. It would be better to use a callback function "onMqttDisconnect" to trigger the reconnect, like it is done in the "FullyFeatured-ESP32.ino" example.
I will try and implement this and make a pull-request when I have it ready.
For the time being you might replace the function
void Basecamp::MqttHandling(void *mqttPointer)
in your "basecamp.cpp" with the one I attached. I intentionally put all original code only in comments, so you can see what I changed.
If have made several tests, with MQTT broker (mosquitto) stopped and started, LAN connection unplugged, WLAN/WiFi disabled on Fritzbox …. and I always got re-connected afterwards.
Hello,
I have a problem that my Basecamp device doesn't automaticall reconnect to the MQTT Broker after the broker was restarted (e.g. after a server update).
Is there a possibility to configure Basecamp to automatically reconnect WiFi and MQTT after a connection lost?
Thank you very much.
The text was updated successfully, but these errors were encountered: