MQTT User Config

So I am following the instructions to install the MQTT broker from the addon repo, it mentions to create a user, I’ve looked and I can’t see the option to add one, I’ve also had a google around and all the answers say to enable Advanced view which I’ve had enabled for a while, I turned it off and back on again to make sure there wasn’t something funky, I can confirm advanced options are visible elsewhere

core-2021.2.3
supervisor-2021.02.11
Home Assistant OS 5.12
MQTT 5.1.1


I use the Old school method :wink:
logins:
  - username: user
    password: passwd

It indicates to enable Advanced Mode so that Configuration > Users becomes visible. Normally this menu option is hidden.

Use Configuration > Users to create a user account. This account can access several things (aside from Home Assistant itself) including the MQTT broker (Mosquitto Add-on). That’s what I did when I needed an account to login to the broker using an external MQTT client (MQTT Explorer).

1 Like

Advanced mode is enabled yet the user option is still not visible:
image

When I check the logs it’s showing that it can’t find a user yet it’s working
image

I tried this config as per the GITHUB but it throws an error about the YAML being invalid:
image

I would say, you have to loose the first line (logins: []) in your config, as now you have logins defined twice. So if you delete the first line, the actual logins defined lower down will take effect.

1 Like

How I didn’t spot that I don’t know lol, fresh eyes and all that jazz lol,

I assume this is all good according to the logs

For those finding this like I have and failed to understand the instuctions at first glance. The instruction is to create a new user within Home Assistant, not Mosquitto itself. It can be a little confusing seeing “configuration → users” when there is a configuration page for Mosquitto. This new user will be used by misquitto (and by extention MQTT devices).

3 Likes

I thought this was fairly straightforward when I wrote it last March:

3 Likes

I confirm it is confusing. Went through the same thing as Aidan to finally end up here. Why don’t you change the help text to something like this?

Create a new user for MQTT via Home Assistant’s (not Mosquitto’s configuration tab) ConfigurationUsers (manage users). Notes:

  1. This name cannot be homeassistant or addon, those are reserved usernames.
  2. If Home Assistant does not show the option to create a new user, ensure that Advanced Mode is enabled in your Home Assistant profile.
3 Likes

Everyone has the opportunity to modify the documentation. This post explains how:

1 Like

Didn’t know that, thanks for the suggestion. I filed a pull request.

I have posted a question that is related to MQTT User Config over in this topic.
Hoping someone can help answer it…