'Unable to connect to the broker'

Yes, it’s in a different docker. No, with the latest updates it shouldn’t be in your configuration.yaml anymore but under the tab “integrations” in the front end.

There’s no option to delete - just configure and it’s not showing up under configured, only under set up new.

Does this help:

I have nothing in my addons folder.

ok, sorry if I misguided then, but I amon the latest, and it works just fine… maybe transitional.

heavy Mqtt user here, so a bit reluctant to change all, considering the issues in other threads about the upgraded version of the add-on…

Should “discovery:” be in configuration.yaml?

No problem, i said the same in a different post not 2 days ago. Then restarted HA and all went south again (stopped working), now got it via integrations and all is well again. So i’m not sure either, i think no one is at the moment :wink:

I have Discovery commented out Ashschott, so not present in configuration.yaml.

It seems you don’t need discovery in config yaml. @pvizeli seem to confirm that on discord today

I’ve now restored from an old snapshot.

I have hass.io supervisor still at 139. This did not restore.

Mosquitto MQTT is now 2.0.
Home assistant is 0.81.

None of my automations that use MQTT are now showing up in overview. I suspect that this relates to hass.io supervisor 139.

Is there any way to downgrade this?

I have a completely broken system.

I give up!

Starting from scratch with new SD card.

Here we go again!

Thank you to everyone for your help.

Did you take David’s advice into consideration? He gave some helpful pointers on the whole mqtt issue the past couple of days…

What happens after you remove this form your configuration.yaml file? Everything seems to work fine, except for the integration which could be linked to the discovery: entry in your configuration.yaml…

1 Like

Yes, thank you.

I tried both with and without discovery.

I now have a virgin install as if I was a complete new starter and MQTT now integrates.:clap::clap::clap::clap::clap:

Interestingly, “discovery:” is there in configuration.yaml. Not added by me.


Ok, well good you are getting it back up at least.

Good luck setting it all up again :+1:

Hopefully, luck won’t be a factor.

Thank you for your help.

It is enabled by default. I have always used discovery in preference to manual config and never had an issue with it. If you use hassio, you must either enable discovery or hassio in order to access the hassio panel.

Hey, So I found this thread after much cursing and arguing (alone mind you) with Mqtt which worked up until the last update (or so it seemed)

