ebaauw / homebridge-nb

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

Nuki Bridge can't listen #30

Closed iPhilBln closed 3 years ago

iPhilBln commented 3 years ago

Hi, I want to establish my nuki plugin but everytime I push the button at the beginning I get the following error message:

[Nuki] error: 10.0.30.*:405**: cannot listen: EADDRNOTAVAIL

I have also tested it with no fix port but got the same result. I have also opened my configured Port into my ufw firewall and Unifi router to the IoT Network.

ebaauw commented 3 years ago

Please capture and attach a debug log file, see https://github.com/ebaauw/homebridge-hue/wiki/FAQ#homebridge.

iPhilBln commented 3 years ago

Please capture and attach a debug log file, see https://github.com/ebaauw/homebridge-hue/wiki/FAQ#homebridge.

Hmm there was no debug button in the homebridge ui but i grep the output from the terminal. Here is the output from the log which contains the nuki plugin:

[21.3.2021, 19:07:41] [Nuki] Initializing NB platform... [21.3.2021, 19:07:41] [Nuki] homebridge-nb v1.1.0, node v15.10.0, homebridge v1.3.4, homebridge-lib v5.1.0 [21.3.2021, 19:07:41] [Nuki] warning: not using recommended node v14.16.0 LTS [21.3.2021, 19:07:41] [Nuki] warning: not using recommended homebridge v1.3.3 [21.3.2021, 19:07:41] [Nuki] config.json: {"name":"Nuki","address":"10.0.30.8","latch":true,"port":40506,"platform":"NB"} [21.3.2021, 19:07:41] [Nuki] config: {"timeout":15,"name":"Nuki","address":"10.0.30.8","latch":true,"port":40506,"platform":"NB"} ... [21.3.2021, 19:07:42] [Hue] npm registry: request 1: 200 OK [21.3.2021, 19:07:42] [Hue] latest version: homebridge-hue v0.13.4 [21.3.2021, 19:07:42] [Nuki] npm registry: request 1: GET /homebridge-nb/latest [21.3.2021, 19:07:42] [Nuki] nuki server: request 1: GET /bridges [21.3.2021, 19:07:42] [Nuki] npm registry: request 1: 200 OK [21.3.2021, 19:07:42] [Nuki] latest version: homebridge-nb v1.1.0 [21.3.2021, 19:07:42] [Nuki] nuki server: request 1: 200 OK [21.3.2021, 19:07:42] [Nuki] discovery: [{"bridgeId":339392392,"ip":"10.0.30.8","port":8080,"dateUpdated":"2021-03-14T09:43:25Z"}] [21.3.2021, 19:07:42] [Nuki] Bridge_143AB788: found bridge 143AB788 at 10.0.30.8:8080 [21.3.2021, 19:07:42] [Nuki] Bridge_143AB788: press Nuki bridge button to obtain token [21.3.2021, 19:07:42] [Nuki] Bridge_143AB788: request 1: GET /auth ... [21.3.2021, 19:08:12] [Nuki] Bridge_143AB788: request 1: 200 OK [21.3.2021, 19:08:12] [Nuki] warning: Nuki bridge button not pressed [21.3.2021, 19:08:12] [Nuki] Bridge_143AB788: press Nuki bridge button to obtain token [21.3.2021, 19:08:12] [Nuki] Bridge_143AB788: request 2: GET /auth [21.3.2021, 19:08:12] [Nuki] flush cachedAccessories ... [21.3.2021, 19:08:53] [Nuki] Bridge_143AB788: request 3: 200 OK [21.3.2021, 19:08:53] [Nuki] Bridge_143AB788: request 4: GET /info [21.3.2021, 19:08:53] [Nuki] Bridge_143AB788: request 4: 200 OK [21.3.2021, 19:08:53] [Nuki] Nuki_Bridge_143AB788: create Bridge 143AB788 [21.3.2021, 19:08:53] [Nuki] Nuki_Bridge_143AB788: set Name to "Nuki_Bridge_143AB788" [21.3.2021, 19:08:53] [Nuki] Nuki_Bridge_143AB788: set Serial Number to "143AB788" [21.3.2021, 19:08:53] [Nuki] Nuki_Bridge_143AB788: set Manufacturer to "Nuki Home Solutions GmbH" [21.3.2021, 19:08:53] [Nuki] Nuki_Bridge_143AB788: set Model to "Bridge" [21.3.2021, 19:08:53] [Nuki] Nuki_Bridge_143AB788: set Firmware Revision to "2.9.3" [21.3.2021, 19:08:53] [Nuki] Nuki_Bridge_143AB788: Nuki Bridge v2.9.3 143AB788 at 10.0.30.8:8080 [21.3.2021, 19:08:53] [Nuki] Nuki_Bridge_143AB788: set Name to "Nuki_Bridge_143AB788" [21.3.2021, 19:08:53] [Nuki] Nuki_Bridge_143AB788: set Heartrate to 60 seconds [21.3.2021, 19:08:53] [Nuki] Nuki_Bridge_143AB788: set Restart to false [21.3.2021, 19:08:53] [Nuki] Nuki_Bridge_143AB788: set Log Level to 2 [21.3.2021, 19:08:53] [Nuki] Nuki_Bridge_143AB788: set Status Fault to 0 [21.3.2021, 19:08:53] [Nuki] Nuki_Bridge_143AB788: set Name to "Nuki_Bridge_143AB788" [21.3.2021, 19:08:54] [Nuki] Nuki_Bridge_143AB788: request 1: GET /info [21.3.2021, 19:08:54] [Nuki] Nuki_Bridge_143AB788: request 1: 200 OK [21.3.2021, 19:08:54] [Nuki] error: 10.0.30.8:40506: cannot listen: EADDRNOTAVAIL

