hannseman / homebridge-mi-hygrothermograph

Homebridge plugin for the Xiaomi Mi Bluetooth Temperature and Humidity Sensor
MIT License
266 stars 52 forks source link

Installing plugin in the Alpine Linux Homebridge Docker Image #135

Closed carlosanunes closed 3 years ago

carlosanunes commented 3 years ago

I am trying to install the plugin in a Alpine Linux Homebridge Docker Image.

Expected Behavior

Plugin should be installed and running.

Current Behavior

When starting homebridge the 'EAFNOSUPPORT, Address family not supported by protocol' message is shown.

Steps to Reproduce (for bugs)

Install 'bluez', 'libudev-zero', 'libudev-zero-dev' ( As Alpine does not have the same library packages as specified for Ubuntu/Debian ) Run the 'npm install -g --unsafe-perm homebridge-mi-hygrothermograph' command which although with a few warnings manages to install the plugin without errors. Start Homebridge

Versions

Homebridge Log / Command Output

 ERROR INITIALIZING PLUGIN homebridge-mi-hygrothermograph:

homebridge_1 | [2/7/2021, 7:47:37 PM] Error: EAFNOSUPPORT, Address family not supported by protocol

homebridge_1 | at new Hci (/usr/local/lib/node_modules/homebridge-mi-hygrothermograph/node_modules/@abandonware/noble/lib/hci-socket/hci.js:74:18)

homebridge_1 | at new NobleBindings (/usr/local/lib/node_modules/homebridge-mi-hygrothermograph/node_modules/@abandonware/noble/lib/hci-socket/bindings.js:25:15)

homebridge_1 | at Object.<anonymous> (/usr/local/lib/node_modules/homebridge-mi-hygrothermograph/node_modules/@abandonware/noble/lib/hci-socket/bindings.js:546:18)

homebridge_1 | at Module._compile (internal/modules/cjs/loader.js:1063:30)

homebridge_1 | at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)

homebridge_1 | at Module.load (internal/modules/cjs/loader.js:928:32)

homebridge_1 | at Function.Module._load (internal/modules/cjs/loader.js:769:14)

homebridge_1 | at Module.require (internal/modules/cjs/loader.js:952:19)

homebridge_1 | at require (internal/modules/cjs/helpers.js:88:18)

homebridge_1 | at module.exports (/usr/local/lib/node_modules/homebridge-mi-hygrothermograph/node_modules/@abandonware/noble/lib/resolve-bindings.js:13:12)
carlosanunes commented 3 years ago

Solved.

The necessary libraries for Alpine are: bluez, libudev-zero and libudev-zero-dev.

Full command list to be executed in docker:

apk add bluez apk --no-cache add libudev-zero --repository=http://dl-cdn.alpinelinux.org/alpine/edge/community apk --no-cache add libudev-zero-dev --repository=http://dl-cdn.alpinelinux.org/alpine/edge/community

setcap cap_net_raw+eip $(eval readlink -f which node) # for permissions

After this, the plugin can be installed.