New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Failed to start Energenie ener314rt MQTT client - If ERR! MQTT code: 'ECONNREFUSED', after 7 attempts #62
Comments
Note, this is why I thought the discovery messages were not being sent regularly. It was actually the service exiting after trying to connect. See #60 |
That must be the default; if you want to change the behaviour you can modify your |
I tried setting reconnectPeriod to 5 mins (120000) but cannot find anything to set infinite reconnections |
I note, you also have to set the connectTimeout to greater than reconnectPeriod. Else it fails. Ref: mqttjs/MQTT.js#419 E.G.
|
I may be missing something but I'm struggling to see where in your .js application the exiting is occurring. As from a simplistic point of view. I would look to try and remove the exit criteria, so as the .js application attempts to indefinitely reconnect. |
Found issue was with systemd service, PR raised: #63 |
The issue with the reconnect period and connect timeout should have been fixed now on mqttjs 5.3.5. Any feedback would be welcome |
https://github.com/mqttjs/MQTT.js/releases/tag/v5.3.5 |
I'm also working on a PR to add an error event on connack timeout: mqttjs/MQTT.js#1781 |
Happy to test, sorry been away from this for a few weeks and feel like I have forgotten things. |
Yes |
|
@genestealer Still not working? |
Tested, MQTT 5.3.5 is working great. Yes it's working. |
Thanks for your feedback 🙏🏼 |
@genestealer Do we still need your changes to the service? |
@Achronite No, MQTT 5.3.5 fixed the issue as far as I can tell. |
@robertsLando Does MQTT.js really require node.js v18.2+ ? raspbian 9 doesn't support v18 (GLIBC_2.28 required) |
Only tests require node 18+ but it works also with older nodejs versions |
I note, if the MQTT server is unavailable, such as it's rebooting or temporarily offline, then the mqtt-energenie-ener314rt.service will exit after trying to connect 7 times and must be restarted.
Can we: extended this to 100, make it infinite, or logarithmically increase the time between retries after the first 7 or so tries?
The text was updated successfully, but these errors were encountered: