minamoanes / homebridge-homekit-control

Control native Apple HomeKit accessories via Homebridge
Apache License 2.0
48 stars 2 forks source link

Error during install, and homekitPair (Bluetooth) #8

Open Feilner opened 1 year ago

Feilner commented 1 year ago

I tried to install via Homebridge UI running within the onzu/homebridge docker container.

During the installation I got the following error message:

image

When try to pair a device I get the following error message:

root@homebridge:/var/lib/homebridge $ homekitPair -i eth0
/homebridge/node_modules/homebridge-homekit-control/node_modules/@abandonware/noble/lib/hci-socket/hci.js:80
  this._socket = new BluetoothHciSocket();
                 ^

Error: EAFNOSUPPORT, Address family not supported by protocol
    at new Hci (/homebridge/node_modules/homebridge-homekit-control/node_modules/@abandonware/noble/lib/hci-socket/hci.js:80:18)
    at new NobleBindings (/homebridge/node_modules/homebridge-homekit-control/node_modules/@abandonware/noble/lib/hci-socket/bindings.js:25:15)
    at module.exports (/homebridge/node_modules/homebridge-homekit-control/node_modules/@abandonware/noble/lib/resolve-bindings.js:13:12)
    at Object.<anonymous> (/homebridge/node_modules/homebridge-homekit-control/node_modules/@abandonware/noble/index.js:2:51)
    at Module._compile (node:internal/modules/cjs/loader:1218:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1272:10)
    at Module.load (node:internal/modules/cjs/loader:1081:32)
    at Module._load (node:internal/modules/cjs/loader:922:12)
    at Module.require (node:internal/modules/cjs/loader:1105:19)
    at require (node:internal/modules/cjs/helpers:103:18) {
  errno: 97,
  code: 'EAFNOSUPPORT',
  syscall: 'socket'
}

Node.js v18.13.0
minamoanes commented 1 year ago

Hey @Feilner, thank you for opening this issue! I'm currently running my Homebridge using a docker container and it's working fine. I just published 0.2.0-beta, could you please try it and share your feedback if it fixes your issue?

Feilner commented 1 year ago

Hello @minamoanes , Unfortunately the beta does not fix the issue for me.

I have the same issue Error 404 during install but another exception.

image

Feilner commented 1 year ago

Here is also a video of the install process. Sorry for the bAd quality. https://user-images.githubusercontent.com/6040107/218279608-35eb2881-b562-4633-822d-0d72b771e3fb.MOV

minamoanes commented 1 year ago

Hey @Feilner, it seems to be an environment specific issue with the package @abandonware/bluetooth-hci-socket that it can't find the right release url, and since you're using Linux-x64 you should have it's build tools installed on the host, basically you need to install "build-essential" package, to do that please follow these steps:

  1. Uninstall the Plugin homebridge-homekit-control
  2. run the following sudo apt update && sudo apt upgrade -y
  3. then run sudo apt install build-essential
  4. Then re-install plugin homebridge-homekit-control

More details about How to Install the build-essential Package here

Please let me know if that solves your issue!

Feilner commented 1 year ago

Helo @minamoanes,

I was able to install the plugin without errors after executing apt update

root@homebridge2:/var/lib/homebridge $ npm install --save homebridge-homekit-control

added 140 packages in 22s

The second issue is still remaining. And the behavior does not change when doing the upgrade. The build-essential was already installed.

root@homebridge2:/var/lib/homebridge $ homekitPair -i eth0
/homebridge/node_modules/homebridge-homekit-control/node_modules/@abandonware/bluetooth-hci-socket/lib/native.js:9
    super(...args);
    ^

Error: EAFNOSUPPORT, Address family not supported by protocol
    at new BluetoothHciSocketWrapped (/homebridge/node_modules/homebridge-homekit-control/node_modules/@abandonware/bluetooth-hci-socket/lib/native.js:9:5)
    at new Hci (/homebridge/node_modules/homebridge-homekit-control/node_modules/@abandonware/noble/lib/hci-socket/hci.js:99:18)
    at new NobleBindings (/homebridge/node_modules/homebridge-homekit-control/node_modules/@abandonware/noble/lib/hci-socket/bindings.js:27:15)
    at module.exports (/homebridge/node_modules/homebridge-homekit-control/node_modules/@abandonware/noble/lib/resolve-bindings.js:34:12)
    at module.exports (/homebridge/node_modules/homebridge-homekit-control/node_modules/@abandonware/noble/with-custom-binding.js:3:53)
    at Object.<anonymous> (/homebridge/node_modules/homebridge-homekit-control/node_modules/@abandonware/noble/index.js:1:50)
    at Module._compile (node:internal/modules/cjs/loader:1218:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1272:10)
    at Module.load (node:internal/modules/cjs/loader:1081:32)
    at Module._load (node:internal/modules/cjs/loader:922:12) {
  errno: 97,
  code: 'EAFNOSUPPORT',
  syscall: 'socket'
}

It seems that the problem is that I have no Bluetooth.

I have modified the following file localy: nano /homebridge/node_modules/homebridge-homekit-control/node_modules/@abandonware/bluetooth-hci-socket/lib/native.js


const events = require('events');
const {BluetoothHciSocket} = require (`../build/Release/bluetooth_hci_socket.node`);

inherits(BluetoothHciSocket, events.EventEmitter);

class BluetoothHciSocketWrapped {
}

// extend prototype
function inherits(target, source) {
  for (var k in source.prototype) {
    target.prototype[k] = source.prototype[k];
  }
}

module.exports = BluetoothHciSocketWrapped;

With success. Now it discovers my LAN based Homekit elements. (I have not jet tried to pair them)

Is it possible to disable the Bluetooth functionality by config?

tobiasbueschel commented 1 year ago

I'm having the same issue as @Feilner using a Raspberry Pi 3!

ryanmaule commented 11 months ago

Having the same issue here as well. I also don't have bluetooth.

I solved the issue using @Feilner's solution above, however ran into issue #3

bwp91 commented 7 months ago

I think the solution to the EAFNOSUPPORT error is this:

https://github.com/abandonware/noble/issues/43#issuecomment-1319734053

?

Smack518 commented 3 months ago

Hey @Feilner, it seems to be an environment specific issue with the package @abandonware/bluetooth-hci-socket that it can't find the right release url, and since you're using Linux-x64 you should have it's build tools installed on the host, basically you need to install "build-essential" package, to do that please follow these steps:

  1. Uninstall the Plugin homebridge-homekit-control
  2. run the following sudo apt update && sudo apt upgrade -y
  3. then run sudo apt install build-essential
  4. Then re-install plugin homebridge-homekit-control

More details about How to Install the build-essential Package here

Please let me know if that solves your issue!

Hi, I'm still having the same 404 issues installing the plugin on a Synology NAS, even after following the instructions above, it still fails on both installations methods based on 404 errors. Any help would be great!