xoseperez / espurna

Home automation firmware for ESP8266-based devices
http://tinkerman.cat
GNU General Public License v3.0
2.98k stars 637 forks source link

MQTT keeps disabling itself #215

Closed xoseperez closed 6 years ago

xoseperez commented 6 years ago

Originally reported by: Trevor (Bitbucket: nightone, GitHub: Unknown)


Not sure why this is happening, but after the upgrade to 1.9.3, MQTT keeps disabling itself. there are no other errors on any of my other ESPs that connect to MQTT its only after the upgrade to 1.9.3. I login to the web UI and slide to enable and it connects again fine. then it stays connected for about a day and randomly disconnects.

I am running on a ITEAD SONOFF POW.

xoseperez commented 6 years ago

Fixed with 1.9.4

xoseperez commented 6 years ago

Removing milestone: 1.9.3 (automated comment)

xoseperez commented 6 years ago

Original comment by Trevor (Bitbucket: nightone, GitHub: Unknown):


Update: Have been running the past 3 days with MQTT_MAX_TRIES to 0 and MQTT no longer turns off.

xoseperez commented 6 years ago

Original comment by jorgeassuncao (Bitbucket: jorgeassuncao, GitHub: jorgeassuncao):


Same here. One Sonoff and one H801 keep getting MQTT turned off. Will try MQTT_MAX_TRIES to 0.

xoseperez commented 6 years ago

Original comment by Reclusive Geek (Bitbucket: reclusivegeek, GitHub: reclusivegeek):


I came across this issue last night when I rebooted my broker. All the devices disconnected and disabled MQTT so had to manually reconnect all the devices.

I think it would be good if as standard there was a better time out period as users are going to need to restart brokers and those that use public cloud are going to get internet drops.

Thanks for this great IOT software and the hard work you put into maintaining it .

xoseperez commented 6 years ago

Original comment by Trevor (Bitbucket: nightone, GitHub: Unknown):


Thanks for the fast update....have set MQTT to 0 and flashed...will let you know if that fixes the problem.... Looking at why it fails.... my network layout may contribute towards the retries as this POW is outside (in IPS waterproof container and covered) and connects to my main MQTT server though a secondary Access Point (AP) will check that the AP is not contributing to error. Thanks again for great software.... you have made working with my IOT devices a dream.

xoseperez commented 6 years ago

Original comment by halfluck (Bitbucket: halfluck, GitHub: halfluck):


Phew! it wasn't just me going nuts I was noticing this too Just flashed 4 x Sonoff Basic, 4 x S20 & 2 x NodeMCU I've made the code change to general.h and will OTA flash, I'm assuming I will have to factory reset each device for the code change to apply?

Thanks Rob.

xoseperez commented 6 years ago

This is due to the MQTT_MAX_TRIES functionality. If the device disconnects several times in a row it assumes there is a problem with the broker and disables MQTT...

Not sure this was a good idea. Probably it would be better to space reconnect tries in time. The underneath reason is to avoid having the MQTT connect routine looping endlessly, probably affecting other routines.

For the moment you can set MQTT_MAX_TRIES to 0 in general.h and flash the firmware again to disable this functionality.