New user needs help with MQTT Add-On

Hi! :slight_smile: I installed Home Assistant on a mini pc few days ago. I want to visualize data from my energy-measuring power plugs. They will send the information via MQTT. Therfore i installed the MQTT Add-On and tired to configure it. Unfortunatley this is not possible. The auto-detect found the MQTT Addon but when i click on ā€œconfigureā€ and then ā€œsubmitā€, it tells me, that the connection failed.

So i cant configure the MQTTā€¦ :frowning: Can somebody help me?

Do you have the mosquitto add-on installed, configured and running?

2 Likes

Hi! :slight_smile:
I made a short video about the installation procedure and the settings. Maybe it is more clear, what the problem is:
https://youtu.be/n03ThKwT-DY

1 Like

In that video I donā€™t see you check the addon log. Is it running?

1 Like

Arenā€™t there some config file for mqtt that holds mqtt broker address, port, username, password and such trivial things.

1 Like

No, they are put in during config flow.

1 Like

I think the server itself is running. The power plugs are being recognised but i cant configure the addon itself.

I dont know, where the config file is stored.

Not authorized means you have a mismatch in the username / password somewhere. You set it on the config tab at the top.

1 Like

Yes the mqtt addon is working. However nothing is able to connect to it (see how it says ā€˜not authorisedā€™?)

Did you put the configured username/password into the clients?

Did you put the configured username/password into the integration?

1 Like

No you donā€™t. Read the mqtt addon docs.

1 Like

Option: logins (optional)

A list of local users that will be created with username and password. You donā€™t need to do this because you can use Home Assistant users too, without any configuration. If a local user is specifically desired:

logins:
  - username: user
    password: passwd
1 Like

Unfortunatley it was not possible to configure the integration, because the configuration windows does not open (like in the video). I even dont know the actual stock MQTT credentials.

Are this credentials the MQTT ones? or for the integration?

As I remember you have to configure mqtt addon for integration to work. You have to specify port, host, username and password. Add mqtt user and password and use it for the addon.
Config file is somewhere in root subdir thatā€™s homeassistant instalation dir.

1 Like

You need to differentiate between two things:

  1. The MQTT Add-on aka the MQTT Broker called Mosquitto
  2. The MQTT integration for HA

First, you have to setup the MQTT Add-on correctly, with the config for the Add-on. This is from your last screenshot, the tab left to the log (ā€œConfigurationā€). Here you setup the server, that handles all connections and so on.

As a second step, you configure the integration. The integration in HA handles all the talk between HA and the server. It is, in very simple words, the connection, that HA (as a user) has to the MQTT server (aka the Add-on).

1 Like

Thanks at all! The MQTT is working now. I just created a new user ā€œmqtt-userā€ with a password in HomeAssistant and used this credentials in my MQTT devices (clients). It is working in combination with nodered as well! :slight_smile:

This is the way that works.