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

Are you still having problems? You didn’t reply to my last answer to you…:slight_smile:

Anyway, if you are still using this config for the secrets, the problem is the HA internal URL:

image

The bridge does not know how to resolve homeassistant.local. Unfortunately, HA devs decided to use mDNS stuff that creates MANY MANY issues to users.

Replace homeassistant.local with the IP address, or, better: configure a proper hostname in DNS for HA, so other clients can resolve its ip address, and always use that in URLs. That is why you don’t receive callbacks from the bridge.

Let me know. Probably @tomkorelo issue is the same, that’s why I wanted to see his 4 secrets config too.

Yeah I checked all the things you told me and it still didn’t work so I thought it was of the internal changes Nuki Support did on my Opener/Bridge and just gave up.

But that solved it for me, everything works now! Thanks

I’m sorry. Unfortunately HA and DNS issues are more common than most people think.

Glad it’s working for you now.

Ive found a solution for my problem.

It seems that for my Intercom STR HT2003/2, the cableplan in the Nuki app was incorrect, which lead to it generally working, but seemingly having some issues with the ring suppression.

I rewired the cables somewhat and now its working as I would expect. Suppressing a ring actually supresses it, but it still notfies HA via the webhook.

Thanks Philipp.

Nuki Card is very transparent on this, it basically receives callbacks from the bridge and updates the sensors, nothing more. So either it was a bridge fw bug or something else related to the hw.

I updated Stephan (nuki dev) about your solution.

Hello @alexdelprete again :slight_smile:

I know that you are not using opener, but I have a problem, I can’t open the front door via this rest command:

service: rest_command.nuki_lock_action
data:
  nuki_id: 685954282
  dev_type: 2
  action: 2

It works from card https://i.imgur.com/rJrUU9b.png
This what I can see in my logs:
https://i.imgur.com/aNpvebq.png

You can use these for nuki_id and dev_type so you don’t need to use fixed values:

dev_type for smartlock: {{ state_attr('sensor.nuki_bridge_endpoint_list_lock','deviceType') }}
dev_type for opener: {{ state_attr('sensor.nuki_bridge_endpoint_list_opener','deviceType') }}
nuki_id for smartlock: {{ state_attr('sensor.nuki_bridge_endpoint_list_lock','nukiId') }}
nuki_id for opener: {{ state_attr('sensor.nuki_bridge_endpoint_list_opener','nukiId') }}

Try the code this way, it works here:

service: rest_command.nuki_lock_action
data:
  dev_type: >
    {{ state_attr('sensor.nuki_bridge_endpoint_list_opener','deviceType') }}
  nuki_id: >
    {{ state_attr('sensor.nuki_bridge_endpoint_list_opener','nukiId') }}
  action: 2

Hi again.
I tried with your approach, but still it doesn’t work.
this is my script:

alias: Unlock Bottom Door
description: unlocks bottom door
sequence:
  - service: rest_command.nuki_lock_action
    data:
      dev_type: >
        {{ state_attr('sensor.nuki_bridge_endpoint_list_opener','deviceType') }}
      nuki_id: >
        {{ state_attr('sensor.nuki_bridge_endpoint_list_opener','nukiId') }}
      action: 2

Im calling it via my lovelace like this:

type: grid
cards:
  - type: button
    tap_action:
      action: call-service
      service: script.unlock_bottom_door

when I call it from lovelace like this then it shows popup (unlock/lock) it works:

type: grid
cards:
  - type: button
    name: Unlock Bottom Door
    icon: mdi:door-open
    entity: lock.nuki_opener_action

In my logs I cant find anything relevant…

Works here, both on lock and opener. If you have no error 404 in the logs, it means it worked. You can also check the bridge log to see if it received the command correctly.

curl -X GET 'http://nuki-bridge.axel.dom:8080/log?token=xxxxx'

Put the code in dev tools script, and try it there first. I’m testing it there, and it works fine.

service: rest_command.nuki_lock_action
data:
  dev_type: >
    {{ state_attr('sensor.nuki_bridge_endpoint_list_opener','deviceType') }}
  nuki_id: >
    {{ state_attr('sensor.nuki_bridge_endpoint_list_opener','nukiId') }}
  action: 2

the logs showing that was successfully unlocked opener.
When I replace for lock devicetype and id it works. Im begging to think that tha cause is wrong wiring on my intercom…but again I can send signal from your nuki card…so it shouldn’t be the wiring problem itself…

I don’t understand: when you unlock the Opener from Nuki Card it works, and when you do it via that service call it doesn’t work, but the log on the bridge says that it received the command and it opened?

It doesn’t make sense…the Nuki Card does exactly what that code does, and if the bridge in the log says it opened, it should open. Unless the wiring fails sometimes…did you try repeating 10 times with Nuki Card? It always works?

Always :slight_smile:
Nevermind, I edited button to unlock like from yours card, although I cant tell siri to unlock button door… :slight_smile:

Well, it means I’ve done a good job. :rofl:

Siri knows that I am a fierce enemy of Apple stuff… :rofl:

1 Like

Hello! Thank you, great work:
With Homeassistant core I receive this error:
Client error http://192.168.1.5:8080/callback/add?url=https%3A//192.168.1.2%3A8123/api/webhook/eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiI5OTg1ZDcwMGNiNzg0NmM0YWUxNzMyYjEyMmQ0MGU5MCIsImlhdCI6MTYzMDkxOTczNywiZXhwIjoxOTQ2Mjc5NzM3fQ.0wAd9ilfl1P3et69js2jUxWwDGzxrMhrqyEZvE&token=XXXX

It’s because I run home assistant in https? I added this line in secrets.yaml nuki_ha_internal_url: “https://192.168.1.2:8123

correct, Nuki bridge doesn’t support https callback URLs

@alexdelprete inspired by your great work, I’ve made a custom integration for Nuki Locks (openers)

  • Unlike to the official one, it also uses callbacks
  • Like your automation, it exposes pretty much everything via sensors, binary sensors, etc.
  • Additionally I’ve implemented authorization management entities (key codes, user accounts), using Nuki Web API token. With this, you can enable/disable access via those ways. This part is optional, if you provide the token

If you have time you could take a look here: https://github.com/kvj/hass_nuki_ng

1 Like

Hi, thanks for your kind words.

Did you read the NOTES in the first post? Right at the beginning:

Dear Konstantin, you can’t imagine how long I’ve been waiting for a Python dev to step up and tell me he wanted to develop Nuki Card as a custom component. I’m so so happy, even if that means closing this wonderful support thread through which I interacted with a lot of really cool and smart people. :slight_smile:

I’ve actually developed a custom component for my solar inverter, but I started from an existing project, and didn’t know how to start from scratch, I’m no Python develeoper, just a tinkerer, but I’m starting to understand python a little bit.

I will try your version ASAP and will provide feedbacks. You want me to give you feedbacks on GH or you also opened a new thread on the forum? Looking forward to share my Nuki experience with you to make the best Nuki integration possible for HA. :slight_smile:

Thanks a lot,

Alessandro

2 Likes

Whatever works for you. I’m planning to open a thread in a dedicated section of this forum but hasn’t opened it yet

1 Like

We can also do it here, while you create the new thread, I don’t mind actually. So Nuki Card users can see what’s going on. :slight_smile:

I would advice, before opening the thread, to make sure you add HACS support, so users can more easily install it. It’s pretty simple but it really helps novice users installing it.

1 Like