sfeakes / AqualinkD

Daemon to control Jandy Aqualink RS pool equipment from any home automation hub (Alexa, Homekit & Siri, Home Assistant, smartthings, domoticz etc) or web browser.
Other
176 stars 48 forks source link

Frequent Disconnects from MQTT Broker due to short keepalive #141

Closed shbatm closed 4 days ago

shbatm commented 3 years ago

After successful setup and connection to my MQTT Broker: (Mosquitto Add-on for Home Assistant), running on another server, I was noticing frequent disconnects from the broker every ~2 minutes with 10s delays between reconnection.

I recompiled the code changing this line to

    opts.keep_alive = 60;

And the reconnect issue went away. I'm not sure if there's another reason the keep-alive is set so much shorter than the MQTT default 60s, but resetting it has kept everything connected.

Not sure if this is just an issue for me or if its more widespread. If there's another reason for it being so short, maybe this could be a config option?

Otherwise, thanks for the program, working great so far!

sfeakes commented 3 years ago

Thanks for doing the groundwork on this. There is a lot of history behind that setting both with bugs in mongoose and mosquitto documentation. It’s probably the latest version of mosquitto that’s highlighted this again, at one point I used my own ping rather than mongoose and may have to resort back to that as to not break all the different versions people run. But hope a simple config addition like you suggested will work.