grzegorz914 / homebridge-xbox-tv

Homebridge plugin for Microsoft Game Console, publish as independent external platform accessory.
MIT License
166 stars 15 forks source link

:bug: "address collision" error with two Xboxes #124

Closed chris-araman closed 2 years ago

chris-araman commented 2 years ago

Great work on this plug-in, @grzegorz914! Unfortunately, the 2.0.0 release seems to have broken my environment.

After updating to 2.0.0, Homebridge crashes with this error:

[12/25/2021, 12:34:58 PM] Error: Accessory Office Xbox experienced an address collision.
    at BridgeService.handlePublishExternalAccessories (/home/ubuntu/.nvm/versions/node/v16.13.1/lib/node_modules/homebridge/src/bridgeService.ts:419:15)
[12/25/2021, 12:34:59 PM] Got SIGTERM, shutting down Homebridge...

I have two Xboxes configured. I tried removing both accessories from the Home app, then restarting Homebridge, but hit the same error.

If I remove the second Xbox from my configuration, there is no error, but I can't add my second Xbox.

node 16.13.1 homebridge 1.3.8 homebridge-xbox-tv 2.0.0

grzegorz914 commented 2 years ago

Try remove homebridge cashe, remove HomeKit accessory restart HB and add it again.

chris-araman commented 2 years ago

If I rename ~/.homebridge/xboxTv, I get:

[12/26/2021, 12:38:05 PM] [XboxTv] Device: 192.168.0.92 Den Xbox, prepareInformationService error: [Error: ENOENT: no such file or directory, open '/home/ubuntu/.homebridge/xboxTv/devInfo_192168092'] {
  errno: -2,
  code: 'ENOENT',
  syscall: 'open',
  path: '/home/ubuntu/.homebridge/xboxTv/devInfo_192168092'
}
[12/26/2021, 12:38:05 PM] Error: ENOENT: no such file or directory, open '/home/ubuntu/.homebridge/xboxTv/inputs_192168092'
    at Object.openSync (node:fs:585:3)
    at Object.readFileSync (node:fs:453:35)
    at xboxTvDevice.prepareAccessory (/home/ubuntu/.nvm/versions/node/v16.13.1/lib/node_modules/homebridge-xbox-tv/index.js:1034:28)
[12/26/2021, 12:38:05 PM] [XboxTv] Device: 192.168.0.49 Office Xbox, prepareInformationService error: [Error: ENOENT: no such file or directory, open '/home/ubuntu/.homebridge/xboxTv/devInfo_192168049'] {
  errno: -2,
  code: 'ENOENT',
  syscall: 'open',
  path: '/home/ubuntu/.homebridge/xboxTv/devInfo_192168049'
}
[12/26/2021, 12:38:05 PM] Error: ENOENT: no such file or directory, open '/home/ubuntu/.homebridge/xboxTv/inputs_192168049'
    at Object.openSync (node:fs:585:3)
    at Object.readFileSync (node:fs:453:35)
    at xboxTvDevice.prepareAccessory (/home/ubuntu/.nvm/versions/node/v16.13.1/lib/node_modules/homebridge-xbox-tv/index.js:1034:28)
[12/26/2021, 12:38:05 PM] Got SIGTERM, shutting down Homebridge...
[12/26/2021, 12:38:05 PM] ERR_SERVER_CLOSED: Cannot send packets on a closed mdns server!
    at MDNSServer.assertBeforeSend (/home/ubuntu/.nvm/versions/node/v16.13.1/lib/node_modules/homebridge/node_modules/@homebridge/ciao/src/MDNSServer.ts:403:13)
    at MDNSServer.sendOnAllNetworksForService (/home/ubuntu/.nvm/versions/node/v16.13.1/lib/node_modules/homebridge/node_modules/@homebridge/ciao/src/MDNSServer.ts:302:10)
    at MDNSServer.sendQueryBroadcast (/home/ubuntu/.nvm/versions/node/v16.13.1/lib/node_modules/homebridge/node_modules/@homebridge/ciao/src/MDNSServer.ts:263:26)
    at Prober.sendProbeRequest (/home/ubuntu/.nvm/versions/node/v16.13.1/lib/node_modules/homebridge/node_modules/@homebridge/ciao/src/responder/Prober.ts:165:17)
    at listOnTimeout (node:internal/timers:557:17)
    at processTimers (node:internal/timers:500:7)

If I rename ~/.homebridge/accessories, I get:

[12/26/2021, 12:40:38 PM] Error: Accessory Office Xbox experienced an address collision.
    at BridgeService.handlePublishExternalAccessories (/home/ubuntu/.nvm/versions/node/v16.13.1/lib/node_modules/homebridge/src/bridgeService.ts:419:15)
[12/26/2021, 12:40:38 PM] Got SIGTERM, shutting down Homebridge...
grzegorz914 commented 2 years ago

You can not rename this directories.

chris-araman commented 2 years ago

I'm not sure I understand. I renamed them so that I could restore them in case your suggestion didn't work. I have dozens of accessories from various Homebridge plug-ins, so I'd prefer to avoid nuking everything and setting everything back up again.

Which specific directory are you suggesting I remove?

grzegorz914 commented 2 years ago

I don't know why You remove or rename some Homebridge folder, here are stored all data from plugins and Homebridge itself. If You not advanced user please use always config GUI.

chris-araman commented 2 years ago

So in order to continue using this plugin, I need to completely wipe all Homebridge state and set up all of my Homebridge accessories again?

grzegorz914 commented 2 years ago

I don’t know Your state right now, if your Homebridge and other plugins working correct then not needed Setup all again. If not then Yes. How to install and correct remove Homebridge cashe and correct configure, please use Homebridge Wiki. For configure this plugin please use plugin settings GUI and read readme.

chris-araman commented 2 years ago

All accessories, including both Xboxes, were working before updating to homebridge-xbox-tv 2.0.0. I'm now updated to 2.0.5. I have read the homebridge-xbox-tv README and am familiar with configuring Homebridge accessories, whether in JSON or using the UI.

I've reset all Xbox accessories using the homebridge-config-ui-x UI, restarted Homebridge, and still see this error when I have two Xboxes in my config.

[12/27/2021, 3:43:46 PM] Error: Accessory Office Xbox experienced an address collision.
    at BridgeService.handlePublishExternalAccessories (/home/ubuntu/.nvm/versions/node/v16.13.1/lib/node_modules/homebridge/src/bridgeService.ts:419:15)
[12/27/2021, 3:43:46 PM] Got SIGTERM, shutting down Homebridge...

If I keep only one Xbox in the config, there is no error. I think this demonstrates a bug in homebridge-xbox-tv. If there is additional logging I can provide from debug mode, or any other information I can provide to help you diagnose the root cause, please let me know.

grzegorz914 commented 2 years ago

please post your complete config here

chris-araman commented 2 years ago

I've verified that removing or renaming the accessories directory has the same effect a "clearing the cache" in the homebridge-config-ui-x web app. https://github.com/oznu/homebridge-config-ui-x/blob/441fa8b3df6e24dc51b7033a64441e03bd9ed988/src/modules/server/server.service.ts#L262

I've also diagnosed and proposed fixes for the issues I've reported here in #126.