MQTT Binding — Timeout while waiting for CONNACK

I’ve got the MQTT binding installed and configured like this

Bridge mqtt:broker:mosquitto [

I can connect just fine to using a local client (MQTT Explorer), but openHAB does not want to connect and instead I see the error Timeout while waiting for CONNACK.

I’m not seeing any messages in mosquitto’s logs that suggest openHAB is even connecting. I’m also not seeing anything of substance in openHAB’s logs. I’ve attempted to increase verbosity via the openHAB console but have had no success getting more detail.

I will add that I’m running things in a… unique way. I’ve got mosquitto listening on port 1883 and TLS being terminated at Traefik. My mosquitto config if it’s of any help is

acl_file /mosquitto/config/acl
allow_anonymous false
listener 1883
log_type debug
password_file /etc/mosquitto/passwd
persistence true
persistence_location /mosquitto/data/
user mosquitto

I’ve also configured openHAB to talk directly to the mosquitto instance (sidestepping Traefik and TLS altogether) and it works, but I would prefer to have TLS enabled.

Any ideas on how to get some more visibility into what’s going on on the openHAB side? Timeout while waiting for CONNACK isn’t super helpful or meaningful to me, and some forum searches and googling revealed nothing super obvious about the error. I also wasn’t able to find any details on how to increase the verbosity for the MQTT binding in openHAB, at least none that actually resulted in additional information being visible in the logs.

Update: Mosquitto is listening on port 1883 intentionally, as TLS is terminated at Traefik on port 8883, which is what the MQTT binding is communicating with. Traefik then forwards the request unencrypted to Mosquitto.

Port number should be 1883, not 8883

1 Like

Good eye! This is intentional, as Mosquitto is listening on port 1883 and Traefik is listening on 8883 (where TLS is terminated). So the MQTT binding is talking to the Traefik load balancer on 8883 which is then proxied to Mosquitto on 1883.