ebaauw / homebridge-nb

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

Nuki_Bridge_6D37CD90: warning: heartbeat error: TypeError: Cannot read properties of undefined (reading '0') #93

Closed Scirocco3 closed 1 year ago

Scirocco3 commented 1 year ago

Hello,

after a new Install on a new homebridge server the plugin doesn't work. it comes this message....

[28.12.2022, 23:16:34] [Nuki] Nuki_Bridge_6D37CD90: warning: heartbeat error: TypeError: Cannot read properties of undefined (reading '0') at Function.modelName (C:\Users\Plex\AppData\Roaming\npm\node_modules\homebridge-nb\lib\NbClient.js:88:21) at new SmartLock (C:\Users\Plex\AppData\Roaming\npm\node_modules\homebridge-nb\lib\NbAccessory.js:305:29) at Bridge.addSmartLock (C:\Users\Plex\AppData\Roaming\npm\node_modules\homebridge-nb\lib\NbAccessory.js:210:27) at Bridge.heartbeat (C:\Users\Plex\AppData\Roaming\npm\node_modules\homebridge-nb\lib\NbAccessory.js:240:22) at processTicksAndRejections (node:internal/process/task_queues:95:5) [

an nb discover display the correct ip

C:\Windows\system32>nb discover [ { "bridgeId": 1832373648, "dateUpdated": "2022-12-28T19:00:17Z", "ip": "192.168.1.156", "port": 8080 } ]

and it seams that it's listening on a false ip 0.0.0.0?

[Nuki] Nuki_Bridge_6D37CD90: remove stale subscription [28.12.2022, 23:15:34] [Nuki] listening on http://0.0.0.0:56909/notify [28.12.2022, 23:15:34] [Nuki] Nuki_Bridge_6D37CD90: subscribe to event notifications

ebaauw commented 1 year ago

The error happens when Homebridge NB tries to parse the firmware version of your smart lock. Could you please list the output of nb -H 192.168.1.156:8080 -Ttokenlist (substituting the token of your Nuki bridge)?

and it seams that it's listening on a false ip 0.0.0.0?

That’s tech speak for all IP addresses on all network interfaces.

Scirocco3 commented 1 year ago

Thx for the fast answer. it seams that something is wrong with the rights? But what/where? in the app, or on the door i've no problems.

C:\Windows\system32>nb -H 192.168.1.156 -T token list nb list: 192.168.1.156: request 1: GET /list nb list: warning: 192.168.1.156: request 1: error: http status 401 Unauthorized nb list: fatal: http status 401 Unauthorized

ebaauw commented 1 year ago

You need to substitute “token” with the actual token. Press the button the the bridge and run nb -H 192.168.1.156 auth to get the token. It is also reported somewhere in the Nuki app, managing the bridge.

Scirocco3 commented 1 year ago

Now i've the token. but there is no way to put this in your config. and it still doesn't work, also after restart the bridge. What must i do after that/now?

C:\Windows\system32>nb -H 192.168.1.156 auth nb auth: press button on Nuki bridge to obtain token Xv033j

ebaauw commented 1 year ago

nb -H 192.168.1.156 -T Xv033j list

Scirocco3 commented 1 year ago

C:\Windows\system32>nb -H 192.168.1.156 -T Xv033j list [ { "deviceType": 0, "name": "Eingang", "nukiId": 497786141 }, { "deviceType": 0, "firmwareVersion": "2.13.6", "lastKnownState": { "batteryChargeState": 98, "batteryCharging": false, "batteryCritical": false, "doorsensorState": 2, "doorsensorStateName": "door closed", "mode": 2, "state": 1, "stateName": "locked", "timestamp": "2022-12-30T05:00:21+00:00" }, "name": "Kellertuer", "nukiId": 438.....77 }, { "deviceType": 4, "firmwareVersion": "3.4.10", "lastKnownState": { "batteryChargeState": 100, "batteryCharging": false, "batteryCritical": false, "keypadBatteryCritical": false, "mode": 2, "state": 3, "stateName": "unlocked", "timestamp": "2022-12-30T08:28:29+00:00" }, "name": "Eingang", "nukiId": 86....677

ebaauw commented 1 year ago

Ok, so the bridge reports three smart locks, but the first one is incomplete? Was that an old model that you replaced with a new one? It looks like the bridge hasn’t completely removed it?

Does it also show up in nb -H 192.168.1.156 -T Xv033j info?

Scirocco3 commented 1 year ago

Yes this is an old one, I only have 2. However, I removed the old one in the app and it is not still present in the app or on the webadmin page.

no, it seams that there are only 2 (for me).

C:\Windows\system32>nb -H 192.168.1.156 -T Xv033j info { "bridgeType": 1, "currentTime": "2022-12-30T12:38:15+00:00", "ids": { "hardwareId": 407350162, "serverId": 1832373648 }, "scanResults": [ { "deviceType": 0, "name": "Nuki_1A1D9CB5", "nukiId": 438148277, "paired": true, "rssi": -67 }, { "deviceType": 4, "name": "Nuki_33BD1CBD", "nukiId": 868031677, "paired": true, "rssi": -64 } ], "serverConnected": true, "uptime": 97125, "versions": { "firmwareVersion": "2.14.0", "wifiFirmwareVersion": "2.3.0" }, "wlanConnected": true }

ebaauw commented 1 year ago

Weird. I would think this is a bug in the Nuki bridge, as lastKnownState is also missing. firmwareVersion is missing from the documentation, though. I would guess/hope that the entry will be removed, when you factory-reset the Nuki bridge and re-pair the locks.

I'll implement a workaround in Homebridge NB, to ignore devices without a firmwareVersion in the list response.

ebaauw commented 1 year ago

In v1.2.14.

Scirocco3 commented 1 year ago

many thx for your very fast help !!! it works. Thx agin