Page 1 of 1

ERROR MQTT: Mqtt client error connack timeout

Posted: Tuesday 17 December 2024 8:23
by aBjerris
I'm in the process of migrating from OPENZWAVE to Zwave JS UI/MQTT
I managed to follow the guideline so that all devices show in Domoticz but they did not function.
I got suck so I decided to readd all the devices.

The procedure is simple.
1. Exclude the device
2. Include the device
3. Enable discovery for the wanted objects (usually dimmer 1)
4. Store
5. Update
6. Rediscover

It has worked very well up until now. All of a sudden I get the below when I try to add a new node or rediscover an existing node.

2024-12-17 06:53:36.634 ERROR MQTT: Mqtt client error connack timeout
Error: connack timeout
at Timeout._onTimeout (/usr/src/app/node_modules/mqtt/src/lib/client.ts:876:23)
at listOnTimeout (node:internal/timers:569:17)
at processTimers (node:internal/timers:512:7)
2024-12-17 06:53:36.723 INFO MQTT: MQTT client closed
2024-12-17 06:53:39.723 INFO MQTT: MQTT client reconnecting

Any Idea what do do?

Re: ERROR MQTT: Mqtt client error connack timeout

Posted: Tuesday 17 December 2024 13:24
by FireWizard
Hi,

Can you connect to your broker with MQTT Explorer?

What is the setting of your time-out parameter? Do not use less than 60 secs.

Regards

Re: ERROR MQTT: Mqtt client error connack timeout

Posted: Tuesday 17 December 2024 14:54
by aBjerris
Hi FireWizard,
Thank you for the prompt comment.
Yes. I can connect to the broker with MQTT Explorer.
Which timeout parameter are you referring to? Where is it set?
In Zwave JS UI I only find "MQTT/Reconnect period (ms)" I use the defaut 3000ms.

Re: ERROR MQTT: Mqtt client error connack timeout

Posted: Tuesday 17 December 2024 23:19
by aBjerris
I stopped both Mosquitto and Zwave JS UI.
Then I started Mosqutto before I started Zwave JS UI.
Now it is working again.
Previously I tried to reboot the system but that did not help. So, I guess there is a dependency on the start order of the servives.
Is there a better expalnation?

Re: ERROR MQTT: Mqtt client error connack timeout

Posted: Wednesday 18 December 2024 16:04
by FireWizard
Hello @aBjerris

You wrote:
I started Mosqutto before I started Zwave JS UI.
It is quite obvious, that, as long as the broker (Mosquitto) has not started completely yet and so is unavailable,
that you receive a Connack (Connection Acknowledged) timeout, as the client (ZwaveJS-UI), is not able to connect.

There is no reason to reboot Mosquitto or any other MQTT server.
MQTT brokers can run continuously.

Sorry for the confusion, as I mentioned the time-out parameter, but I meant the keepalive.

The keep alive parameter has to be set by the client, but not all clients have this option available.
And ZWaveJS-UI and also Domoticz do not have this option available.
So, I guess there is a dependency on the start order of the services.
Yes, there is.
Is there a better explanation?
I recommend to read the following blog post: https://www.hivemq.com/blog/mqtt-essent ... blishment/

This website has a complete series of interesting articles. worthwhile to read.

But it is great that everything works, now.
Please mark the thread as "Solved".

Regards