Hi, I’m new here and need an advise. I want to integrate some of my older ESP32 device I developed before I started with HA.
Looks like to me the easiest way is MQTT and I’m testing code that would report the status of sensors to HA. These are the messages in logs when my device attempts to connect to HA MQTT broker.
Can you please point me to documentation so I can learn what MQTT broker requirements for authentication? So I can make changes to my ESP32 code. Is it possible to remove authentication requirement for now?
Or what is the best way to handle this situation?
Thanks.
2025-03-31 22:41:34: New connection from 192.168.107.112:55782 on port 1883.
error: received null username or password for unpwd check
2025-03-31 22:41:34: Client esp32-fc disconnected, not authorised.
You could disable authentication in whatever mqtt broker you are using.
Edit: as @tom_l says you must use authentication in the mosquito addon.
Note: This add-on does not support anonymous logins; all connections must use a username/password to connect. allow_anonymous true nor any anonymous ACLs will not work with this add-on.
No, not with the Mosquitto add-on. It has to use authentication. You could of course run an mqtt broker yourself that is not an add-on. That could be set up to have no such requirement.
How you authenticate with the broker depends on what programming language and libraries you are using. This is the wrong place to ask about that.
On the Home Assistant side you can manually configure your sensors in YAML (see: MQTT Sensor - Home Assistant ) or you can publish a discovery messsage to the homeassistant topic to have the sensors added automatically. See: MQTT - Home Assistant ).
Well, I need some directions here. I can not find how to bring sensors listed in configuration.yaml out to the default dashboard ( Overview). I think based on logs the data is available and stored in /data/mosquitto.db
Here is part of the mqtt broker log, part of the configuration.yaml and messages I’m getting in the /config/integrations/integration/mqtt: by “Listen to a topic”
2025-04-01 20:11:40: New connection from x.x.x.x:63184 on port 1883.
2025-04-01 20:11:40: New client connected from x.x.x.x:63184 as esp32-client (p2, c1, k15, u’mqttclient’).
2025-04-01 20:16:18: Saving in-memory database to /data//mosquitto.db.
Like I mentioned HA+ yaml is totally new to me. Anyway changes made, device is publishing to the topic CleverEC/temp. Here is an example: Message 1 received on CleverEC/temp at 10:36 PM:
27.00
Is this message formatted correctly?
Unfortunately I don’t see how to bring collected data to the dash board in this doc: [MQTT Sensor - Home Assistant].
Is the entry for mqtt sensor in the configuration.yaml correct?
If I need to add a Device, I don’t recognize the name to select.
Thank you.
I found the “DHT11 temp” under Entities after restarting HA.
Here is how the data looks like :
DHT11 temp changed to 27.60
11:02:10 PM - 1 second ago
Thank you.