-->
Page 1 of 1

Help with MQTT and interupt (wdt reset) for WIFI AC dimmer

PostPosted: Mon Dec 18, 2017 11:11 am
by Mogwaiz
Hi everybody.
I am using a slightly modified version of this sketch:
https://github.com/Theb-1/ESP8266-wifi-light-dimmer
It works well but the MQTT part does not have a reconnect function. Consequently, I added a simple reconnect loop with a timer:

if (!mqttClient.connected() && currentMillis - previousMillis >= recoonectinterval) {
setupMQTTClient();
previousMillis = currentMillis;
}

This works somewhat, meaning approximately every second time the it reconnects successfully and the rest result in a wdt reset. It seems to hang in this part:

connectResult = mqttClient.connect("ESP" + ESP.getChipId(), mqtt_user, mqtt_password);

Do any of you have any solution to this? I tried adding yield () both before and after the "connectResult" but without luck.
Thank you!