'Unable to connect to the broker'

I’m running out of things to try now.

Home Assistant cannot connect to the broker. Here’s what I’ve set and what I see:

Screen2018-11-07_07-44-48_pm

Screen2018-11-07_07-41-56_pm

Screen2018-11-07_07-40-33_pm

Mosquitto is seeing my devices fine. It’s just not being found by Home Assistant.

This excerpt from MQTT log shows this:

[WARN] Not found homeassistant on local database
1541619621: Socket error on client <unknown>, disconnecting.
[INFO] found ashscott on local database
1541619623: Client DVES_4558BB already connected, closing old connection.
1541619623: Client DVES_4558BB disconnected.

I see this on the overview:

Screen2018-11-07_06-56-09_pm

I’d really appreciate some help. My problem is exceeding my skill level!

1 Like

try to use your local ip

Thanks.

I’ve tried that with no success.

Also tried without username and password in Mosquito config.

I still get the ‘unable to connect to the broker’ message.

This is what I get in the Mosquitto log after restarting it:

[INFO] Setup mosquitto configuration [INFO] No local user available [INFO] Initialize Hass.io Add-on services [INFO] Initialize Home Assistant discovery [INFO] Start Mosquitto daemon 1541659280: mosquitto version 1.4.15 (build date 2018-05-08 10:35:06+0000) starting 1541659280: Config loaded from /etc/mosquitto.conf. 1541659280: *** auth-plug: startup 1541659280: ** Configured order: http 1541659280: Opening ipv4 listen socket on port 1883. 1541659280: Opening ipv6 listen socket on port 1883. 1541659280: Opening websockets listen socket on port 1884. 1541659280: Opening ipv4 listen socket on port 8883. 1541659280: Opening ipv6 listen socket on port 8883. 1541659280: Opening websockets listen socket on port 8884. 1541659280: Warning: Mosquitto should not be run as root/administrator. 1541659281: New connection from 10.0.1.28 on port 1883. [WARN] Not found homeassistant on local database 1541659283: Socket error on client &lt;unknown&gt;, disconnecting. 1541659283: New connection from 10.0.1.174 on port 1883. [WARN] Not found homeassistant on local database

It seems that Mosguitto is running but can’t find Home Assistant and that Home Assistant is running and can’t find Mosquitto.

This is so frustrating!

When I uninstall Mosquitto MQTT and restart, it no longer appears as discovered and available in integrations.

So, when installed, it is there and running but Home Assistant isn’t connecting to it.

I’ve tried all options of user names, logins, config.yaml entries etc. that I’m aware of and have nowhere else to go.

Any ideas anyone?

I’ve now reinstalled Mosquitto MQT and set it to run.

This is the log:

[INFO] Setup mosquitto configuration
[INFO] No local user available
[INFO] Initialize system configuration.
[INFO] Initialize Hass.io Add-on services
[INFO] Initialize Home Assistant discovery
[INFO] Start Mosquitto daemon
1541661462: mosquitto version 1.4.15 (build date 2018-05-08 10:35:06+0000) starting
1541661462: Config loaded from /etc/mosquitto.conf.
1541661462: *** auth-plug: startup
1541661462: ** Configured order: http
1541661462: Opening ipv4 listen socket on port 1883.
1541661462: Opening ipv6 listen socket on port 1883.
1541661462: Opening websockets listen socket on port 1884.
1541661462: Opening ipv4 listen socket on port 8883.
1541661462: Opening ipv6 listen socket on port 8883.
1541661462: Opening websockets listen socket on port 8884.
1541661462: Warning: Mosquitto should not be run as root/administrator.

When I then go to Integrations it’s there, discovered, now asking to be configured.

Clicking the one click configure has it return with ‘Unable to connect to the broker’ again.

Hey ashscott,

looks like you’re almost there! All your devices are connected to Mosquitto again, so that is running fine. I think the problem is Home Assistant due to this error in your Mosquitto log:

[WARN] Not found homeassistant on local database

