MQTT API Specification v1.4

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

Hi Peter,
checks the client ID used by each device/user. If the client ID is the same, every connection and action by one client will disconnect another.
If the Client IDs are different, which should always be the case with an mqtt broker, you shouldn’t have this behavior.

regards,

Hi Thomas

clients has different ids:
– device is connecting under SL3P_AABBCCDD:
2023-07-17 17:44:48.4304|15996|26|TRACE|Hub|Client Connected: 192.168.100.113:52464, SL3P_AABBCCDD, V311

– client which sends command goes under (2e3e17a0b1e7449b913e6cf16cde97ee):
2023-07-17 17:46:20.7830|15996|20|TRACE|Hub|Client Connected: 192.168.100.202:59097, 2e3e17a0b1e7449b913e6cf16cde97ee, V311

ok, so you can rule out a simple problem with the broker (no acl in your configuration?)
the lock doesn’t reboot after disconnection (I don’t think the mqtt api gives the uptime like it does for the bridge)?

no ACL at this level (if you mean access control list). I just started to play with it 10 days ago - it was not working (disconnection after command) - I wrote here some new topic, but nobody responded to that for 10 days. Yesterday, I gave that a second try: lock was not calibrated so I calibrated it, connect it to MQTT, sent the command and it worked fo r 5 times. I was super happy, that I solved the problem. I started to test marginal scenarios like server disconnection and reconnections (how long will it take to reconnect). But after single reconnection it stopped working again. I wrote to support via Nuki App - no response for 24 hrs…

So I am pretty sure, that command is constructed according specification - as it was working for a while.
I forgot to mention, that lock had fw 3.7.2 Beta - yesterday. Today I have upgdraded it to 3.7.3 Beta - but no difference. My concert here is also with the Beta word. I’d like to have some stable fw in there.