YA MQTT configuration question from a starter

Absolute beginner to Home Assistant

Browsed the forum – found many complicated questions and complicated responses, none close match.

Appreciate if someone can steer me on any one of these things.

Long sorry – try to fill in the situation and (lack of understanding)

Raspberry pi 4 – seems to run home assistant ok.

  • Installation methodHome Assistant OS
  • Core2026.5.4
  • Supervisor2026.05.0
  • Operating System17.3
  • Frontend20260429.4

Arduino with DHT22 – “loop()” reports to Serial temp & humidity attempts to (instance of PubSubClient).connect - fails. (return 0, .state 5)

Seen in help that I shouldn’t need to speak YAML as Home Assistant does all.

Added MQTT and mosquito to home assistant.

Issue nothing happens. (No suggestion that home assistant sees sensor, device, MQTT message, well, sees nothing really)

Google

Turn on MQTT diagnostics – does not seem to exist anywhere in any menu I found.

Setting .. mosquito .. “Reconfigure”

Promising: but – shows “Username” : homeassistant” and “Password”: “__**password_not_changed**__”

Online help says create a new user

Online help says don’t create a new user

Online help says don’t use “homeassistant”

Online help says should not need to use a username or password.

Arduino PubSub Client

My example code I found for Arduino

Uses, as above

int retCode = mqttClient.connect(CLIENT_ID); -

which reading I interpret to be anonymous MQTT. I also read that this is not disabled by default.

retCode = 0 client.State reports 5

My attempt to change to match that below,

int retCode = mqttClient.connect(CLIENT_ID,"homeassistant","__**password_not_changed**__");

int retCode = mqttClient.connect(CLIENT_ID); -

retCode = 0 client.State reports 5

Not going anywhere.

If I try to change things in Setting .. mosquito .. “Reconfigure”

To try some of the conflicting directives

Changing username and password, instead of updating something for me says

MQTT

Please enter the connection information of your MQTT broker.

Failed to connect

Err, that was what I was trying to change. (Clearly not what that is for)

If I hit “Submit” unchanged it says reconfigure – but seems the only reconfiguration is takes is no change.

Clearly I am missing something fundamental. :blush:

Home Assistant “add device” leads to “select brand” – so a little out in the cold there.

Home Assistant setting MQTT … Add MQTT device

Leads to [Configure MQTT device details] – promising

Added a device [Hal2] with 4 “entities”

Humidity, temperature, passive IR sensor and IP address message.

Still nothing arrives.

Extra missed info

Ethernet PI and arduino on same hub.
Arduino (Serial console debugging) reports it gets a DHCP address (1 different from the pi) so believe it is networking appropriately.
My pc (arp -a) sees pi on the net,but no report for the arduino.

Totally understand that for some knowledgeable people the obvious answer is …Just the rather obvious … jump into 20 things I know nothing about and configure them ….

But, any simple pointers to what I’m missing, or which info to believe or ignore would be nonetheless appreciated.

Or a pointer to the forum questions I missed?
Cheers

OK, long story short - I created a new "people" user and it all works.
Anyone who can point me to how it is supposed to work without this, as mentioned in the documentation wins a virtual chocolate fish.
Thanks to anyone who viewed and considered helping.

That's a lot I didn't understand.
I'll tell you what I do, and this works with python running on a pi so kinda like Arduino in that sense.
In the MQTT App configuration in HA, I add a user and a password. In the external program I use that login and password to connect to the MQTT broker.

Other than getting the broker doing what I want in the external program that's it.

I've never got the HA login stuff working for the MQTT App, this was so easy I gave up trying with that.

I suggest you install MQTT Explorer on a separate PC (not on your Pi 4). It's extremely useful for debugging issues with MQTT and has gotten me out of head scratchers a couple of times.

1 Like