hp-net / homebridge-nibe

Homebridge Plugin providing data from Nibe Uplink
MIT License
16 stars 3 forks source link

Restart loop after installing Nibe plugin #112

Closed Bartus78 closed 2 years ago

Bartus78 commented 2 years ago

Describe the bug On my working Homebridge installation (Raspberry Pi 3b) with multiple plugins installed, I have tried to install the Homebridge Nibe plugin. However, after installing and entering the login credentials, as explained in the instruction, the plugin fails to load appropriately, but instead Homebridge gives multiple errors (copied below) and enters a continuous restart loop.

To Reproduce NA

Expected behavior Start of Homebridge Nibe plugin, without errors.

Screenshots & Logfiles

[15-9-2022 17:05:19] --- [15-9-2022 17:05:19] Loaded plugin: homebridge-nibe@1.0.1 [15-9-2022 17:05:19] Registering platform 'homebridge-nibe.Nibe' [15-9-2022 17:05:19] --- ... [15-9-2022 17:05:30] AssertionError [ERR_ASSERTION]: Accessories must be created with a non-empty displayName. at new Accessory (/usr/lib/node_modules/homebridge/node_modules/hap-nodejs/src/lib/Accessory.ts:421:11) at new PlatformAccessory (/usr/lib/node_modules/homebridge/src/platformAccessory.ts:70:9) at cmdSwitchPlatform.addAccessory (/usr/lib/node_modules/homebridge-cmdswitch2/index.js:55:17) at cmdSwitchPlatform.didFinishLaunching (/usr/lib/node_modules/homebridge-cmdswitch2/index.js:36:37) at HomebridgeAPI.emit (node:events:525:35) at HomebridgeAPI.signalFinished (/usr/lib/node_modules/homebridge/src/api.ts:275:10) at Server.start (/usr/lib/node_modules/homebridge/src/server.ts:190:14) [15-9-2022 17:05:31] TypeError: The "path" argument must be of type string. Received type function ([Function (anonymous)]) at new NodeError (node:internal/errors:387:5) at validateString (node:internal/validators:121:11) at Object.join (node:path:1172:7) at LocalStorage.parseFile (/usr/lib/node_modules/homebridge-ifttt/node_modules/node-persist/src/local-storage.js:630:25) at /usr/lib/node_modules/homebridge-ifttt/node_modules/node-persist/src/local-storage.js:573:49 at FSReqCallback.oncomplete (node:fs:196:23) [15-9-2022 17:05:33] [Nibe] error from /oauth/token [15-9-2022 17:05:33] Error: Bad Request: { "error": "invalid_request" } at NibeFetcher.checkError (/usr/lib/node_modules/homebridge-nibe/dist/nibe/uplink/nibe-fetcher.js:337:28) at NibeFetcher.postTokenRequest (/usr/lib/node_modules/homebridge-nibe/dist/nibe/uplink/nibe-fetcher.js:238:24) at processTicksAndRejections (node:internal/process/task_queues:96:5) at NibeFetcher.getToken (/usr/lib/node_modules/homebridge-nibe/dist/nibe/uplink/nibe-fetcher.js:211:16) at NibeFetcher.fetch (/usr/lib/node_modules/homebridge-nibe/dist/nibe/uplink/nibe-fetcher.js:146:35)

Versions Plugin version: 1.0.1 Node version: v16.17.0 Operating system: Raspbian GNU/Linux Buster (10)

Additional context NA

hpruszyn commented 2 years ago

@Bartus78 and after last log restart happens?

Bartus78 commented 2 years ago

Yes, indeed.

Bartus78 commented 2 years ago

Oh, and the loop ends after uninstalling the Nibe plugin.

hpruszyn commented 2 years ago

Strange, all errors are caught so homebridge should not crash. However we can check few more things.

  1. In logs you also have errors from cmdswitch and iftt, do those errors also occur without nibe plugin? If not can you make a test and for short time disable them and try with nibe plugin?
  2. Can you try to manually get access token, eg. using curl or some other tools, documentation for nibe uplink is here: https://api.nibeuplink.com/docs/v1/AuthenticationExamples. Maybe it will be easier to diagnose Bad Request (http 400) that we see in logs rather than homebridge crash.
Bartus78 commented 2 years ago

Thank you for your reply.

@1: Those errors are not reported, when Nibe plugin is not installed. Also disabling the Nibe plugin doesn't stop the reboot loop, strangely enough. So I installed the IFTTT plugin, and the problem still existed. Then I moved the cmdswitch plugin to a separate bridge and then the problem ceased to exist. @2: I have made a new authentication code via the suggested method and the login then worked without problems.

So now it's solved. However, I still don't understand what happened.

hpruszyn commented 2 years ago

Uff, good to hear that it is working because I didn't have more ideas ;-)

Closing for now.