Nuki Card with Callback support (supports both Lock & Opener, it replaces the official integration)

Ciao Alessandro, thank you for your reply. My garage door (cover) does show the four states on the HA dashboard with 4 different icons and same would be nice for the Nuki smart lock also because then you would have a visual feedback that you triggered the locking/unlocking (this process on my smart lock device takes about 5 seconds).

Can you please correct this in first post - I think it should have ‘-’ in front of binary_sensor.
Or maybe I’m missing something. :slight_smile:

No it shouldn’t, It is correct. It’s a trigger-based template binary sensor, introduced recently, IIRC.

You can study it here

A lock is not a cover. Like I told you before: the bridge does not do a callback with the opening/closing states, it only callbacks when it changes from locked to unlocked or viceversa. Hope it’s clear now. :slight_smile:

Check this post, where I posted a trace log of what the Nuki Bridge does.

But let’s assume it would callback for those states: the transition time would be an order of 3-4 secs, it makes no sense, unless you stare at the Nuki Card for fun all the time. :slight_smile:

5 seconds to lock the Nuki? Are you sure? Mine takes maximum 3 seconds…

Thank you.
As a new starter to HA this thread is a lot to take in. I’ll have a go.

Almost OT
Can you open the door with Nuki? In the sense of the last half turn of the key that unlocks the latch (scrocco in italiano)?
With my Nuki I can do the 2 turns to lock / unlock the bolts but not to open the door (it is essential to leave the key at home). Thank you

That depends if it does one turn or two. May be also if the lock is soft or hard to turn (?).

Anyway, as ww9020, mine take 5 seconds to lock.

But I don’t feel the need to follow locking/unlocking process for such a short time.

Sure you can, it’s called unlatch.

If you go in the settings of the Nuki app, you can configure the type of door handle, probably right now you are using the first one, standard handle, that doesn’t do the last half turn, if you choose the second (knob) when you unlock it also does the half turn and it opens the door.

The API action is always lock/unlock, so this integration should work the same way, it’s the type of handle you choose that tells Nuki to do the last half turn and also open the door. :slight_smile:

image

Let me know if it works…

I did this exactly to go deeper in HA. You learn a lot by doing these things. Study the code and see how it works…read HA documentation…there’s a whole world to discover. Happy trip! :slight_smile:

Correct. I configured not to do the FULL number of turns, mine supports 4-5 turns, it’s too much, I configured half turns, for battery concerns and also time to open/close. That’s why it takes less for me.

Even if you felt the need, I could do nothing about it because the bridge doesn’t callback with those states. It callbacks only on locked/unlocked states.

Thank you for the encouragement, Alessandro.

You’re not alone, don’t be afraid to ask. In this thread in particular, I found a lot of nice and kind people that are more than willing to help and are very competent on the matter.

I’m more than willing to help, but I’m not an HA expert yet, still at the beginning of the journey…well, let’s say a little bit more than the beginning after this, but definitely not an expert. Don’t hesitate to ask. :slight_smile:

Cheers, Alessandro.

1 Like

I understand the need but I will never do it without some precautions. Imagine you unlock the lock by inadvertence (checking the house with a mobile phone, as an example) when you are at hundred/thousands of kilometers of your house… if you don’t have a people you could ask to close the door you have no way to undo the error.

I would add some confirmation request to the unlock action in this case (at least when I am traveling).

I didn’t use that feature because too many things could possibly go wrong and leaving the door open while you’re far away is something that I want 0% of risk of happening. That’s why I opted for the standard handle in the configuration of the app, so it would never unlatch.

Created the identical setup as described on top of this post.
Some of the entities on Nuki card are empty, incl. nukiId.

It turns out one of rest sensors " Nuki Endpoint List" is not being created. Logfile shows this error:
Logger: homeassistant.components.sensor
Source: components/rest/sensor.py:165
Integration: Sensor (documentation, issues)
First occurred: 19:35:56 (2 occurrences)
Last logged: 19:35:56

  • Error adding entities for domain sensor with platform rest
  • Error while setting up rest platform for sensor

Traceback (most recent call last): File “/usr/src/homeassistant/homeassistant/helpers/entity_platform.py”, line 383, in async_add_entities await asyncio.gather(*tasks) File “/usr/src/homeassistant/homeassistant/helpers/entity_platform.py”, line 588, in _async_add_entity await entity.add_to_platform_finish() File “/usr/src/homeassistant/homeassistant/helpers/entity.py”, line 614, in add_to_platform_finish await self.async_added_to_hass() File “/usr/src/homeassistant/homeassistant/components/rest/entity.py”, line 64, in async_added_to_hass self._update_from_rest_data() File “/usr/src/homeassistant/homeassistant/components/rest/sensor.py”, line 165, in _update_from_rest_data json_dict = json_dict[0] IndexError: list index out of range

When running a curl command I’m getting an empty array returned from the bridge.

Anyone seen this, any ideas on what might be wrong?

BTW. I’m on the latest version for ha and Nuki.

DId you activate the API for the bridge in the mobile app? Make sure the port and the token are correct.

Call the url https://api.nuki.io/discover/bridges and check the output, it should be something like the json array shown in the document.

Hi Alex,

It turned out the bridge was not configured correctly during initial setup, I tried to set a static IP address which was likely to be cause of this misery.
After configuring through reserved DHCP it now works.

Awesome, very happy with your work!

Anyone already using > 1 lock connected to the same bridge?
According to Nuki it should work, provided both are in BT range of the bridge ofc.

Any thoughts on the compatibility with the solution?

I thought you did at least a ping to the bridge before posting about the problem. Gave it for granted. :slight_smile:

In my home LAN there are only 2 devices with static IP addresses, the OPNsense firewall and the main switch. All the rest of the network devices are DHCP reservations.

Glad you solved it and that the component works for you.