[APP][Pro] Nuki Direct

Nuki Smart Lock and Homey presence

Homey presence helps Nuki devices to become even smarter.
For example: a standalone Smart Lock can be scheduled to lock the door every evening at 22.00. A Smart Lock driven by Homey can also lock the door every evening at 22.00 but only if all family members are at home.
Another example: A Smart Lock driven by Homey can automatically lock the door when the last family member left home.

But, can Nuki devices also help Homey presence perform better? Yes, if presence in Homey adopts the proximity approach. Proximity is when a personal device (which can be associated with a specific person) is detected in the neighborhood of Homey.
For example:

  1. Homey can detect a beacon. A beacon is a small wearable device that repeatedly transmits the same Bluetooth Low Energy (BLE) signal at regular intervals.
  2. Homey can detect a smartphone connected to home Wi-Fi through network pings or TCP connections.

The proximity must be verified 24x7 and every now and then it can happen that Homey skips a beat (i.e. Homey marks a person as away because it missed a BLE advertisement or a network ping).
Here come the Nuki door sensor. Homey may assume that a proximity device is no longer nearby but this must be confirmed by the Nuki Smart Lock door sensor: if the door hasn’t been opened or closed in the last few minutes, no one could have left home!
Take a look at this flow:


In this flow there is a new condition card that allows checking if the contact alarm (the Smart Lock door sensor) changed its state in the last n seconds. If this condition is met, we can safely assume that someone has really left home.
This flow card is available in the new version of Nuki Direct that will be deployed next week.

3 Likes

These are really good news! :+1:t3:

Bonjour Ă  tous.

J’ai bien compris que la serrure Nuki ne pouvait pas se connecter directement Ă  Homey mais devait passer obligatoirement par le bridge Nuki, quelque soit l’application utilisĂ©e (Nuki Direct ou Nuki Homey).

Mais alors, quel est l’intĂ©rĂȘt de cette application (Nuki Direct) par rapport Ă  l’application Nuki de chez Homey ?

Et pourquoi lui avoir donnĂ© un titre trompeur (Direct) alors qu’elle ne permet pas d’associer directement la serrure et Homey ?

Merci de votre réponse.

Cordialement.

If you could please keep the conversation in English as much as possible, then more people will be able to participate and help you. If you would rather not or can’t communicate in English then please check out Non-English boards/catregories:
https://community.homey.app/c/non-english

Hello @AlainMic,

You asked: What are the benefits of Nuki Direct over Nuki app by Athom?
In my opinion there are several small advantages. For instance: It is slightly faster; it is more secure (in the Nuki app a single wrong tap can open the door when you are miles away from home; in my app the original tap gesture has been replaced by a swipe gesture on a slider and the slider can even be hidden in the “Advanced Settings” of the device); it is more complete (it has commands, settings, capabilities and flow cards for the specific features provided by Nuki API); it is more accurate (for example: it reports when a device is unavailable; for the Nuki app the devices are always available, even when they are really offline).

You asked: why you called your app “Direct” even if it is not able to connect directly with Nuki devices?
“Direct” just emphasizes the direct communication between Homey and Nuki Bridge within the home network (while in the Nuki app by Athom the communication between Homey and the Nuki Bridge is relayed by the Nuki servers in the cloud).
There are two strong reasons why the Homey apps do not allow a direct association with Nuki Smart Locks and Openers:

  1. If you remove the hardware bridge, you have to rewrite a “software bridge” in the Nuki app. It is very challenging. To make a comparison with thermostats: there are several Homey apps that integrate with thermostats like Tadoo or Netatmo but there are no apps that implement a “software thermostat” basing upon a temperature sensor and a relay switch.
  2. Nuki devices are Bluetooth devices and you cannot choose their position (Smart Lock on a door; Opener next to an intercom); this means that Homey (as a software bridge) should be in the Bluetooth range with every Nuki Smart Lock and/or Opener and it is pretty much impossible to comply with.
1 Like

Hello Caseda.
Sorry for my message in French. I thought that a translation of my message into English and eventually into another language (if someone wants to translate into German for example), might not be clear enough.
I won’t do it again :innocent:

Hello Piero_F.
Thank you for your answer which is very clear and very accurate. After hours and hours of searching the internet, I finally figured it out. :blush::+1:Congratulations!

Nuki Direct v3.0.6 released on GitHub and soon available on Homey Community Store .

2 Likes

Hello @Piero_F,
whenever I restart Homey, my Nuki Smartlock and the Opener are no longer available. Both devices show a red exclamation mark.
A restart of the Nuki Direct App does not solve the problem. Only a restart of my WLAN repeater solves the problem although Homey and the Nuki Bridge have a fixed IP address.
Homey FW v5.0.0-rc.38
Nuki Direct v3.0.6

Do you have an idea what the problem could be?
Thx

Hello @DirkG,

It could be a problem related to what you asked two months ago (the network error EHOSTUNREACH).

When Nuki Direct 3.0.6 is started, it makes some sanity checks. The first check is the callback URL check: it checks whether the Nuki Bridge(s) has the correct callback URL in order to fire Nuki events to Homey.

The request is similar to the following:

http: ∕ ∕ 192.168.178.39:8080 ∕ callback ∕ list?token=XXXX (where IP address, port and token must be replaced by the actual values).

I guess that such request receives a negative response (or no response at all) and this causes Nuki Direct to mark the devices as unavailable.

A suggestion: When Homey is in the error condition (after a restart), you can try a pairing procedure. The pairing procedure causes Nuki Direct to send some HTTP requests to the selected Nuki Bridge and to print a detailed report about the received responses. This may help the analysis.

Where can I find the detailed report about the received responses?

