'Unable to connect to the broker'

I don’t know why and I don’t care.
All I am saying is:

Active: true is NOT the default
If you set active: true and use a Home Assistant User, nothing will connect UNLESS you also add homeassistant to the list of allowed users in the ACL file.
If you define a local user in the broker and in the acl it seems to work.

Until today when I found out you needed to add homeassistant user to the ACL file… I was getting spam in my logs but setting it up as you say you must, nothing would connect to the broker at all! Using active: false (THE DEFAULT) and only a Home Assistant user worked. I just set the broker to default and it worked.

The example at the very top of the page you linked shows the default broker configuration!

Cool - good for you.

I’ve posted my happily working config which seems to align well with current docs. And it works perfectly.

Contrasting to what you just mentioned, I do not have any local users configured. I only have a Home Assistant user: “mqttuser”. Just to avoid confusion - I do not have a user anywhere named “homeassistant”. I do not have a reference to homeassistant in my ACL file. My ACL, as the docs indicate, only have topic readwrite #

Anyways, I am very grateful for you taking an interest and offer of help to my original post on this thread. The only way I could get out of my problem was to do what I explained earlier. I’ll leave it to others that may stumble on this thread to decide what is the best course of action for them.

My caveat is that I am NOT an expert. I did what I did. It worked. I shared it, in the spirit of this forum and the hope it might help others avoid the week I just had. Best wishes and good luck to all !!

I agree with that… Do what works for you. It didn’t work for me and I’m not alone. In another thread someone posted the exact same experience I had but he disabled active again rebooted and then enabled it and it started working with no changes… It’s weird to say the least.

Hey Thanks @Milster, though i did not follow word to word on the instructions,
the below is what i followed conjunctive to your steps,

  1. Created a user with MQTT credentials (set this to User)
  2. Created the ACL file with mqtt user in it
  3. On the MQTT add-on config, no users added and Active set to true
  4. Added the MQTT integration with IP-Port, user-pass from the list below on the integration page(did not enable discovery).

After a restart i was set, the logs are just like yours and works without an issue.

As per the docs, i did see since 4.1 ACL will be required and seems to be the way forward for MQTT as its more controlled & provides secure access.

1 Like

i having problem to get it to work to:/

1575211141: Socket error on client <unknown>, disconnecting.
1575211142: New connection from 192.168.1.66 on port 1883.
1575211142: Socket error on client <unknown>, disconnecting.
1575211143: New connection from 192.168.1.66 on port 1883.
1575211143: Socket error on client <unknown>, disconnecting.
1575211144: New connection from 192.168.1.66 on port 1883.
1575211144: Socket error on client <unknown>, disconnecting.````

this is my log on mqtt

i have create a new user,
i have mqtt and ip adress in config
i have create the 2 files i share/Mosquitto
i havet set any usernamn or pass
1 Like

I’m having exactly the same issue. Did you fix it in the meantime?

my log:

1586190304: New connection from 172.30.XXXX on port 1883.
[INFO] found user_mqtt on local database
1586190305: New client connected from 172.XXXX as auto-5E269947 (p2, c1, k60, u'user_mqtt').
1586190334: New connection from 192.168.XXXXX on port 1883.
[WARN] Not found user_mqtt on local database
1586190335: Socket error on client <unknown>, disconnecting.

Solution: I’ve changed the user name and password to be a shorter one and now it works.

I know this is an old topic but for the love of god i cant get this ***** mqtt working. It can’t be so hard but it just don’t work. I try David setting tried Milster and many other crazy combo nothing work. Has HA addons it always been this buggy. (I just got start with HA moved over from hubitat)

This literally is second add on i install on my HA first was samba. Omg that an headade long story short it doesn’t show up auto on window workgroup like normal I need to manually input the IP to get in. Which i dont mind at least i got in. And now this mqtt addon holy… hell this is frustrating.

There was one time I forget what carzy combo user/acl/config setting I did and manage to get it working. Will partially as the device never show up on mqtt auto discovery or even on developer Tools -> status. I got the device working via manually input all the code into ymal config. Now I uninstalled and reinstalled nothing work no connection.

Anyone run just a mqtt broker off by itself and not use the addon? Does it have these issue? I’ll dont mind spending $12 for an rpi0 w if it better then this addon.

