-
Notifications
You must be signed in to change notification settings - Fork 4
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
[Bug] Present omitted if initial mqtt connection fails #15
Comments
Updated by @cimba007 I am not good with github and pull requests but I suggest to change this: mqttClient.connect(WiFi.hostname().c_str(), _mqttUser, _mqttPwd) to int limit = 0;
while(!mqttClient.connect(WiFi.hostname().c_str(), _mqttUser, _mqttPwd) && limit++ < 5)
{
MC_SERIAL.printf("MC[I]: MQTT retry .. %d\n",limit);
mcDelay(500);
} in void MyController::checkMqtt() { |
@cimba007 thank you for the tips and code. I will update. I hope we can delay 3 seconds to retry. What do you think? To create this document might help you. https://gist.github.com/Chaser324/ce0505fbed06b947d962 |
Seems to be fine now. Notice how the initial mqtt connection fails and later the sendInitialStatus() function is called. Nice @jkandasa |
Original issue reported by @cimba007 on mycontroller-org/mycontroller-v1-legacy#425
If I upload a new sketch the mqtt-client does not logoff from the mqtt-server (buildin mycontroller).
On next sketch run presentation is skipped:
I will try .. assume I upload my sketch to the esp8266 and everything is working as expected.
Now I want to upload a new sketch .. the upload process resets the esp8266 and leaves an open mqtt-connection on the broker (the client just vanished and did no proper logoff). Now the new sketch is uploaded .. and tries to connect again to the broker.
The connection fails .. but succeeds after 3 seconds on the next retry.
MyControllerDevice/MyController.cpp
Line 121 in 95ea3ea
The code presented here will be skipped ...
When the yellow part is called
The only check and chance to run
is gone.
I hope this made it a little bit more clear.
The text was updated successfully, but these errors were encountered: