Fail to connect to MQTT broker

Today I made a bunch of updates of my HA system to latest versions of core, Hassio and also the MQTT integration. After an hour or so I realized I lost connection to my own MQTT broker running on a separate RPI. Looking into the logs on the RPI I find this error:

My remote RPI reports: MQTT error: connect ECONNREFUSED 192.xxx…

I restored the core backup and also the backup made before I upgraded the MQTT integration, but no success. The connection problem is still there.

So I guess it is the Hassio upgrade that triggers this fault. It looks like something has changed in the Hassio network setup?

I hope someone can give me a hint. Otherwise I must restore the old Hassio version I had before.

Edit:
It was quite some time ago I configured my system, and I was wrong in my description above. I use the HA MQTT broker. My RPI acts like a MQTT client. So I guess I shoiuld leave the configuration as it is. Username and password are in line with what I have specified in the client.

But still I have problem to connect to the broker (core-mosquitto). Once I click on NEXT I get this message:
image

I can’t see why this should not work. I have opened the Advanced options as well and tried to change the settings for cerificate valiadtion as follows, without success.

I don’t know what to do now. I’m running a pool control system where I/O operations is done by the RPI, and without a working MQTT setup this fails completely…

Edit2: I removed the MQTT integration and re-installed it. Then I was able to connect to the built in broker. Everything seems to work again. At least I can read the pool temperature. Gha! Sućh a mess…

I am also having a problem with MQTT connection, with a slightly different error:

Failed to connect to MQTT server due to exception: [Errno -2] Name does not resolve

I’m running in docker on a rpi. The name does resolve from the host OS and everything was working fine, until it wasn’t. I’m on the latest HASS release 2023.5.3 and have updated and restarted Rasbpian on the Pi, to no avail.

Hello, did anybody solve this?

I have the same problem, did anyone solve it.

Same problem here, my old installation worked but my hardware died so I switched from Supervised to HAOS and now I cannot connect to my broker over 1883 or 8883.

8883 because HAOS doesn’t seem to have SSL support?!
Server reports:

1694638843: Client connection from <IPv6 I think> failed: error:1408F10B:SSL routines:ssl3_get_record:wrong version number.

and 1883 because who knows - server diags report:

1694640786: New client connected from <IP> as <scambled> (p2, c1, k60, u'ha').
1694640786: No will message specified.
1694640786: Sending CONNACK to <scrambled> (0, 0)
1694640786: Client <scrambled> closed its connection.

Both cases, HA refuses to connect.

Already starting to regret going HAOS because I can’t tinker further to understand/fix.

1 Like

Anybody got a solution for this problem? I have the same case

Any conclusion in this issue (MQTT: Connection failed)?
I have the same problem with my AMS Pow-U reader running v.2.2.28.
My MQTT is running on a synology RS814+ as Mosquitto version.

I had the same error. I managed to fix it. I do believe I did not input the user or password right. So don’t use copy/paste. You might add an extra space. Just type carefully the necessary info.

I also ran into this issue after following two different tutorial videos to install what should be a fairly easy to install add-on and integration.

I am not 100% sure what went wrong but I fixed it with the old fashoined brute force method and did the following steps in this order
1/ removed the mqtt integration
2/ deleted the mosquitto add-in
3/ deleted the home assistant User I had set up for this purpose
4/ created a new home assistant user (“mqtt_user”) under Settings → People → Users
5/ Developer Tools → Restart home assistant
6/ Settings → Add-Ons → install the Mosquitto Add on
7/ Settings → Add Ons → Install the Mosquitto integration
8/ Mosquitto Integration → Reconfigure → specify the new username and password from step 4.

After doing this I didn’t get the failed to connect error anymore.

I suspect, but do not know, that the issue had something to do with creating the mqtt_user incorrectly or in the wrong sequence, so either the integration or add-in, or perhaps home assistant itself, didn’t recognize the username/password for my mqtt user. But redoing everything in this exact order fixed the issue for me at least, thankfully.

hope this helps someone else