Followed every direction, and in the end what worked for me was just filling all this in correctly…

  "logins": [
    {"username": "local-user", "password": "mypw"}
  "anonymous": false,
  "customize": {
    "active": false,
    "folder": "mosquitto"
  "certfile": "fullchain.pem",
  "keyfile": "privkey.pem"

as before i had the Username and Password defined in yaml. once i put it into the mosquitto, everything came back just as it always was…

Since i find most people never post their fixes… i figured maybe this will help the next person…


HUmmmm… Have the exact same problem…

The only think I see in common is the TIME change (winter to summer and vice-versa).

ASHCOTT, reported the problem nov. 18, not long after time change, and me it just appear yesterday after again time change. I did not make any change in my setup.

I don’t know if it makes a difference, but my house crashed on the latest update. I’m using duckdns for access to my system and I cannot get HASSIO to integrate with the mosquito addon. I had been running HASSIO 76.2 With the Mosquitto add-in version 2.0 from a snapshot I took on August 25, 2018 with Alexa and everthing has been working just fine. Unfortunately I had auto update turned on for everything and I don’t have a snapshot with Mosquitto version 3.x. I have about 19 SONOFFS flashed with Tasmoto 5.11.1j. Just upgraded to the latest HASSIO 89.2 with supervisor 148 and Mosquitto 4.1. Originally I had MQTT in configuration.yaml

    # MQTT Broker
      broker: core-mosquitto
      username: !secret mqtt_user
      password: !secret mqtt_pwd
      discovery: true
      discovery_prefix: homeassistant

Integration with Alexa was flawless. But now it stopped working and my wife is very upset with me. Automations stopped and my house is now broken. All the links doing a google search for MQTT are old and there is very little help out there. I fortunately did not use homeassistant for any sonoff usernames. I uninstalled Mosquitto and commented out the MQTT broker configuration.yaml. All my sonoff devices are still in the configuration.yaml file. Rebooted HASSIO. Added a user ha which is the same username all my Sonoffs use. Reinstalled the Mosquitto 4.1 Addon and Configured like this:

  "logins": [
      "username": "ha",
      "password": "xxxxxxx"
  "anonymous": false,
  "customize": {
    "active": false,
    "folder": "mosquitto"
  "certfile": "fullchain.pem",
  "keyfile": "privkey.pem"

Mosquito log files show by devices are connecting to the Mosquitto broker.

[INFO] Setup mosquitto configuration
[INFO] Found local users inside config
[INFO] Initialize Hass.io Add-on services
[INFO] Initialize Home Assistant discovery
[INFO] Start Mosquitto daemon
1552753593: mosquitto version 1.5.6 starting
1552753593: Config loaded from /etc/mosquitto.conf.
1552753594: |-- *** auth-plug: startup
1552753594: |-- ** Configured order: http
1552753594: Opening ipv4 listen socket on port 1883.
1552753594: Opening ipv6 listen socket on port 1883.
1552753594: Opening websockets listen socket on port 1884.
1552753594: |-- with_tls=false
1552753594: |-- getuser_uri=/login
1552753594: |-- superuser_uri=/superuser
1552753594: |-- aclcheck_uri=/acl
1552753594: |-- getuser_params=(null)
1552753594: |-- superuser_params=(null)
1552753594: |-- aclcheck_params=(null)
1552753594: |-- retry_count=3
1552753594: Opening ipv4 listen socket on port 8883.
1552753594: Opening ipv6 listen socket on port 8883.
1552753594: Opening websockets listen socket on port 8884.
1552753594: Warning: Mosquitto should not be run as root/administrator.
1552753594: New connection from on port 1883.

Then I went to the dashboard -> Configuration -> Integrations and found MQTT as discovered

I clicked on configure

After reading more I chose to setup a new integration manually

I used the same username and password as the user I entered into HASSIO and MOSQUITTO. Home assistant still refuses to connect to the broker. I tried using my local IP address but with duckdns that does not work. I tried changing the port to 8883 that didn’t work. TasmoAdmin can see and toggle all of my devices but Home Assistant cannot. Partial home-assistant.log:

2019-03-16 10:50:32 ERROR (MainThread) [homeassistant.setup] Setup failed for mqtt: Component failed to initialize.
2019-03-16 10:50:33 ERROR (MainThread) [homeassistant.setup] Unable to set up dependencies of mqtt.sensor. Setup failed for dependencies: mqtt
2019-03-16 10:50:33 ERROR (MainThread) [homeassistant.setup] Unable to prepare setup for platform mqtt.sensor: Could not set up all dependencies.
2019-03-16 10:50:33 ERROR (MainThread) [homeassistant.setup] Unable to set up dependencies of mqtt.sensor. Setup failed for dependencies: mqtt
2019-03-16 10:50:33 ERROR (MainThread) [homeassistant.setup] Unable to prepare setup for platform mqtt.sensor: Could not set up all dependencies.
2019-03-16 10:50:33 ERROR (MainThread) [homeassistant.setup] Unable to set up dependencies of mqtt.sensor. Setup failed for dependencies: mqtt
2019-03-16 10:50:33 ERROR (MainThread) [homeassistant.setup] Unable to prepare setup for platform mqtt.sensor: Could not set up all dependencies.

I’ve been at this for the last 3 days and I do not know where to go from here. This is absolutely the pits. I look at all the breaking changes before upgrading and there was no mention of this that I saw. Very much in the doghouse until I can get this fixed.

Try. Me help this.

  1. Delete mqtt integration from “Integration”
  2. Restart HA.
  3. Add in configration.yaml
    broker: core-mosquitto
    username: your_username
    password: your_password
  4. Restart HA.

Do not setup in mosquitto addon this, how it write in manual mosquitto addon for version 4.1:
“customize”: {
“active”: true,
“folder”: “mosquitto”
Shoud be false

I’m at a complete loss on this too. I feel like I have tried everything on this post and other mentions of this issue. Never had so much drama with an add-on. Or any part of HA. This is dreadfully frustrating.

I just wish there was some sort of tip or advice on what is at the heart of the issue. The title of this thread - why is HA ‘Unable to connect to the broker’ ? in the integration setup phase.

I have to run v4.0 to retain stability. v4.1 is driving me insane.

Did you post your MQTT config?