HTTP Callback unstable

Hey guys,

I created a webhook in Home Assistant as described here:

This webhook works well, I can trigger it with ‘curl -d “” http://192.168.178.4/api/webhook/nuki_opener

I registered that webhook as callback within my Nuki Bridge (current firmware). When freshly registered everything works. Someone rings my door, the Opener tells the Bridge and the Bridge uses the callback to call my webhook.

But then suddenly this stops working and when I delete and re-register that webhook it is back working. And it looks like calling any Bridge api (log, callback:list) is also enough that it gets back working…

I currently do not know what the log says if it is in “not working” mode. Will check that next time. // Edit: the log shows the POST but it is not triggered against the webhook.

{"timestamp": "2020-06-07T09:02:36+00:00", "type": "HTTP-Post", "nukiId": "myID"},

And if I execute the curl command directly afterwards, the webhook is working as excepted.

Any ideas?

Best,
Dirk

So it is definitely the case that it stops working with the callback after a time. If I manually access the bridge (i.e. by calling /log) it is back working.

@MatthiasK can you help here?

Can you check if your Bridge already updated to the latest firmware?
Anyway if you could provide Bridge-logs from after it stopped working (with timestamp where you expected the callback) that would be helpful.

Yes it has the latest firmware, also Nuki Opener and Nuki Fob has latest firmware. Any hints how to get the logs?

@MatthiasK just a ping …