This doesn’t mean Home Assistant can’t find your Mosquitto broker, but Mosquitto is telling you someone is trying to log on with the username “homeassistant” which is no longer allowed.

  • Make sure mqtt: in your configuration.yaml is gone for good.
  • In the config box from the Mosquitto addons do not use “homeassistant” or “addons” as the
    username, anything else will work. For good measure set “anonymous” to “true”
  • Remove the inegration and restart homeassistant.
  • After the restart add the inegration again, using the username and password you’ve set in Mosquitto config
    and use "core-mosquitto" as the broker. I also enabled discovery there and all is well for me.

Hope you get it running again!

5 Likes

Thank you.It’s good to know I’m not alone!

Please can you explain what the above means? What is and where do I put “core-mosquitto”?

When configuring the integration you are asked to fill in “Broker”, “Port”, “Username” and “Password”.

Where it askes for “Broker” you should try and fill in “core-mosquitto” instead of “localhost” and see if that works for you.

With or without “”?

Without the quotes.

OK.

I’ve done all of that.

mqtt is commented out in configuration.yaml and only exists in automation.yaml as mqtt.publish

Here’s the log again:

[INFO] Setup mosquitto configuration
[INFO] Found local users inside config
[INFO] Initialize system configuration.
[INFO] Initialize Hass.io Add-on services
[INFO] Initialize Home Assistant discovery
[INFO] Start Mosquitto daemon
1541663641: mosquitto version 1.4.15 (build date 2018-05-08 10:35:06+0000) starting
1541663641: Config loaded from /etc/mosquitto.conf.
1541663641: *** auth-plug: startup
1541663641: ** Configured order: http
1541663641: Opening ipv4 listen socket on port 1883.
1541663641: Opening ipv6 listen socket on port 1883.
1541663641: Opening websockets listen socket on port 1884.
1541663641: Opening ipv4 listen socket on port 8883.
1541663641: Opening ipv6 listen socket on port 8883.
1541663641: Opening websockets listen socket on port 8884.
1541663641: Warning: Mosquitto should not be run as root/administrator.

Same result ‘Unable to connect to the broker’ :frowning_face:

Where does it say unable to connect to broker? in the log you’ve just posted i don’t see any devices connecting to mosquitto, nor do i see any error’s…

Screen2018-11-07_07-41-56_pm

and

Screen2018-11-07_07-40-33_pm

though I used core-mosquitto instead of localhost, as suggested.

Is it possible that somehow my broker is open on a different port, maybe?

How would I check that?

I just checked the System Log and found this:

18-11-08 08:10:38 INFO (MainThread) [hassio.auth] Success login from ashscott
18-11-08 08:11:01 INFO (MainThread) [hassio.auth] Auth request from core_mosquitto for ashscott
18-11-08 08:11:03 INFO (MainThread) [hassio.auth] Success login from ashscott
18-11-08 08:11:17 INFO (MainThread) [hassio.auth] Auth request from core_mosquitto for ashscott
18-11-08 08:11:19 INFO (MainThread) [hassio.auth] Success login from ashscott

The username in MQTT mosquitto is set to mqtt though!

I’ve tried it with the ashscott username - same result.

It shouldn’t be on a different port unless you’ve set that in the addons.

Can you post a screen shot of Settings/Integrations screen? Like so:

1 Like

The difference I can see is that yours says MQTT Mosquitto Broker and mine is just MQTT.

Is it not discovering it correctly?

Try this, open the MQTT integration under discovered and delete it. Then manually add it from the list below…

Edit:

I think it should be “configured” and not just “discovered”

running the addon and configuring that correctly is one thing.
But you have to see it as a separate source for your entities, and you still have to point HA to this broker for creating mqtt sensors ea.
for that you need a mqtt: setting in your configuration.yaml

it’s easier to understand when trying from another device. You can reach the broker on device 1, but have to point device 2 to the ip address where that broker is running.

you have to do that too, when on the same ip address…