ESP32 will not connect to MQTT

OK, I don’t know what is wrong here…

I have a ESP32 that I want to be discovered by MQTT and I can’t get it to work.

I have installed FW on the ESP32 on ESPresense and I can get to it by its IP address. I have configured it as shown by the attached screenshot and used the details given by the MQTT configuration in HA , but it will not be discovered by MQTT.

I have tried to change the Server (ESP32) and Broker (MQTT) to be the actual IP address of the HA installation, but that did not help.

What could be wrong?

Post your code.

And use MQTT Explorer to see if it actually updates the MQTT Broker.

It may help if you tell us about your installation - how HA is installed (docker? HAOS? Something else?). Also what broker you are running and how that is installed (Mosquitto add-on for HAOS? Something else?)

Also the “Server” and the “Broker” are the same thing - and it is better practice to assign it a static IP address and use that rather than relying on mDNS.

But the best advice in the previous posts is to install MQTT Explorer, confirm it connects to your broker and confirm that your client also connects to the broker and register the correct topics.