with the /log command quoted above (see also https://developer.nuki.io/page/nuki-bridge-http-api-1-12/4#heading--log
Would be helpful to compare with our testings regarding long-time stability of the Bridge API / callbacks.

Hi @MatthiasK

{"timestamp": "2020-10-10T09:23:21+00:00", "type": "HTTP-Log"},
{"timestamp": "2020-10-10T09:23:19+00:00", "nukiId": "XYZ", "type": "BLE-Disconnected", "pairIndex": 0, "bleHandle": "0001"},
{"timestamp": "2020-10-10T09:23:19+00:00", "nukiId": "XYZ", "type": "BLE-Disconnect", "pairIndex": 0, "bleHandle": "0001"},
{"timestamp": "2020-10-10T09:23:19+00:00", "nukiId": "XYZ", "type": "BLE-ConnectionTimeout"},
{"timestamp": "2020-10-10T09:23:14+00:00", "nukiId": "XYZ", "type": "BLE-CommandComplete", "pairIndex": 0},
{"timestamp": "2020-10-10T09:23:14+00:00", "nukiId": "XYZ", "type": "SSE-KeyturnerResponse", "pairIndex": 0, "bytes": 245},
{"timestamp": "2020-10-10T09:23:14+00:00", "nukiId": "XYZ", "type": "BLE-SendingSSE", "pairIndex": 0, "bytes": 56},
{"timestamp": "2020-10-10T09:23:14+00:00", "nukiId": "XYZ", "type": "BLE-TurnOnNotific", "pairIndex": 0},
{"timestamp": "2020-10-10T09:23:14+00:00", "nukiId": "XYZ", "type": "BLE-Connected", "pairIndex": 0, "bleHandle": "0001"},
{"timestamp": "2020-10-10T09:23:14+00:00", "type": "BLE-Connect", "macAddr": "XYZ"},
{"timestamp": "2020-10-10T09:23:14+00:00", "nukiId": "XYZ", "type": "BLE-Connect", "pairIndex": 0},
{"timestamp": "2020-10-10T09:23:14+00:00", "nukiId": "XYZ", "type": "SSE-KeyturnerRequest", "pairIndex": 0, "bytes": 56},
{"timestamp": "2020-10-10T09:23:11+00:00", "type": "HTTP-List"},
{"timestamp": "2020-10-10T09:22:52+00:00", "nukiId": "XYZ", "type": "BLE-Disconnected", "pairIndex": 0, "bleHandle": "0001"},
{"timestamp": "2020-10-10T09:22:52+00:00", "nukiId": "XYZ", "type": "BLE-Disconnect", "pairIndex": 0, "bleHandle": "0001"},
{"timestamp": "2020-10-10T09:22:52+00:00", "nukiId": "XYZ", "type": "BLE-ConnectionTimeout"},
{"timestamp": "2020-10-10T09:22:47+00:00", "nukiId": "XYZ", "type": "BLE-CommandComplete", "pairIndex": 0},
{"timestamp": "2020-10-10T09:22:47+00:00", "nukiId": "XYZ", "type": "SSE-KeyturnerResponse", "pairIndex": 0, "bytes": 237},
{"timestamp": "2020-10-10T09:22:47+00:00", "nukiId": "XYZ", "type": "BLE-AlreadyConnected", "pairIndex": 0},
{"timestamp": "2020-10-10T09:22:47+00:00", "nukiId": "XYZ", "type": "SSE-KeyturnerRequest", "pairIndex": 0, "bytes": 56},
{"timestamp": "2020-10-10T09:22:47+00:00", "type": "SSE-KeyturnerEventResp"},
{"timestamp": "2020-10-10T09:22:47+00:00", "type": "HTTP-Post", "nukiId": "XYZ"},
{"timestamp": "2020-10-10T09:22:47+00:00", "nukiId": "XYZ", "type": "SSE-KeyturnerEventReq"},
{"timestamp": "2020-10-10T09:22:47+00:00", "nukiId": "XYZ", "type": "BLE-ReadStates", "pairIndex": 0},
{"timestamp": "2020-10-10T09:22:47+00:00", "nukiId": "XYZ", "type": "BLE-TurnOnNotific", "pairIndex": 0},
{"timestamp": "2020-10-10T09:22:47+00:00", "nukiId": "XYZ", "type": "BLE-Connected", "pairIndex": 0, "bleHandle": "0001"},
{"timestamp": "2020-10-10T09:22:47+00:00", "type": "BLE-Connect", "macAddr": "XYZ"},
{"timestamp": "2020-10-10T09:22:47+00:00", "nukiId": "XYZ", "type": "BLE-Connect", "pairIndex": 0},
{"timestamp": "2020-10-10T09:22:47+00:00", "nukiId": "XYZ", "type": "BLE-StateChanged", "pairIndex": 0},
{"timestamp": "2020-10-10T09:22:41+00:00", "type": "HTTP-List"},
{"timestamp": "2020-10-10T09:22:11+00:00", "type": "HTTP-List"},
{"timestamp": "2020-10-10T09:21:41+00:00", "type": "HTTP-List"},
{"timestamp": "2020-10-10T09:21:10+00:00", "type": "HTTP-List"},
{"timestamp": "2020-10-10T09:20:41+00:00", "type": "HTTP-Log"},
{"timestamp": "2020-10-10T09:20:40+00:00", "type": "HTTP-List"},
{"timestamp": "2020-10-10T09:20:10+00:00", "type": "HTTP-List"},
{"timestamp": "2020-10-10T09:19:40+00:00", "type": "HTTP-List"},
{"timestamp": "2020-10-10T09:19:10+00:00", "type": "HTTP-List"},
{"timestamp": "2020-10-10T09:18:40+00:00", "type": "HTTP-List"},
{"timestamp": "2020-10-10T09:18:10+00:00", "type": "HTTP-List"},
{"timestamp": "2020-10-10T09:17:40+00:00", "type": "HTTP-List"},
{"timestamp": "2020-10-10T09:17:13+00:00", "type": "HTTP-Log"},
{"timestamp": "2020-10-10T09:17:09+00:00", "type": "HTTP-List"},
{"timestamp": "2020-10-10T09:16:47+00:00", "nukiId": "XYZ", "type": "BLE-Disconnected", "pairIndex": 0, "bleHandle": "0001"},
{"timestamp": "2020-10-10T09:16:47+00:00", "nukiId": "XYZ", "type": "BLE-Disconnect", "pairIndex": 0, "bleHandle": "0001"},
{"timestamp": "2020-10-10T09:16:47+00:00", "nukiId": "XYZ", "type": "BLE-ConnectionTimeout"},
{"timestamp": "2020-10-10T09:16:42+00:00", "type": "HTTP-Post", "nukiId": "XYZ"},
{"timestamp": "2020-10-10T09:16:42+00:00", "nukiId": "XYZ", "type": "BLE-ReadStates", "pairIndex": 0},
{"timestamp": "2020-10-10T09:16:42+00:00", "nukiId": "XYZ", "type": "BLE-Retry", "pairIndex": 0, "count": 1},
{"timestamp": "2020-10-10T09:16:42+00:00", "nukiId": "XYZ", "type": "BLE-TurnOnNotific", "pairIndex": 0},
{"timestamp": "2020-10-10T09:16:42+00:00", "nukiId": "XYZ", "type": "BLE-Connected", "pairIndex": 0, "bleHandle": "0001"},
{"timestamp": "2020-10-10T09:16:42+00:00", "type": "BLE-Connect", "macAddr": "XYZ"},
{"timestamp": "2020-10-10T09:16:42+00:00", "nukiId": "XYZ", "type": "BLE-Connect", "pairIndex": 0},
{"timestamp": "2020-10-10T09:16:42+00:00", "type": "BLE-EarlyDisconnect", "nukiId": "XYZ"},
{"timestamp": "2020-10-10T09:16:42+00:00", "nukiId": "XYZ", "type": "BLE-TurnOnNotific", "pairIndex": 0},
{"timestamp": "2020-10-10T09:16:42+00:00", "nukiId": "XYZ", "type": "BLE-Connected", "pairIndex": 0, "bleHandle": "0001"},
{"timestamp": "2020-10-10T09:16:42+00:00", "type": "BLE-Connect", "macAddr": "XYZ"},
{"timestamp": "2020-10-10T09:16:42+00:00", "nukiId": "XYZ", "type": "BLE-Connect", "pairIndex": 0},
{"timestamp": "2020-10-10T09:16:42+00:00", "nukiId": "XYZ", "type": "BLE-StateChanged", "pairIndex": 0}

I ring the door, leads to first HTTP-Post at 9:16:42 that is not working. Then I used ‘curl -d “” http://192.168.178.4/api/webhook/nuki_opener’ against Home Assistant to trigger the Home Assistan service manually and again ring the door with HTTP-Post at 9:22:47 and it is back working…

But I am not sure if this a Nuki or a Home Assistant Problem… Maybe you can point me into the right direction…

@MatthiasK I definitely need support here. The webhook on Home Assistant site is stable and running. Whenever I call it via curl it works as expected. But as already said the Nuki Bridge is not triggering this webhook. This leads to the situation that Nuki is not really working. How can we proceed here?

@MatthiasK :face_with_head_bandage:

@MatthiasK :confused:

Sent you a DM.

@MatthiasK I guess I have an idea: If the server that serves the webhook is restarted it stops working. You can call the webhook via curl but Nuki Bridge is not calling it anymore. If I restart Nuki Bridge manually it is back working (and I guess it works till I restart the server that serves the webhook).
So it looks like that Nuki Bridge is opening the connection to the webhook at start and then just calls it. I guess that should be reworked to connect to the webhook, trigger it and disconnect. Can you maybe discuss that with your developer colleagues of the Nuki Bridge. I could also do a remote session with them to show the behaviour and do some more debugging…

Also not the case, worked a couple of times but then it is again broken and also restart is not helping. So sad everything.

Did you get this solved? We are starting work on a bidirectional Slack integration through a local server and this issue might affect us - would be good to know what to expect.

2 posts were split to a new topic: Restarting webhooks fails

Be careful with the interpretation of the responses. People for whom everything works do usually not post in such a forum. And there are many of them that e.g. use the Homebridge plugins - which fully rely on bridge API callbacks - and work without issues.

1 Like

I used Nuki Bridge callbacks to develop my Home Assistant integration, and it works flawlessly since many weeks. Used by other users too, no issues. It is very reliable, the only negative thing is that probably it could be quicker and it doesn’t support SSL/TLS, but I guess the bridge is not so powerful hardware-wise.

1 Like

Hey guys,

I guess I found the problem. I am using Home Assistant with HTTPS through DuckDns, thus my Home Assistant instance is only accessible by HTTPS. The Nuki Bridge is not able to access through HTTPS so I set up a NGINX on HTTP and proxy pass that to my HTTPS Home Assistant.

My configuration here was:

server {
    listen         80;

    location / {
        proxy_pass https://127.0.0.1:8123;
    }
}

With that I had the situation described in this thread. Sometimes it worked, sometimes not.

I changed my NGINX configuration as follows:

server {
    listen         80;

    location / {
        proxy_pass https://127.0.0.1:8123;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
    }
}

And I added this to my configuration.yaml on Home Assistant side:

http:
  use_x_forwarded_for: true
  trusted_proxies:
    - 127.0.0.1

And now it works. I am not really sure why but anyways - its working now. I get stable information via the callback from Nuki Bridge to my Home Assistant.

Best,
Dirk

1 Like