MQTT Broker failed to connect?

I wonder if some kind soul can help me with this particular problem please?

I have HA Supervised on a Pi4 and have added many integrations using the same procedure without issue but when I go to Integrations, click the blue + Add Integration button in the bottom right hand corner, input the IP Address of the Pi running HA which is where I want the MQTT Broker installed, enter a username & password (whether that be new username/password specifically for MQTT, the HA username/password or the actual Raspberry Pi logon username/password and after the box shakes about for 4-5 seconds it returns ‘Failed to connect’ as can be seen in the attached screenshot;


Obviously as I stated above I did input the required data before clicking the Submit button but for whatever reason it fails to connect.

Surely an integral, standard installation of MQTT should work right off the bat shouldn’t it?

What have I missed here?

Thanks & kind regards,
-=Glyn=-

The integration steps you are going through will set up a connection to an MQTT broker, rather than set up a broker for you.

Instead you want to go Supervisor > Add-ons and install Mosquitto Broker

1 Like

Ah ah…that would explain that then! :blush:

Thanks Craig.

I just wish life in Raspberry Pi world wasn’t so convoluted sometimes… :face_with_raised_eyebrow:

Thanks & kind regards,
-=Glyn=-

So that seemed quite painless…thanks!

Is there anything else I need to do such as setup a connection using the MQTT Integration I mentioned earlier or is that it?

I installed it largely because I wanted to add the Remote RPi System Monitor that uses MQTT and I see from a cursory glance there are many other Add-Ons that use MQTT also.

Thanks & kind regards,
-=Glyn=-

1 Like

Yeh, for the add-on you need to set up the integration too. Check out these instructions from the Mosquitto broker add-on

How to use
The add-on has a couple of options available. To get the add-on running:

Start the add-on.
Have some patience and wait a couple of minutes.
Check the add-on log output to see the result.
Create a new user for MQTT via the Configuration -> Users (manage users). Notes:

This name cannot be homeassistant or addon, those are reserved usernames.
If you do not see the option to create a new user, ensure that Advanced Mode is enabled in your profile.
To use the Mosquitto as a broker, go to the integration page and install the configuration with one click:

Navigate in your Home Assistant frontend to Configuration -> Integrations.
MQTT should appear as a discovered integration at the top of the page
Select it and check the box to enable MQTT discovery if desired, and hit submit.
1 Like

Again that was really clear & straightforward!

Thanks & kind regards,
-=Glyn=-

HI. was having dificulties with MQTT, too. I went through all the steps as described in the video in the link below.

I actually messed up myself. I typed the username as mqtt_user and the displayname as mqtt-user (replaced underscore with dash), then used the displayname instead on the username. Stupid, I know. Fixed the the username and poof! Done.
10 hours of reading all over the internet on Saturday to troubleshoot for nothing! So, although stupid, but always check for these issues before going through every geek level trick!
Now I have to figure out why mqtt doesn’t see my Shelly 1 messages. There goes my Sunday!!

1 Like

Greetings and Help!
I am trying to set up mqtt on my new homeassistant on a raspberry pi 4 running homeassistant os

  • Core2024.1.6
  • Supervisor2024.01.1
  • Operating System11.5
  • Frontend20240104.0

I have installed the mqtt add on. I have configured the broker to:
the defaults. No user names supplied. It seems to start OK.

But when I try to start the client i get the following error if I point to my IP address with user and password listed in my user list. debug output:

{
"home_assistant": {
"installation_type": "Home Assistant OS",
"version": "2024.1.6",
"dev": false,
"hassio": true,
"virtualenv": false,
"python_version": "3.11.6",
"docker": true,
"arch": "aarch64",
"timezone": "America/New_York",
"os_name": "Linux",
"os_version": "6.1.63-haos-raspi",
"supervisor": "2024.01.1",
"host_os": "Home Assistant OS 11.5",
"docker_version": "24.0.7",
"chassis": "embedded",
"run_as_root": true
},
"custom_components": {},
"integration_manifest": {
"domain": "mqtt",
"name": "MQTT",
"codeowners": [
"@emontnemery",
"@jbouwh"
],
"config_flow": true,
"dependencies": [
"file_upload",
"http"
],
"documentation": "https://www.home-assistant.io/integrations/mqtt",
"iot_class": "local_push",
"quality_scale": "gold",
"requirements": [
"paho-mqtt==1.6.1"
],
"is_built_in": true
},
"data": {
"connected": true,
"mqtt_config": {
"broker": "192.168.1.122",
"port": 1883,
"username": "**REDACTED**",
"password": "**REDACTED**",
"discovery": true,
"discovery_prefix": "ha",
"birth_message": {
"topic": "ha/status",
"payload": "online",
"qos": 0,
"retain": false
},
"will_message": {
"topic": "ha/status",
"payload": "offline",
"qos": 0,
"retain": false
}
},
"devices": [],
"mqtt_debug_info": {
"entities": [],
"triggers": []
}
}
}​

when i look at the errors it says that the user is not valid. If I point the client to another mosquitto broker running on another raspberry pi it works fine.

What am I doing wrong?

Thank in advance!
L. Schenk