Nuki Smart Lock 2.0 - support all available API actions (i.e. add lock/unlock)

According to the documentation it is not (more ?) true:
Screenshot_20210527_153446

In fact, when I replaced binary_sensor by sensor, I let device_class: door in place and I have the right representation:
Screenshot_20210527_153852

You have specific device classes for each type of sensor, the code editor gave me error on Door when using sensor. That’s why I switched to binary_sensor.

Here’s the official documentation regarding sensor vs binary_sensor device class property:


Ok, I tried the lock switch, as suggested initially by @Friedrieck and you both convinced me. I’ll switch to this one and will update the card to v3.1. :slight_smile:

Thanks.

I updated the post, v3.1 published.

@mahikeulbody: if you can double-check it works I’d appreciate it. :slight_smile:

Very nice !

Sometimes, Nuki Door Status is no more updated (it stays "closed, even opening the door). I need do some lock/unlock to update it. :thinking: But let double check again.

That sensor is updated by the callback of the bridge, it either works or not. If it’s not working it means the bridge is not calling the url/webhook.

Restart HA and do some tests
check HA logs for unkown webhook etc.

It seems that occurs when I unlock Nuki manually and then I open the door : Nuki Door Status stays “closed” but lock status is updated (with a little delay). I need to lock/unlock via HA to update again door status. It is not a callback problem as in the others cases, door status and lock status are updated immediately.

Hi there,
here it’s the same for some minutes after I manually unlocked the door. The icon switched between mdi:door to mdi:door-closed, but the status said “Closed”.
A couple of minutes later it works as intended, icon switches between mdi:door-open and mdi:door-closed and analogous to this, the status.

I have exactly the same behavior.

So may be, it is not needed to do some lock/unlock with HA, just wait a few minutes ?

Ok.
But right now just after writing the above, I am not able to reproduce it again.
I locked it with a different script I have, unlocked it manually and when openend it worked as it should.

I tried with the Nuki app (Android) and it showed a problem with the door sensor (default). I re-calibrated it and now it is ok. I find strange to have this problem at the exact time to test v3.1 :thinking:

PS. May be an electronic noise coming from the bridge perturbing the door sensor in condition of tests (many lock/unlock opening/closing) ? Let check it during a few hours/days.

The Door Status “closed” is the default not initialized state when you restart HA. Unfortunately that sensor is not “unavailable” when it starts like the lock. It is available but not initialized, and it says closed. When the Door Status is not initialized (and Closed) the Lock Status is grayed out. That lets you distinguish things.

As soon as you do some actions manually on the lock or on the door, the Bridge calls the url with the webhook, the Door Status sensor gets initialized with the correct real status, and the Lock that is grayed out becomes available and initialized with the real status of the lock.

This is how it works. Reading your experience, I can’t really understand what you are seeing, that’s why I wanted to fully explain how it worked.

Can you please do some stricter/reproducible tests?

  • Restart HA: you should see the Lock sensor as unavailable (grayed out) and the Door sensor as available and status=Closed.

  • Go at the door and open it so the bridge calls the webhook url and you should then see both sensors available and initialized, and the Door Status should be Open.

Then do another test, if the one above worked:

  • Restart HA: you should see the Lock sensor as unavailable (grayed out) and the Door sensor as available and status=Closed.

  • Go to the door and Lock/Unlock the Nuki so the bridge calls the webhook url and you should then see both sensors available and initialized, and the Lock Status should reflect the action you did on the Nuki.

Please let me know the result.

The thing I changed in v3.1 is I’m using the Template Lock instead of Template Switch. But I didn’t notice a different behaviour when I tested here.

Thanks for the help.

I can assure you I didn’t put any strange things in the code. :slight_smile:

It’s just a coincidence, I hope.

That run exactly as you described. As I said, I am aware of the HA restart “problem” so I do this operation (opening the door or unlock/lock) after each restart.

I can assure you I didn’t put any strange things in the code.

I was sure of that but I found strange two people have the same symptom at this exact moment. But when I saw that Nuki app showed the message “capteur de porte bloquĂ©â€ (in english, that would be something as “door sensor blocked”) I understood the problem was probably on the Nuki side. And indeed, all is running very nice after re-calibrating the door sensor.

So may be it is a coincidence, may be this HA config reveals a bug into Nuki bridge or Nuki lock. I will continue to “stress” the lock in order to see if I can reproduce the problem.

So now that you recalibrated the doorsensor, you don’t have the odd behaviour anymore, right? everything’s working as expected?

But @Joerg didn’t say he had the calibration error in the app. I don’t beleive in coincidences either, so I want to be sure. :slight_smile:

I told to fast, I just reproduce the problem ! With again the door sensor in default in Nuki app. I will try to re-calibrate it and use the Nuki door only with Nuki app to see what appen.

So the app told you that the doorsensor is not calibrated, AGAIN? :slight_smile:

I don’t know what could possibly cause that
we’re not doing anything different respect to when we used the Template Switch. Instead of dong Turn On/Turn Off we’re doing Lock/Unlock.

Let me know your findings
but I’d like to know also what @Joerg experience is, he didn’t mention the uncalibrated sensor problem.

Also, I don’t have this issue, and I’m not able to reproduce it here.

I’ll wait for your feedbacks


The first steps were okay. But after I manually unlocking the lock I got the same behavior:


Door closed

Door open

After writing the above I went back to the door and after opening/closing it, the status came back to normal, but battery and last actvity were unavailable. Coming back to my desk and start writing this paragraph everything refreshed and now all is good :thinking:


It seems it takes a while after a restart of HA and a first unlock.

I checked the Nuki Log - it says Door sensor disturbed when this happens.
17:27h and 18:19h → see time of my screendumps