MQTT "wrong identifier" error

I have been trying to connect my Nuki 4 Pro to an MQTT broker, which is run on iHost machine. Leaving apart an interesting decision to hardcode 1883 port usage, at the end everything ended with “wrong identifier” error, even trying to connect via 1883 port to a fully operational Mosquitto broker, which operates up to v5 protocol and of course supports Client ID as well.

Then strange things started. One Nuki help’ article (as well as the Support agent later) was suggesting “to check the identifier” while no one still could explain clearly what this action means in reality.

Another article clearly stated as follows:

If the app indicates that the MQTT connection cannot be established due to an incorrect identifier, please contact our Support Team.

So I did, I contacted the Support and after 2 days of questioning me whether I tried to switch everything off and on again, whether the lock and the broker are in the same LAN, whether I “checked the identifier”, etc, etc, suddenly they concluded that there is nothing they could help with, they have no idea what that “check the identifier” means in details and they don’t know why the article suggest to contact them, as the issue (quote) unfortunately falls outside the scope of what our Customer Support team can directly assist with.

So, they suggested I have to go to the Developers’ forum and hopefully someone could help. So, here we are, I am here now hoping for a help.

It appears your broker is rejecting the client ID used by the Smart Lock’s MQTT client. This ID usually follows the format “Nuki_NUKI-ID-OF-YOUR-DEVICE”. This issue might be caused by specific ACLs, client ID naming conventions, or restricted characters like underscores. I recommend checking your broker logs to determine the exact cause of the rejection.

Ok, I made additional checks, what we have so far.

Fact A. The same Nuki lock doesn’t want to connect to iHost built-in Mosquitto broker while it perfectly connects to Mosquitto broker installed on my PC.

Fact B. iHost built-in Mosquitto broket operates up to v5 protocol and perfectly accepts connections from Client with Nuki_NukiID - please see the attached screenshot below

Fact C. iHost built-in Mosquitto broker is binded to port 1883, which is also hardcoded (the same as for Nuki lock, really pity situation), and it has no setup, no off switch, no log, no interface at all. So it just always runs and it blocks port 1883 from any other service.

Fact D. Nuki lock, itself, doesn’t want to connect to anything rather than port 1883, it’s really a pity story but it’s unfortunately hardcoded.

Taking into account #B - I don’t really think that the problem is really with the Client ID Nuki_40af72ec (same for Nuki_40AF72EC), as all of them are perfectly accepted by the same iHost built-in broker for other connections, from NodeRed, for example.

But what could be a solution, in such a situation?.

I think I ran into the same issue, and I sadly do not know how I did resolve it. I have Mosquitto Broker running in Home Assistant and it took a lot of fiddling around to get it to work. Tried creating different types of logins and eventually it worked.

One difference I notice: your “Host name” field has an ip address instead of a hostname. I also used the ip of my HA first, but now I use the hostname (homeassistant.local in my case). And that works for me now. I am not sure if that was the solution for me though.