MQTT API Specification v1.4

Don’t spend more money buying another lock: keep your Nuki 2.0 and buy a $5 M5Atom ESP32 device with this firmware: technyon/nuki_hub: Use an ESP32 as a Hub between a NUKI Lock and your smarthome. (github.com)

You will have total control of the lock via MQTT and also automatic integration (autodiscovery) with Home Assistant. All LOCAL, no internet dependency.

An MQTT implementation that requires internet is pure non-sense.

1 Like

That’s really useful to see, thanks!

Does that MQTT / ESP32 integration expose (to Home Assistant) HOW the lock was unlocked / locked (e.g. auto / keypad / manual)?

I’m missing that with the Nuki & Bridge combo in Home Assistant.

Oh wow. I’m using ESP32 and ESP8266 for everything. Haven’t heard about this nuki_hub for ESP32. Thanks mate! :slight_smile:

1 Like

No it does not.

This discussion is also off topic in the SL3P MQTT thread. Please open a seperate topic if you wish to discuss about the ESP32 module.

Did you check the repo?

Yes it does.

You’re right, it’s better to have a separate topic.

UPDATE: opened a new topic here.

thanks!

Hi Jürgen, is it possible to pull a request for state of my Nuki smart look? I want to have this when I sometimes need to startup my node red server after a maintenance. Now I have to wait until a state change, but with triggering a pull request I get all data over the device. If this exists, what I can’t find, can you give me the syntax?
Thanks
Per

Hi @Juergen,

Any plans to support MQTT encryption or at least add an ability to prevent unlocking via MQTT - similar to the granular permissions you can have over API?

Thanks

It’s all in the forum. Just search or read through the topics.

You don’t need that. states are retained by the MQTT server. I.e. whenever you connect to the server you will receive the latest state that was sent by the Smart Lock to the server.

Hi @Juergen ,

Thanks for your answer.

Just to clarify the second part regarding prevent unlocking.
I’m aware to the “Allow Lock Commands” toggle. I was referring to more granular permissions. My use case is to allow locking via MQTT but prevent UNLOCKING due to security concerns.

P.S. - It’s 2 days since I have added the MQTT and it seems that the WEB API (used by google assistant) is having a lot of connectivity issues since then. Are you aware to such issue?

Thanks again.

1 Like

hallo Jürgen,

got FW 3.6.9 and I can confirm, the autolock messages are send out via lockActionEvent, code “2,6,0,0,0” :+1:

/MfG
Zoltan

Hey, I added the door sensor to my setup and noticed that HA auto-discovery is not published for it even though it is part of the 1.4 spec. I think there might be a bug related to adding it after MQTT has been enabled? Deactivating and activating MQTT fixes this.

Lock FW version: 3.6.9
Sensor FW version: 1.1.2

(I did a quick search on this post to see if was already brought up and couldn’t find any, I’m sorry if I missed this)

1 Like

Hi all,
has anyone achieved to request the BatteryChargeState proactively? I am using nodered with a mosquitto mqtt. I am able to send messages to mqtt to lock and unlock my Nuki but I am not able to get the BatteryChargeState back from it. What do i need to pass to the mqtt to make Nuki answer with the right battery charge state?
Thanks.

I have the same issue, anyone know a fix?

2 Likes

You can not send a message to ask for a battery state. The battery state is published by the Smart Lock in regular intervals and as it is retained you will always get the latest value when you connect to the mqtt broker and read the nuki/nuki_id_in_hex/batteryChargeState topic.

But how do I read it? What do I need to send to the Mqtt? To return it. The topic is clear. But when I just send the topic nothing is returned to me. So I expect that I have to send something as a message.

You just have to subscribe to the topic. Maybe this helps: What are Retained Messages in MQTT? – MQTT Essentials: Part 8

Can anyone help me to figure out what am I doing wrong that my commands over mqtt does not work. I am running my own broker. I see that device connects but when other client publishes command to unlock it almost instantly drops connection. I had a moment, when it started to work with lockAction command (5 commands went through successfully after calibrating my lock). But suddenly, it stopped working again without obvious reason.

I followed v1.4 specification and I have already successfully implemented mqtt connectivity with other products and never run into such problems.

What am I doing wrong? Is there some way to read some traces from lock why the connection has been dropped? Is this feature still in some kind of Beta, because app is not mentioning any Beta word?

A bit of my traces:

– here I see it subscribes to lock and unlock actions
2023-07-08 13:27:13.8998|17656|61|TRACE|Hub|Client Subscribed: SL3P_AABBCC99, nuki/AABBCC99/lockAction
2023-07-08 13:27:13.8998|17656|60|TRACE|Hub|Client Subscribed: SL3P_AABBCC99, nuki/AABBCC99/lock
2023-07-08 13:27:13.9981|17656|62|TRACE|Hub|Client Subscribed: SL3P_AABBCC99, nuki/AABBCC99/unlock

– here different client send the command.
2023-07-08 13:27:45.7581|17656|68|TRACE|Hub|MQTT Client Publish: Topic = nuki/AABBCC99/unlock, Payload = true
2023-07-08 13:27:47.4382|17656|74|TRACE|Hub|MQTT Client Command: waiting…

– lock does nothing and reports connected, false
2023-07-08 13:27:48.2135|17656|81|TRACE|Hub|Server Message Not Consumed: SL3P_AABBCC99, nuki/AABBCC99/connected, false