donavanbecker / homebridge-resideo

The Homebridge Resideo plugin allows you to access your Resideo devices from HomeKit.
ISC License
37 stars 9 forks source link

TCP port 8585 was already in use by homebridge-config-ui-x preventing configuration of homebridge-resideo #788

Closed eweiman closed 11 months ago

eweiman commented 11 months ago

Describe The Bug

It would seem that the server expects port 8585 to be open to allow the resideo login server to run, another part of homebridge was already using this port.

To Reproduce

Issue was present from the moment it was installed.

Expected behavior

If the port is in use there should be an alternate fallback port, or at the very least an indication as to the problem in the UI

Relevant log output

[8/18/2023, 1:10:44 PM] [Homebridge UI] [homebridge-resideo] Incoming Request: Start Resideo Login Server
[8/18/2023, 1:10:44 PM] [Homebridge UI] [homebridge-resideo] node:events:490
      throw er; // Unhandled 'error' event
      ^

Error: listen EADDRINUSE: address already in use :::8585
    at Server.setupListenHandle [as _listen2] (node:net:1868:16)
    at listenInCluster (node:net:1916:12)
    at Server.listen (node:net:2004:7)
    at Object.Start Resideo Login Server (/usr/local/lib/node_modules/homebridge-resideo/homebridge-ui/server.js:85:21)
    at PluginUiServer.processRequest (/usr/local/lib/node_modules/homebridge-resideo/node_modules/@homebridge/plugin-ui-utils/dist/server.js:75:63)
    at process.<anonymous> (/usr/local/lib/node_modules/homebridge-resideo/node_modules/@homebridge/plugin-ui-utils/dist/server.js:44:26)
    at process.emit (node:events:512:28)
    at emit (node:internal/child_process:944:14)
    at process.processTicksAndRejections (node:internal/process/task_queues:83:21)
Emitted 'error' event on Server instance at:
    at emitErrorNT (node:net:1895:8)
    at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {
  code: 'EADDRINUSE',
  errno: -48,
  syscall: 'listen',
  address: '::',
  port: 8585
}

Node.js v20.4.0

Note this also happened when I was using Node.js v18.16.1 so I'd say that variable is non applicable.

Config for homebridge-resideo

As this happens before you can configure this plugin it doesn't really matter.

I was able to work around this by modifying the following files to change the reference port to 8586 (which was unused on my machine).

/usr/local/lib/node_modules/homebridge-resideo/homebridge-ui/public/index.html
/usr/local/lib/node_modules/homebridge-resideo/homebridge-ui/server.js

However, in the end, while I was then able to complete the configuration now and login to Resideo unfortunately my TCC thermostat (which is accessible in Resideo Home app) isn't allowed to be controlled by third parties and therefore I can't add this.

Screenshots

This is what the freshly installed page looked like, the portion to actually configure it would not come up because the auth server couldn't start because the port was in-use.

Screen Shot 2023-08-18 at 11 24 17 PM

This was just the sad moment when after all this I couldn't even use it :( Screen Shot 2023-08-18 at 11 28 48 PM

Device & Model

TCC-RedLink Gateway THX9421R5021WW

Node.js Version

v20.4.0

NPM Version

v9.7.2

Homebridge Version

v1.6.1

Homebridge Resideo Plugin Version

Tested v1.0 through v1.3.1-beta.3

Homebridge Config UI X Plugin Version

v4.50.4

Operating System

FreeBSD 13.1

donavanbecker commented 11 months ago

Homebridge UI uses 8581 so unless you changed that? This port should work fine.

eweiman commented 11 months ago

Well I don't recall changing the port number to 8585 on the homebridge-UI but I suppose it is certainly possible that I did. I had deployed homebridge a while ago probably using https://github.com/homebridge/homebridge-config-ui-x/wiki/Manual-Configuration ... as i'm doing this in FreeBSD, those configs just called out port 8080, which is in use on my machine, I randomly picked 8585 then it would seem and that happened to collide with this. In the end I suppose it is all good and this is more in the end probably feature request to have an alternate port option or at least an error in the UI. Thanks for your time.

donavanbecker commented 11 months ago

@eweiman If someone wants to open a PR to support that, I will except it.