ebaauw / homebridge-nb

Homebridge plugin for Nuki Bridge
Apache License 2.0
51 stars 3 forks source link

Unable to add NUKI Bridge #115

Closed dan6003 closed 1 year ago

dan6003 commented 1 year ago

Hi,

I use the latest version of the plugin 1.4.4. When I restart the bridge and try to obtain a token pressing the NUKI Bridge button, I always get the error:

warning: Bridge_4DEB867: request 2: error: http status 401 Unauthorized

When I call the url http://MyBridgeIP:8080/callback/list?token=MyToken I see two callbacks. So one ID should still be free.

The NUKI Bridge works on a old homebridge with a depreciated plugin and I'd like to move it to a new bridge. I also tried to shutdown the old bridge while I'm trying to pair but I get the same result.

Anyone know what I'm doing wrong?

Thanks

ebaauw commented 1 year ago

When I restart the bridge and try to obtain a token pressing the NUKI Bridge button

Does Homebridge NB actually prompt you to press the button?

I always get the error: warning: Bridge_4DEB867: request 2: error: http status 401 Unauthorized

Please attach the full log.

I don't think this is the response to a request to obtain the token. I think Homebridge NB already has obtained the token, but the next request is denied. This could be because:

  1. Homebridge NB has the wrong token (do you have a new Nuki bridge, or did you factory-reset it, so it has changed tokens?) or
  2. The system clocks on the Nuki bridge and the server running Homebridge are out of sync.

For 1) delete the Nuki bridge accessory from cached accessories (using the Homebridge UI), let Homebridge NB re-discover the Nuki bridge and obtain the token.

2) can be confirmed using the nb command-line utility. If the clocks are out of sync, nb info would fail with a 401, but nb -E none info would succeed.