HA Cant´t connect to external MQTT with SSL

Hi everyone,

I’m trying to connect Home Assistant to an MQTT server provided by hivemq.cloud. I ran a quick test using the public test broker at broker.hivemq.com with the following setup:

  • No username or password
  • Port: 1883 (non-SSL)

This configuration works perfectly, and Home Assistant connects immediately.

However, when I attempt to use the SSL port (8883), the connection fails.

Does anyone have experience with configuring SSL for MQTT in Home Assistant or know what could be causing this issue? I’d appreciate any insights or troubleshooting tips.

Thanks in advance!

EDIT: I tried it on two RPIs at two locations.

What does the logs say?

Unfortunately nothing. I searched all the logs and nothing.

I have exactly the same problem…
tried many different configuration in the UI integration:
url : mqtts://mydomain.com
port : 8883
user : my_user
password : my_password
with AND without advanced configuration
with AND without certificate (auto, custom)
with AND without check certificate
and like to @jaklacz the log is quiet… unless I deliberately put a mistake (wrong port)

I think 8883 is for unencrypted connections.
8884 should be for encrypted ones.

nope…
1883 for unencrypted, 8883 for TLS, 8884 not assigned (source IANA)

IANA’s list is just a general guide to common port usage

8884 might be MQTT over websocket with SSL.
You need to look for the correct setup at your MQTT provider first.

Your code (badly formatted as it is, and missing the mqtt key) does not match the hiveMQ documentation:

mqtt:
  broker: HIVEMQ_BROKER_HOSTNAME
  port: 8883
  username: MQTT_USERNAME
  password: MQTT_PASSWORD
  certificate: PATH_TO_STORED_CERTIFICATE

PS - you might need to restart HA so that it picks up the new yaml changes.

Nope…
there is no code (it is not a yam file, only rewrite what is in the UI…)
I am not trying a hiveMQ server (the title is HA can’t connect to external MQTT with SSL)
so I have the same issue but not the same server.
digging deeper…