Cannot get ESP8266 to connect to MQTT

I’m trying to set up esp8266-midea-dehumidifier to work with Home Assistant. I’ve flashed the ESP8266 and have configured the WiFi and MQTT server details.

However, when it tries to connect to the Mosquitto broker, it says “Client disconnected, not authorised”. I’ve checked, and disabling authentication does allow it to connect correctly.

I’m not sure exactly where things could be going wrong here, as I’ve tried connecting to the broker from my PC with the same credentials, and it had no problems.

The code used for connecting to MQTT can be found here, if needed: esp8266-midea-dehumidifier/src/esp8266-midea-dehumidifier/esp8266-midea-dehumidifier.ino at 317e2295dde70d7b20d649d6f0dda061c608fb11 · Hypfer/esp8266-midea-dehumidifier · GitHub

Hello Daniel,

Specifically, don’t know… (Version 3, 3.1, 3.11, 5 thing maybe?)
Generally I would add another login and password than restart the add-on then use it for this device, just to be able to track things better in the log.
I would look at the broker independently to see what’s happening. MQTT-Explorer can help you be successful!
If you have Add-ons available, try adding this Add-on repository to your Add-on list. GitHub - GollumDom/addon-repository.
With this you can see that the broker sees and likely find the bug.