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

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

@HITMIK im trying to put your code to work , but alway i have unknown , i have only changed the IP:PORT , and the TOKEN=mytoken , the rest i left like it was , but still no luck , i have the http api enabled , and im using the token the app showed there ,

can u help me figure out what is wrong ??

if i use the HA integration for NUKi , its working in can lock or unlock , but it doesnt show the bat or door open 


can someone help me out ??

We might can help if you let us see what you’ve put in sensors.yaml

Here it is

if changed a few stuff , now i get , some sensors working , but the one i wanted nothing , the bat , here is the sensors.yaml , thanks for the help

  - platform: rest
    scan_interval: 13 # for constant polling to avoid draining the batteries too fast.(?)
    resource: http://xx.xx.xx.XXX:XXXX/list?token=XXXXXXXX # cache in bridge
    name: "NUKI Porta Estado"
    value_template: "{{ value_json[0]['lastKnownState']['stateName'] }}"
    json_attributes_path: "$[0].lastKnownState"
    json_attributes:
      - batteryCritical
      - batteryChargeState
      - timestamp
      
  - platform: rest
    scan_interval: 300
    resource: http://xxx.xxx.xxx:xxxx/info?token=xxxxxxx # info devices and bridge
    name: "NUKI Porta RSS"
    value_template: "{{ value_json['scanResults'][0]['paired'] }}"
    json_attributes_path: "$.scanResults[0]"
    json_attributes:
      - rssi
      
  - platform: template
    sensors:
      nuki_porta_battery:
        friendly_name: "NUKI Porta Battery"
        value_template: "{{ state_attr('sensor.nuki_porta_estado', 'batteryChargeState') }}"
        unit_of_measurement: '%'
      
  - platform: template
    sensors:
      nuki_porta_rssi:
        friendly_name: "NUKI Porta rss"
        value_template: "{{ state_attr('sensor.nuki_porta_rss', 'rssi') }}"
        unit_of_measurement: 'dB'

  - platform: template
    sensors:
      last_motion_nuki_porta:
        friendly_name: Last Action
        value_template: >-
           {{ (as_timestamp(states.sensor.nuki_porta_estado.attributes.timestamp)+11*60) | timestamp_custom("%H:%M  %d/%m") }}
           
  - platform: template
    sensors:
      nuki_porta_net:
        friendly_name: "NUKI Network"
        value_template: >-
          {% if is_state('sensor.nuki_porta_rss','False') %}
            Not connected
          {% elif is_state('sensor.nuki_porta_rss','True') %}
            Connected
          {% else %}
            Unknown
          {% endif %}
        icon_template: >-
          {% if is_state('sensor.nuki_porta_rss','False') %}
            mdi:server-network-off
          {% elif is_state('sensor.nuki_porta_rss','True') %}
            mdi:server-network
          {% else %}
            mdi:wifi-strength-alert-outline
          {% endif %}

These dont seem to work as well , Iv only change the IP:PORT , and in the END the TOKEN , scripts dont do nothing !!!

XX.xxx.xxx.xx:xxxx/lockAction?nukiId=IDNUKISMARTLOCK&deviceType=0&action=1&token=XXXXXX’

do i need to change anything else here ??

Okay, once again without the IPs and tokens :wink:

I can’t find the errors in your definition of sensors, this works for me:

# NUKI Lock
- platform: rest
  scan_interval: 13 # for constant polling to avoid draining the batteries too fast.(?)
  resource: http://network/list?token=my_token # cache in bridge
  name: "NUKI Lockstatus"
  value_template: "{{ value_json[0]['lastKnownState']['stateName'] }}"
  json_attributes_path: "$[0].lastKnownState"
  json_attributes:
    - batteryCritical
    - batteryChargeState
    - timestamp
    - doorsensorStateName
- platform: rest
  scan_interval: 300
  resource: http://network:8081/info?token=my_token # info devices and bridge
  name: "NUKI Connection"
  value_template: "{{ value_json['scanResults'][0]['paired'] }}"
  json_attributes_path: "$.scanResults[0]"
  json_attributes:
    - rssi
- platform: template
  sensors:
    nuki_batterie:
      friendly_name: "NUKI Status Battery"
      value_template: "{{ state_attr('sensor.nuki_Lockstatus', 'batteryChargeState') }}"
      unit_of_measurement: '%'
- platform: template
  sensors:
    nuki_rssi:
      friendly_name: "NUKI Wifi Status"
      value_template: "{{ state_attr('sensor.nuki_Connection', 'rssi') }}"
      unit_of_measurement: 'dB'
- platform: template
  sensors:
    last_motion_nuki:
      friendly_name: "Last Action"
      value_template: >-
        {{ (as_timestamp(states.sensor.nuki_Lockstatus.attributes.timestamp)) | timestamp_custom("%H:%M  %d/%m") }}
- platform: template
  sensors:
    nuki_status_door:
      friendly_name: "NUKI Status Door Sensor"
      value_template: "{{ state_attr('sensor.nuki_Lockstatus', 'doorsensorStateName') }}"
- platform: template
  sensors:
    nuki_netzwerkstatus:
      friendly_name: "NUKI Status Network"
      value_template: >-
        {% if is_state('sensor.nuki_Connection','False') %}
          not connected
        {% elif is_state('sensor.nuki_Connection','True') %}
          connected
        {% else %}
          unknown
        {% endif %}
      icon_template: >-
        {% if is_state('sensor.nuki_Connection','False') %}
          mdi:server-network-off
        {% elif is_state('sensor.nuki_Connection','True') %}
          mdi:server-network
        {% else %}
          mdi:wifi-strength-alert-outline
        {% endif %}

which gives me this:
grafik

@Joerg Thanks for your help and info , dont see nothing different , but my battery info says unknown , quick question , do you have the Power Pack , or just standard Batteries ???

Thank you

Ususally I use Energizer Ultimate Lithium batteries, but at the moment standard batteries are used.
Have you removed the HA NUKI integration?