Furthermore i listened to the configured port into the config.json with sudo lsof -i :40506 -r 1 but its alway empty. So homebridge does not listen or speak on the configured port i think.

And maybe its neccesary that i have configured a nuki plugin which contains a API token and a Bridge API token for the http API.

iPhilBln commented 3 years ago

I figured out that i have to change the port of my nuki bridge manual into the nuki app. There I can see the API Token is changing every time i want to pair the bridge with your plugin but the port into the nuki bridge configuration changes always to -25030 but i configured my personal port 40506. If the field is empty or doesnt match with my personal port your plugin is flooting my log with this output:

[21.3.2021, 19:41:48] [Nuki] Bridge_143AB788: request 1619: GET /auth [21.3.2021, 19:41:48] [Nuki] warning: Bridge_143AB788: request 1619: error: 10.0.30.8:80: cannot connect: ECONNREFUSED [21.3.2021, 19:41:48] [Nuki] warning: 10.0.30.8:80: cannot connect: ECONNREFUSED [21.3.2021, 19:41:48] [Nuki] Bridge_143AB788: press Nuki bridge button to obtain token [21.3.2021, 19:41:48] [Nuki] Bridge_143AB788: request 1620: GET /auth

If it matched i will get this ouput:

[21.3.2021, 19:45:20] [Nuki] npm registry: request 1: GET /homebridge-nb/latest [21.3.2021, 19:45:20] [Nuki] nuki server: request 1: GET /bridges [21.3.2021, 19:45:20] [Nuki] nuki server: request 1: 200 OK [21.3.2021, 19:45:20] [Nuki] discovery: [{"bridgeId":339392392,"ip":"10.0.30.8","port":40506,"dateUpdated":"2021-03-21T18:43:58Z"}] [21.3.2021, 19:45:20] [Nuki] Bridge_143AB788: found bridge 143AB788 at 10.0.30.8:40506 [21.3.2021, 19:45:20] [Nuki] Bridge_143AB788: press Nuki bridge button to obtain token [21.3.2021, 19:45:20] [Nuki] Bridge_143AB788: request 1: GET /auth [21.3.2021, 19:45:20] [Nuki] npm registry: request 1: 200 OK [21.3.2021, 19:45:20] [Nuki] latest version: homebridge-nb v1.1.0 ... [21.3.2021, 19:46:29] [Nuki] Bridge_143AB788: request 3: 200 OK [21.3.2021, 19:46:29] [Nuki] Bridge_143AB788: request 4: GET /info [21.3.2021, 19:46:29] [Nuki] Bridge_143AB788: request 4: 200 OK [21.3.2021, 19:46:29] [Nuki] Nuki_Bridge_143AB788: create Bridge 143AB788 [21.3.2021, 19:46:29] [Nuki] Nuki_Bridge_143AB788: set Name to "Nuki_Bridge_143AB788" [21.3.2021, 19:46:29] [Nuki] Nuki_Bridge_143AB788: set Serial Number to "143AB788" [21.3.2021, 19:46:29] [Nuki] Nuki_Bridge_143AB788: set Manufacturer to "Nuki Home Solutions GmbH" [21.3.2021, 19:46:29] [Nuki] Nuki_Bridge_143AB788: set Model to "Bridge" [21.3.2021, 19:46:29] [Nuki] Nuki_Bridge_143AB788: set Firmware Revision to "2.9.3" [21.3.2021, 19:46:29] [Nuki] Nuki_Bridge_143AB788: Nuki Bridge v2.9.3 143AB788 at 10.0.30.8:40506 [21.3.2021, 19:46:29] [Nuki] Nuki_Bridge_143AB788: set Name to "Nuki_Bridge_143AB788" [21.3.2021, 19:46:29] [Nuki] Nuki_Bridge_143AB788: set Heartrate to 60 seconds [21.3.2021, 19:46:29] [Nuki] Nuki_Bridge_143AB788: set Restart to false [21.3.2021, 19:46:29] [Nuki] Nuki_Bridge_143AB788: set Log Level to 2 [21.3.2021, 19:46:29] [Nuki] Nuki_Bridge_143AB788: set Status Fault to 0 [21.3.2021, 19:46:29] [Nuki] Nuki_Bridge_143AB788: set Name to "Nuki_Bridge_143AB788" [21.3.2021, 19:46:30] [Nuki] Nuki_Bridge_143AB788: request 1: GET /info [21.3.2021, 19:46:30] [Nuki] Nuki_Bridge_143AB788: request 1: 200 OK [21.3.2021, 19:46:30] [Nuki] error: 10.0.30.8:40506: cannot listen: EADDRNOTAVAIL

ebaauw commented 3 years ago

10.0.30.8 is the IP address of your Nuki bridge. Of course, Homebridge NB cannot create a web server to receive callback notifications using that address.

iPhilBln commented 3 years ago

Yes it is the ip Adresse of my bridge. So what does it mean?

ebaauw commented 3 years ago

See the SETTINGS form in the Homebridge UI:

Screenshot 2021-03-21 at 21 03

iPhilBln commented 3 years ago

No comment... Everything is working like a charm.