-->
Page 1 of 2

MQTT stops when server disconnects

PostPosted: Sun Jun 14, 2015 12:59 pm
by jenseisen
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?

Re: MQTT stops when server disconnects

PostPosted: Sun Jun 14, 2015 2:07 pm
by danbicks
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

Re: MQTT stops when server disconnects

PostPosted: Sun Jun 14, 2015 2:32 pm
by jenseisen
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.

Re: MQTT stops when server disconnects

PostPosted: Sun Jun 14, 2015 2:50 pm
by danbicks
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