Example sketches for the new Arduino IDE for ESP8266

Moderator: igrr

User avatar
By jenseisen
#20441 Hello,
I am trying around with mqtt and mosquitto. Therefore I have installed mosquitto on a virtual box debian on my computer.
So, in the evening, I switch it off.
Unfortunately, after switching it on in the morning, the esp8266 is not accepting any more mqtt-messages or sending some.
I thought, mqtt is made for bad connections and reconnects when the connection is on again and then sends the message again. How can I solve this. I do not like to go around in the house later when I have a real server and some lights connected to reboot the esps.

Any clue?
User avatar
By danbicks
#20447 Hi Jenseisen,

What platform are you using Arduino IDE?, native C or Nodemcu?

I am trying to resolve similar issues with my MQTT application. In my code there is a routine to check MQTT connection and re establish. Problem I have is at the moment when network is down comes back up, network try's to re connect and hits a WDT reset.

See topic:
viewtopic.php?p=20432#p20432

Dans
User avatar
By jenseisen
#20450 I am using ESP8266 Arduino.
At the moment I am trying with the mqtt-basic-example, I have extened it a little bit to react on a few mqtt-payloads.

so, for "1" switch on a GPIO, "0" switch it off and so on.
User avatar
By danbicks
#20455 Cool.

Have a look at my example, this uses the same PubSubClient. Subscribes to two topics and publish's a heartbeat message to another.

Keep me posted on how you get on.

Try and poll the MQTT connection every minute, if not connected try and re connect.

Good luck

Dans