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

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

Googling it now. Someone should probably test it, my hass installation has no wrappers around it.

ok, it’s just another custom component

Start from here: General | HACS

You don’t need to publish it now, users can add the repository manually, for that only the hacs.json is needed, IIRC. If you need an example, check my repository for the component I made for ABB inverters. I didn’t publish it yet to be available in HACS official repository, but users can add it manually by pointing to GH.

I can work with you on the component, can test/debug and if needed, squeeze bugs. :slight_smile:

If you have a discord account, we can discuss here, I created a specific channel for the custom component: https://discord.gg/vq5xdB8j3Z

ahhh sorry I missed it!!
let’s see if I missed this too: is there the possibility of also having the command to physically open the door and not just to unlock it?

Choose the unlock action in the listbox (unlatch) then press unlock. :wink:

image

ahhhh ok i couldn’t understand what that meant, forgive my english

Don’t worry, if needed, write in italian. :slight_smile: