What it means
The broker accepted the network connection but refused the client: CONNACK return code 5.
Why it happens
- Anonymous access is off and no login was given.
- The user exists but the ACL does not allow it (custom Mosquitto ACL file).
- Login with the wrong user type: in the HA Mosquitto add-on use a Home Assistant user or one from the add-on’s logins.
How to fix it
- Set the username and password in the client.
- Create a separate Home Assistant user for MQTT clients (Settings → People) and use it.
- Check the ACL file if you use one; restart the add-on after changes.