Nuki Smart Lock 2.0 - support all available API actions (i.e. add lock/unlock)

ah ok, I used the Nello opener till they stopped the service, and I really liked that it fired events when somebody ringed at the door, so I could notify myself for example if I have headphones on and couldn’t hear the bell. If the nuki integration would have this feature I would buy it instantly

The problem in my case is the existing doorbell setup - the Opener cannot even be wired to recognize the doorbell signal. So I cannot test this.

Nuki Opener bell ring event discussion

Documentation Bridge API

Hi,
since bridge API update last year it is possible to get the Opener bell ring event. I guess a dev could integrate in few minutes for easier nuki integration. Miss that feature too… in my understanding it is possible to register a callback url. So all we need is a webhook? as trigger in Homeassistant to fire a bell ring event???

I tried this in the meantime and it was really easy. Once you setup the callback in nuki bridge just publish a mqtt message in homeassistant and voila, perfect to use in automation as bell ring event.

Use this payload instead:
payload: ‘{{ trigger.json.ringactionState }}’
I used as topic: nuki/klingel

Only thing to do is create 2nd automation with trigger mqtt, mqtt topic nuki/klingel and True as payload

2 Likes

I would love to have this as well. Sounds really promising and awesome to connect with a video doorbell or something like that.

they are working very actively on this on GitHub. We just need to wait a bit longer.

1 Like

Hi,

i create my lock, script, sensor on my HA because with integration (need bridge on internet) my smart lock every day is offline. I have problem with my bridge(?) or smartlock(?) when is on internet. I stop internet connection bridge on router. Only LAN.

Snímka obrazovky 2021-04-08 120851

configuration.yaml

# Includes
shell_command: !include shell_commands.yaml

lock:
  - platform: template
    name: Dvere
    value_template: "{{ is_state('sensor.nuki_stav_zamku', 'locked') }}"
    lock:
      service: script.turn_on
      data:
        entity_id: script.nuki_lock
    unlock:
      service: script.turn_on
      data:
        entity_id: script.nuki_unlock

scripts.yaml

nuki_lock:
  alias: nuki-lock
  sequence:
  - data: {}
    service: shell_command.nuki_lock
nuki_unlock:
  alias: nuki-unlock
  sequence:
  - data: {}
    service: shell_command.nuki_unlock
nuki_open:
  alias: nuki-open
  sequence:
  - data: {}
    service: shell_command.nuki_open

shell_commands.yaml

  nuki_unlock: "curl -s 'IP:PORT/lockAction?nukiId=IDNUKISMARTLOCK&deviceType=0&action=1&token=TOKEN'"
  nuki_open: "curl -s 'IP:PORT/lockAction?nukiId=IDNUKISMARTLOCK&deviceType=0&action=3&token=TOKEN'"
  nuki_lock: "curl -s 'IP:PORT/lockAction?nukiId=IDNUKISMARTLOCK&deviceType=0&action=2&token=TOKEN'"

sensors.yaml

# NUKI stav zamku
  - platform: rest
    scan_interval: 13 # for constant polling to avoid draining the batteries too fast.(?)
    resource: http://IP:PORT/list?token=TOKEN # cache in bridge
    name: "NUKI stav zámku"
    value_template: "{{ value_json[0]['lastKnownState']['stateName'] }}"
    json_attributes_path: "$[0].lastKnownState"
    json_attributes:
      - batteryCritical
      - batteryChargeState
      - timestamp
      
  - platform: rest
    scan_interval: 300
    resource: http://IP:PORT/info?token=TOKEN # info devices and bridge
    name: "NUKI stav spojenia"
    value_template: "{{ value_json['scanResults'][0]['paired'] }}"
    json_attributes_path: "$.scanResults[0]"
    json_attributes:
      - rssi
      
  - platform: template
    sensors:
      nuki_stav_baterie:
        friendly_name: "NUKI stav bateriek"
        value_template: "{{ state_attr('sensor.nuki_stav_zamku', 'batteryChargeState') }}"
        unit_of_measurement: '%'
      
  - platform: template
    sensors:
      nuki_stav_rssi:
        friendly_name: "NUKI stav pripojenia"
        value_template: "{{ state_attr('sensor.nuki_stav_spojenia', 'rssi') }}"
        unit_of_measurement: 'dB'

  - platform: template
    sensors:
      last_motion_nuki_zamok:
        friendly_name: Posledná akcia
        value_template: >-
           {{ (as_timestamp(states.sensor.nuki_stav_zamku.attributes.timestamp)+11*60) | timestamp_custom("%H:%M  %d/%m") }}
           
  - platform: template
    sensors:
      nuki_stav_pripojenia:
        friendly_name: "NUKI stav siete"
        value_template: >-
          {% if is_state('sensor.nuki_stav_spojenia','False') %}
            Nepripojený
          {% elif is_state('sensor.nuki_stav_spojenia','True') %}
            Pripojený
          {% else %}
            Neznámy
          {% endif %}
        icon_template: >-
          {% if is_state('sensor.nuki_stav_spojenia','False') %}
            mdi:server-network-off
          {% elif is_state('sensor.nuki_stav_spojenia','True') %}
            mdi:server-network
          {% else %}
            mdi:wifi-strength-alert-outline
          {% endif %}

