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

Forget what I said… I write /packages instead of packages/ sorry for the loss of time, thank you for you answer and thank you very much for your great work !

Thank you for the feedback Nathan. So I assume it’s working fine right? How did you find the installation, simple enough? Let me know if you feel I need to modify the instructions. :slight_smile:

Hello everybody,

I had the weird idea of auto-configuring the bridge for the callback, since I have all the info needed (bridge hostname/port, token, webhook), so the users, mainly the beginners, don’t have to tinker with curl, the browser, etc.

I’m evaluating pros/cons of this automated approach, I would appreciate any kind of feedback from users and particularly the people that helped me develop/test this integration: @Joerg, @Friedrieck, @mahikeulbody, @spokin.

Do you see any possible risk/problems? Is it too much automated configuring the bridge? Let me know your thoughts before I spend time on this feature. :slight_smile:

Thanks, as always.

Alessandro

The best solution would be to put this code in a custom integration that is distributed via HACS.

Alessandro, yes it’s very easy, I just understand at te begining there is a packaged version, and so I tried like your first post, with curl etc.

Also I first use the token from web nuki and not from the bridge app

I’m not a python developer, and not a HA expert, otherwise I would’ve already done it.

I made only one HACS component, for ABB inverters, but I basically modified an existing component, rewriting 80% of the code. :slight_smile:

Anyway, it’s in the bucket list, but since there’s a package version now, and the configuration only requires 3-4 secrets, it’s not high-priority. Furthermore, the official integration should be out sooner or later, and I hope they will include at least the callbacks for door/lock. I don’t think they will include all system’s sensors unfortunately.

curl is necessary to configure the bridge for the callback. but I could automate that too, I’m thinking about it, so users don’t have to do it manually.

Ok, I’ll see if I can clarify better the difference between the Nuki token and HA long-term token. Thanks.

UPDATE: I updated the first steps and added a note explaining the difference among the two tokens.

1 Like

Hi @alexdelprete
Thanks for the great integration and well explained how to…
I followed your steps and got it working in minutes!
only issue I’m having now is a 1-2 minutes delay for every state change :unamused:
I’m guessing it might be related to the fact I’m using “DuckDns” and it means my HA uses https protocol for that reason.
on the other hand all entities do work and I get all the correct info, so the Nuki Bridge does send it somehow right?
If you have any idea of what could cause this kind of delay, and of course any suggestions to resolve it…
Thanks again,
Adi.

Ciao Adi, nice to meet you. :slight_smile:

If you are seeing 1-2mins, it means you are not receiving the callback from the bridge. Please take a look at the last posts I exchanged with @andrej33, start from this and follow the discussion: Nuki Card with Callback support (supports both Lock & Opener, it replaces the official integration) - #365 by alexdelprete

First of all you need to make sure you have configured the callback on the bridge with the long-term token generated in HA. Then you need to be sure you are not looking at the official integration sensor, like it happened to some users. Did you follow the installation steps and verify each one of them before moving to the next? Start from there.

I’m pretty sure the problem you are facing is a simple one, you just need to focus on each step at a time, in the end you’ll have the expected result. :slight_smile:

Is there any alternative to get the callback if your HA is only accesible via https? How can i enable HA to also be accessible localy by http and from outside the network via https?

if it is ONLY accessible through https, since the bridge only supports http, you can’t use the callback.

You need to use NGINX Home Assistant SSL proxy: “typically used to forward SSL internet traffic while allowing unencrypted local traffic to/from a Home Assistant instance.”

This is off-topic for this thread, but you will find a lot of threads in the forum regarding this configuration. Check this post, as an example.

1 Like

As said by alexdelpetre, you have to use NGINX Home Assistant SSL proxy addon. I use it with my own domain with this configuration :

domain: hass.mydomain.fr
certfile: fullchain.pem
keyfile: privkey.pem
hsts: max-age=31536000; includeSubDomains
cloudflare: false
customize:
  active: false
  default: nginx_proxy_default*.conf
  servers: nginx_proxy/*.conf
1 Like

May be it would be a good thing to add a warning about that into your initial post.

It’s there since the beginning: " Please remember that the callback can be done by the Nuki Bridge only via HTTP. Unfortunately HTTPS is not supported."

Are there any news about integration of Nuki Opener via callback?

Would love to see that :slight_smile:

Indeed, sorry ! So may be you could complete the sentence with something like :

Unfortunately HTTPS is not supported. You can workaround this Nuki bridge limitation using NGINX Home Assistant SSL proxy addon.

If I do that, we’ll have to also support NGINX configuration in this thread. It’s up to the users understanding what’s required to support http only. I don’t want the thread to become too chaotic. :slight_smile:

It’s up to the users understanding what’s required to support http only.

Many users with https access will stop to read this integration without to know there is a workaround. It’s a pity.

Others as mefistofelis will ask about that and someone will answer them, you cannot control that. Anyway, almost all users without https access will read only the first post, not the full thread. So I fail to understand why that could add chaos to this thread :thinking:

If I do that, we’ll have to also support NGINX configuration in this thread.

I don’t see why. Furthermore if it’s not you it could be someone else.

Well, since Italy team has beaten our best enemy (I’m french), do as you see fit :zipper_mouth_face:

I think a user who decides to implement NGINX for https access has the skills to understand that it’s possible to implement https only from the internet while leaving http access from LAN/WLAN.

I don’t want to control, but I also don’t want to encourage too many discussions on things that are not relevant to the integration.

the point is not who does it, but the potential confusion in the thread, that would discourage people from reading info regarding the integration.

I would do what I think is appropriate even if France won the tournament. :slight_smile:

In any case, I added your note to the first post. Let’s see what happens…

No, you can have https access without NGINX. In my case I installed NGINX only to get callback working. I was not aware of such a solution until I discovered it by myself. And it is not only a matter of skills (I followed a guide to install https access), you still need to be aware that a solution exist.

About confusion in the thread, I think that is a false problem : at the opposite of a “classic” thread, almost everybody will read only your initial post and, in case of problem (or to thank you), will skip all posts to add theirs.

I would do what I think is appropriate even if France won the tournament.

It was a joke, of course :wink:

In any case, I added your note to the first post.

A big thank for the people who will not lose the opportunity to use your nice work because ignoring the workaround. :+1:

PS. By the way, are there really a lot of people using Nuki lock through HA without https access ? I mean, do they limit themselves to control the lock only when they are connected to their local network or, worst, outside but through http access ? It seems to me that this question is a big point to use this integration since many people want to be able to control the lock outside home.