In the pairing procedure I do expect a pairing failure similar to the following:

1 Like

Hello @Piero_F,

This night the connection to the Nuki Bridge was interrupted again. The smartlock and the opener have a red exclamation mark.
This is the screenshot when I try to pair the Smartlock:

image

I looked in the event overview of my WLAN router and found the following 4 entries:

26:11:20  05:44:41 WLAN-Device has been disconnected (2,4 GHz), Nuki-Bridge-XXXXXXXX, IP 192.168.178.39, MAC XX:XX:XX:XX:XX:XX.
26:11:20  05:34:59 [FritzWLANRepeater1750E-Wohnzimmer] WLAN-Device connected (2,4 GHz), 72 Mbit/s, PC-192-168-178-39, IP 192.168.178.39, MAC XX:XX:XX:XX:XX:XX.
26:11:20  05:34:38 WLAN-Device connected (2,4 GHz), 72 Mbit/s, Nuki-Bridge-XXXXXXXX, IP 192.168.178.39, MAC XX:XX:XX:XX:XX:XX.
26:11:20  05:34:35 [FritzWLANRepeater1750E-Wohnzimmer] WLAN-Device has been disconnected (2,4 GHz), PC-192-168-178-39, IP 192.168.178.39, MAC XX:XX:XX:XX:XX:XX.

The last entry (05:44:41) was that the Nuki-Bridge has no WLAN connection anymore.
But when I look into the original Nuki app, there is a connection via the Nuki-Bridge to the Nuki-Server.
And of course, I can open and close the smartlock with my smartphone.

Any idea?

Edit: After a restart of the WLAN router, the devices are reachable again.

Hello @DirkG,
Sorry but as software developer of Nuki Direct I see neither bugs in the app nor improvement possibility in the code of the app for avoiding the condition you clearly explained.

I tried to reproduce your condition.
I disconnected my Bridge from my WLAN (by deleting the Bridge from the router configuration). I waited for a while. Nuki Direct reported the devices as unavailable (as of Nuki Direct v3.0.0 the app has the capability to mark the devices as unavailable, if the bridge is not reachable by Homey in the WLAN) but still the Nuki app for smartphone wrongly reported the connection between the Nuki Bridge and the Nuki servers, as you pointed out.


I think this is a minor error of the Nuki app for smartphone

In this condition I’m still able to send commands from the Nuki app for smartphone to the Smart Lock through Bluetooth.

Ok, understand. And of course you have no influence on my WLAN.

Because I restarted the router, I can’t check afterwards if the Nuki-Bridge connected automatically to the router again. And if the smartlock and the opener in Homey were reachable again.
I will inform you next time.

@Piero_F I have installed your app and it is working great.
I am missing some functionality though.

It is about the unlock and hold door open function in nuki.
In the Nuki app you can set it to hold it for x seconds *( 3 is default).
I changed it to a higher value and from the nuki app it works.

Although the Athom app has this option, it does not work, and support claims it is not implemented yet?

Strange because you can select it.

Are you able to include such a function ?

image

Hello @Rens_Hoekema,
Thank you for appreciating Nuki Direct.
Reading the public Nuki Developer Documents I understand that:

The Nuki Web API used by Homey app by Athom allows selecting how long should the Nuki Smart Lock hold the latch when opening the door. Thus, Nuki app by Athom may implement this setting.

The Nuki Bridge HTTP API used by Nuki Direct does not allow it (yet). In Nuki Direct there is a specific a specific slider for opening the door but it holds the latch for the time interval you previously selected in the Nuki app for smartphone.

Therefore, the answer to your question is: unfortunately Nuki Direct is not able to set the unlatch time interval (yet) because the Nuki Bridge HTTP API does not provide this setting to the developers.

Thank you for your reply, you say “not yet”, do you have any idea if this will be anytime soon ?

I wrote “not yet” because in the past some capabilities first have been added to Nuki Web API and then they have been added to Nuki Bridge HTTP API (for example: door sensor events) or vice versa. So, I can argue that in the future the unlatch time interval setting will be added to Nuki Bridge HTTP API as well. However, Nuki does not disclose in advance its development plans


1 Like

Thank you @Piero_F, I hope you can ask the nuki team to add support soon.

Hello @Piero_F,
Yesterday evening I had the same problem that the smart lock and the opener wasn’t reachable anymore. They were marked with a red question mark.
When I try to add a Nuki Smart Lock, I get the error message:
Fetch error: request to http://192.168.178.39:8080/auth
failed, reason: connect EHOSTUNREACH
192.168.178.39:8080

What I did to find out a possible bug and to connect them again:

  • Restart of the Nuki Direct app -> without success
  • Power supply of the Nuki Bridge interrupted, wait a moment, put Bridge again into socket, restart of the Nuki Direct app -> without success
  • Looked into the event list of the WLAN router -> no entries found regarding the Nuki Bridge
  • Deactivated WLAN and BT on Smartphone and MacBook. Connected the Mac to the smartphone (Hotspot via LTE). Logged in to Nuki Web via Mac browser. Opened the Nuki smart lock via Nuki Web.
    Reason: No direct communication between smartphone and Nuki Bridge. The action “open door” is passed from the Nuki Web over the internet via the WLAN router to the Nuki Bridge and then to the Smart Lock
    Result: The connection between the WLAN router and the Nuki Bridge works.
    Conclusion: The connection between Homey / Nuki Direct App and the WLAN router should be interrupted.
  • Restart of WLAN Router -> Problem solved

Might there be a bug in the Nuki Direct App?

If the error appears again, is there a possibility to send you a diagnostic report or something similar?
Or are you sure that the problem is not caused by the Nuki Direct App?