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

Hi, Thanks for the hard work and useful integration, i am newbie at HA hope in the future make my own contribution. I am using the Nuki integration to trigger an automation, in concrete i am using sensor door open state going from ‘on’ to ‘off’ it works great but sometimes i don’t receive in the HA sensor the information from nuki. In the image you can see the sensor historial and bellow the Nuki historial of door activity, sensor in home assistant cached correctly door open at 16:03 but missed door open at 14:34…
Tus i am using it as a trigger for automation i need this to be reliable, if not i will need to install other door sensor to trigger it insted of the nuki one. Any ideas?
Thank you for your help
Captura de Pantalla 2022-08-30 a las 16.41.31

Just after i wrote this message, i did solve it and it works now.

thanks

You must make sure that callbacks work, you can’t rely on polling, that is why I made the integration in the first place: I needed reliable and quick lock/door updates. So make sure callbacks (local communication from the bridge to HA) are working correctly.

Ok, thank you Alessandro, will try to investigate the callbacks (not sure where to start… ) or install a normal door sensor. Thanks !!

If the problem is related to the callbacks, you will see a delay in ALL status updates, not only the door sensor.

If it’s ONLY the door sensor, probably the problem relies on the fact that you need to configure it better with Nuki. Recalibrate the magnetic sensor detection using the Nuki app, there’s a specific procedure to do that.

Regarding the callbacks, there’s a sensor on the integration that tells you if they’re correctly configured.

Thanks , i am not able to find bridge sensors, so something i did wrong with installation… wil review it…

binary_sensor.nuki_bridge_bridge_callback_set
binary_sensor.nuki_bridge_connected
sensor.nuki_bridge_firmware_version
sensor.nuki_bridge_wifi_firmware_version

read carefully the instructions on the github repo.

what lock do you have? do you have a bridge?

Yes, i have Smart Lock 2.0 with a bridge, reading carefully i think i only set up web API i will need to set up Bridge Api from the Nuki App … that make sense due i am not able to find bridge sensors to check callback, many thanks for your help, I will have to wait until i can go physically to the apartment, actually i am using nabucasa from home…

and that is why your status updates are unreliable. why didn’t you configure the bridge? I mean, the config asks you for bridge ip and token, so you consciously decided not to condigure those? :slight_smile:

I can’t remember exactly, i think due i had no many time at the place (it’s a rental place) and i configured only web Api thinking it will be enough as a one of the supported mode…
As soon as i can will try full set up !
Maybe i need to deinstall integration and install it again right? i don’t see how to update or reconfigure it.

Many thanks for your help and patience

yes, remove it and readd it.

Ok thanks, I have another nuki but in this case Nuki lock 3.0 Pro, so in this case as per the documentation only the web API will work )no bridge there)

  • Cloud Web API, without Nuki bridge (Nuki Lock 3.0 Pro). Polling only
    so it’s not so reliable as is with the bridge right? in this case maybe better to use a door sensor for automation… well, another one due i have the nuki door sensor there not the iman like in the Nuki 2.0 lock
    Nuki Door Sensor - Nuki
    Thks

So when I asked if you had the bridge, the answer should’ve been NO. :slight_smile:

The web api can never be reliable and quick like the bridge api, because the bridge is on the LAN with HA.

For me, Nuki Lock without the bridge is not a good solution, but I’m a local-only guy for automation, none of my important home automation stuff relies on the cloud.

Thanks Alessandro ! :slightly_smiling_face:

1 Like

No problem, let me know when it works. :slight_smile:

Hi, I reply on your answer because I have the same issue.

File "/config/custom_components/nuki_ng/sensor.py", line 94, in native_value
return self.data.get("bridge_info", {}).get("rssi")
AttributeError: 'NoneType' object has no attribute 'get'

I fully reinstalled the integration and my bridge has a very recent firmware 2.14.

curl http://10.0.0.42:8080/info?token=xxx | Select -ExpandProperty Content
{"bridgeType": 1, "ids": {"hardwareId": xxx, "serverId": xxx}, "versions": {"firmwareVersion": "2.14.0", "wifiFirmwareVersion": "2.3.0"}, "uptime": 35, "currentTime": "2022-09-03T05:07:02+00:00", "wlanConnected": true, "serverConnected": true, "scanResults": []}
curl http://10.0.0.42:8080/list?token=xxx | Select -ExpandProperty Content
[{"deviceType": 4, "nukiId": xxx, "name": "Porte Cuisine"}]

I don’t know why the scanResults array is empty.

So the missing rssi property is not the root cause. It is still present in the latest API version used by this 2.14 firmware:
https://developer.nuki.io/page/nuki-bridge-http-api-1-13/4/#heading--info

Edit: I am just stupid. It is empty because my lock is not powered on currently, so no scan results and no rssi property in the child objects… However, I think this error could be better handled in the integration code.

the problem in general is the API, it’s not a very well designed one. The bridge API should provide clear status of the devices, the integration can only follow what the API provides. How could the integration know what the problem is in your case? It could be guessed, and that’s not how sw should be written.

My point was more about using the logger of the integration to fail early with a clearer error message.

Since the scan_results array is empty, maybe it could be useful to check this there or there, log the error with a clear error message (e.g., “Unable to retrieve device’s properties. Check that your device is connected to the Hub.”) and return or continue if that’s not blocking. Or maybe even silently skip the retrieval of the “RSSI” attribute or set it unavailable.

These are just ideas to prevent a code crash that could be avoided.

Raise an issue on GH repo. @kvj will answer regarding error checking. Or contribute via PR.

1 Like

Hi, get it wotking in one apartment, only had an issue with the integration wthe bridge could not comunicate but i replaced the ip for the nuki with one (something nut-***) ant it worked… The problem is that now i am trying other set up in other apartment and i have the same peoblem when trying to start the integration, bridge error comunication appears, but i can’t remember the ip or name of the host for the bridge tht i used and worked …!! any help on this name? Thanks