Maybe useful for someone

4 Likes

Pardon my ignorance.
I just read through the whole thread and I have one question.
Is this lock local control?
I see some posts hinting that. Or did I misunderstand something.

Yes, you configure the local bridge IP after enabling local API in bridge settings.

1 Like

Wow!
This is what I have been searching for.
I’m just a bit unsure about the door in the apartment we bought.
It looks like one of those doors you need to lift the handle to be able to lock it.

But I will remember this lock!

I read some reviews about this lock and it seems it has the same issues as Danalock.
Unlocking the door when it shouldn’t and keeping it locked when it should unlock.

But those of you who use local control with HA. What is your opinions?
Is it reliable? How does your automations work and what do they look like?

I never had any of the problems you describe?! It goes offline once in a while, but that’s all. Using it locally over Nuki bridge API.

That’s what I thought.
How does the automation look like to unlock the door as you arrive home?
Do you use bluetooth or just gps, or some mix?

I use the automatic unlock from the app, I think it works via Bluetooth. You can finetune it in the settings how you like.
I use Hass mostly to show the status and announce unlocking via Alexa (to not be surprised by someone entering the house). There is a few seconds delay of the status to hass unfortunately.
The app has a protocol of every lock/unlock/door opening which I found very useful. Never had any problems, except when I ignored the battery warning for a day and couldn’t get in anymore. this works better with the powerpack they sell now, gives you more time. Just in case, have a spare key somewhere, I would not rely on Nuki 100%, it becomes a single point of failure. 99% of the time it works eprfect.

In my experience Homeassistant and its REST API sometimes goes offline. If you install the Nuki App as a backup, that also works if HA is offline.

1 Like

Thanks. Works like charm.

No automation by HA, but we have it automatically locked by the App when my wife or me leave a defined Geofence area and unlocked when one of us steps back into the defined area.
When we’re close enough for our mobiles are being recognized by Bluetooth (~8m) it opens the door after a short delay.

Since the lock is a bit noisy I don’t want to have it locked when one of us just went out to get something from the bakery or supermarket which are just 80m away.
So far we never had any problems.

Looks good, but where do you use the door_open-Script?

I use a NFC tag. The tag is located under the doorbell cover in front of the door. I scan the tag and automation according to the lock status (locked, unlocked) triggered a notification.

Locked - to unlock? (use script.nuki_open)
Unlocked - open door / lock? (use script.nuki_open / script.nuki_lock

I use script.nuki_unlock for example, in the morning when I get up and turn on the light in the bathroom (automation with google mini play radio and read news, calendar etc.) when I wash :slight_smile:

Sorry for my English :slight_smile:

1 Like

Hi, I wondered what the +11*60 are for when fetching the timestamp:

 {{ (as_timestamp(states.sensor.nuki_stav_zamku.attributes.timestamp)+11*60) | timestamp_custom("%H:%M  %d/%m") }}

I removed it because it always showed a wrong time here.

You can delete. I have problem with difference time.

1 Like