Nuki smart lock integration with unlatch feature exposed on Homekit

Hi,
I would expose unlatch feature of my NUKI SMART 3.0 PRO WIFI on Homekit.

This feature is available calling a service obtained using Nuki Web API.

So I suppose I have to create a template as this:

lock:
  - platform: template
    name: SoloApriPortaIngresso
    value_template: "{{ is_state() }}"
#    optimistic: true
    lock:
      service: lock.lock
      target:
       entity_id: lock.nuki_porta_ingresso_lock
    unlock:
      service: lock.open
      target:
       entity_id: lock.nuki_porta_ingresso_lock

and then to to expose this new lock in Homekit…

Did you ever manage to expose Nuki Unlatch to the Homekit Unlock function?

yes, it works fine!

Thanks!

My problem is, not really knowing where to begin.

Background:
I got fed up of Homekit to Nuki timeouts since Homekit 16.2 (and 16.4.1).
Nuki is working on FW updates to fix this, but they still result in Homekit connecting to NUKI via Bluetooth. I have 4 Homekit hubs, and two of them are out of Nuki Bluetooth range. Since 16.2 we can’t disable hub function on AppleTVs or Homepods.

Fix:
So, I have setup Nuki 3.0 Pro in HASS, using MQTT (which uses WIFI). Auto discovery did all the work. The Niki lock is visible in HASS and has two nice cards (one for status, one for lock operations, toggle locked/unlock status, unlatch and the lock and go functions. I exposed the Nuki Lock to Homekit. It works immediately (absolutely no timeouts or delay), but it only unlocks and locks the door. It can’t unlatch/open the door lock.

Problem:
As my door has no handle on the outside, I want Homekit unlock function to actually perform unlatch(open) on the NUKI (like the direct NUKI to Homekit connection does). So I can open the door and walk inside.

Question:
So, is what you have done, possible with my MQTT setup, keeping the nice cards with all the functionality?

Basically, I just want to change the homekit exposure to unlatch instead of unlock. My problem is figuring out how, as autodiscover hides all config, so I can’t copy and modify it where I want. Starting with a blank canvas is quite a step…

Any help in the right direction would be really appreciated. I’ll even document it for the next person that runs into this problem.

you can use my button in first post to unlatch it in homekit!!!

Hi,
You tried to create my template of button and expose it do HomeKit?

It do only unlatch action and then return to default position.

If you preferred you can create a new template of switch with lock/unlatch action.

It’s clear?

You solved it?

Thanks for replying!

But no, it’s not clear to me. Here’s my setup:

This is the MQTT Nuki autodiscovery generated template:

These are the actions for the MQTT Nuki:

This all works. Fantastic fast connection between HASS and NUKI 3.0 Lock.

I expose this lock to homekit:

This is also super fast and much more reliable than direct Nuki <> Homekit via Bluetooth.

But I would simply like the homekit exposure to map the unlatch/open function to Homekit unlock function (or else I can’t enter my home).

Can somebody explain how to do that (with MQTT connected NUKI 3.0 Pro)?

THANKS!

In HomeKit you don’t see unlatch button?

Nope,

This is the lock in Homekit (named Backdoor, for testing purposes):

As you see the status is unlocked. If I slide it down, it locks. If I slide it up, it unlocks, but does not unlatch. And that is the behaviour I want to change. Mor about that under the next shot:

Settings (scrolled down)

As you see, it’s exposed by Homeassistant 2023.4.6 (It’s not the direct NUKI > Homekit setup).

I’m starting to think that it’s not possible to change the Homekit behaviour for MQTT added NUKI 3.0 Pro locks, due to the way the lock is autodiscovered with MQTT and what functions are handed out to Homeassistant. I see a toggle function for lock/unlock (so don’t think it’s possible to call a lock door function). I see an open door function, but I’m not sure what the exact function name is.

The problem lies in small details, names, IDs, etc.

Ok, don’t worry

Create new button described in first post and then expose it to HomeKit! So in this way you have a new button only for unlatch action!!!

Let me know

P.S.: you are already able to unlatch it using NUKI APP?

Hi, Thanks for your patience,

Yes, I am able to open and unlock the lock with NUKI APP.

The problem is that you are (most likely) using the original NUKI Homeassistant integration OR the extended HACS Nuki integration) and I’m using the MQTT integration.

Which integration are you using?

When you list your entities (Settings > device & Services > (select entities at top) , do you see your device (SoloApriPortaIngresso) and can you lock / unlock it there (I think this requires the status to work).

This is what I see: image

Using this code in configuration.yaml:

lock:
  - platform: template
    name: NUKI_OFFICE_HKtemplate
    value_template: "{{ is_state() }}"
    lock:
      service: lock.lock
      target:       entity_id: lock.nuki_office_lock
    unlock:
      service: lock.open
      target:
       entity_id: lock.nuki_office_lock

Hi,
for now I’m using official integration (NUKIWEB); but I’m planning to migrate to MQTT native in 3.6 firmware of NUKI.

you can’t create template of new button?

I can create the template, even see the template listed under entities. But it does nothing.

I have used your template for NUKI 2.0 lock (via Bridge) using the extended HACS NUKI integration. I selected the correct entity ID (see above). I exposed it to Homekit. Nothing happens when sliding the homekid slider, and the status is unknown. I CAN make a button that opens the lock (but this does not help homekit issue):

show_name: true
show_icon: true
type: button
tap_action:
  action: call-service
  service: lock.open
  target:
    device_id: c5c86fbe9c61fa58aa8149f8xxxxxxxx
  data: {}
entity: lock.nuki_office_lock
name: OPEN Door
icon_height: 30px

Your tempolate does work with some modifications, when I use it on another Homeassistant OS installation, whith a NUKI 3.0 Pro lock, using the MQTT integration (although I still have to fix the status):

lock:
  - platform: template
    name: Front Door HK
    unique_id: 3154XXXX_lock
    value_template: "{{ is_state('binary_sensor.front_door_door_sensor','off') }}"
    lock:
      service: lock.lock
      target:
       entity_id: lock.front_door
    unlock:
      service: button.press
      target:
       entity_id:  button.front_door_unlatch

The key was adding the unique_id (can be found in mqtt debug). Maybe in stead of requesting the service button.press, requesting lock.open to entity_id lock.front_door would work too.

But I can’t figure out why the template does not work for the Nuki 2.0 via HACS extended integration, that does much more than default HASS integration.

in my modest opinion, the problem is the use of lock entity in homekit…it don’ use unlatch feature…

please you ha to creae a new button template…not a lock entity…