I’ve been using the addon broker for almost 3 years now and it works with no problems but it’s hard to help you if you don’t give any details of your setup. MQTT is pretty simple…

Will I tried the following:
Broker Config:
login [], anonymous: false, active: false
login [], anonymous: false, active: true
login [], anonymous: true, active: true

accesscontrollist:
topic readwrite #

user my_ha_mqttname
topic readwrite #

user my_ha_mqttname
topic readwrite #
user homeassistant
topic readwrite #

So that 3x3 combo so total 9 difference way mix and match nothing work. Auto discovery detect zero device.

I run HA Supervised with mosquitto on bare metal. Tried the add-on once, but I could not setup a mqtt bridge.

1st time install it only way to get it work as mention before manually via manual input to ymal, got device working but still not part of any entity that is under mqtt.

Reinstalled the broker even worst an new issue not unable to connect to mqtt in service log

Currently I roll back the entire HA before I install mqtt. And install mqtt like it was the 1st time. Now it does not show any connection issue on service log, however i dont think is connected all at even tho is say connected. As i cant listen to any packet. Got Mqttfx up running on the side to monitor any transfer from HA went try sending a test nothing.

[00:30:40] INFO: Setup mosquitto configuration
[00:30:40] WARNING: SSL not enabled - No valid certs found!
[00:30:40] INFO: No local user available
[00:30:40] INFO: Initialize Hass.io Add-on services
[00:30:40] INFO: Initialize Home Assistant discovery
[00:30:40] INFO: Start Mosquitto daemon
1588663840: Loading config file /share/mosquitto/acl.conf
1588663840: mosquitto version 1.6.3 starting
1588663840: Config loaded from /etc/mosquitto.conf.
1588663840: Loading plugin: /usr/share/mosquitto/auth-plug.so
1588663840: |-- *** auth-plug: startup
1588663840: ├── Username/password checking enabled.
1588663840: ├── TLS-PSK checking enabled.
1588663840: └── Extended authentication not enabled.
1588663840: Opening ipv4 listen socket on port 1883.
1588663840: Opening ipv6 listen socket on port 1883.
1588663840: Opening websockets listen socket on port 1884.
1588663840: Warning: Mosquitto should not be run as root/administrator.
1588663847: New connection from 172.30.32.1 on port 1883.
[INFO] found homeassistant on local database
1588663847: New client connected from 172.30.32.1 as auto-EF910D3A-CF3D-C603-1F91-644ACF1A7C13 (p2, c1, k60, u’homeassistant’).
1588663850: New connection from 192.168.86.248 on port 1883.
[INFO] found hassmqtt on Home Assistant
1588663851: New client connected from 192.168.86.248 as DVES_005221 (p2, c1, k30, u’hassmqtt’).

Here the broker successfully picking up the device with zero issue. So i dont think the mqtt have issue just not sure what is going on, on the integration auto discovery is doing.,

That looks like a tasmota device connecting…

yes it an tasmota and i did done an setoption19 1 auto discovery boardcast.

What authentication are you using in the Tasmota devices?

same as ha mqtt dummy user account

And the MQTT integration? Or are you using YAML? If integration, did you check the box to enable discovery? If yaml can you show your config.
I suspect if you are using yaml that the topic is wrong. When you enable discovery it reverses the topic order… (If possible you should use the integration, not yaml) Your broker seems to be working.

nope no code in yaml just addon configuration currently set at login [], anonymous: false, active: true, and yes discovery is enable. Also i tried the other setup. as mention above 9 different combination doesnt make an different. Yes this 3 installation the broker does seem working fine.

Except there a new issue now different from last two run. This time broker seem to have zero issue however in side HA development tool mqtt test. I cant publish or listen to traffic on the broker.

Just to recap.
1st time installing - mqtt broker seem good, can’t discover any device, but can manually publish to the device so can use device if manually input into yaml.

2nd time reinstall - mqtt broker uable to connect issue, nothing is discover or manual info will work of course.

3rd time (current) roll back HA and install - mqtt broker seem good just like 1st time. can’t discover any device, can’t publish or listen to anything on mqtt.

I’m assuming the access control list is NOT in the broker config? There is also a second file you need if you use the ACL… also should both be in /share/mosquitto right?
If you use a HA user, should have anonymous and active both false.
Have you installed MQTT Explorer (mqtt client) and connecting to the broker? Might give you more visibility about what is happening.