rxseger / homebridge-bme280

BME280 temperature/humidity/pressure sensor bridge for Homebridge: https://github.com/nfarina/homebridge
MIT License
16 stars 14 forks source link

Error: BME280 Not Initalized #7

Closed theGeorg closed 6 years ago

theGeorg commented 6 years ago

Homebridge is loading and everything is running but every time the data of the sensor is polled (every minute) I get the message

[Date] [Sensor] Error: BME280 Not Initalized

Sensor is working fine using for example this script.

Any idea?

NorthernMan54 commented 6 years ago

I’m wondering if it’s this

Since bme280-sensor needs to talk directly to the I2C bus and requires access to /dev/i2c, you will typically need run Node with elevated privileges or add your user account to the i2c group: $ sudo adduser $USER i2c

On Feb 20, 2018, at 2:50 PM, theGeorg notifications@github.com wrote:

Homebridge is loading and everything is running but every time the data of the sensor is polled (every minute) I get the message

[Date] [Sensor] Error: BME280 Not Initalized

Sensor is working fine using for example this script https://www.raspberrypi-spy.co.uk/2016/07/using-bme280-i2c-temperature-pressure-sensor-in-python/.

Any idea?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/rxseger/homebridge-bme280/issues/7, or mute the thread https://github.com/notifications/unsubscribe-auth/AS5CmANLX-dGVoJ9C8m6o0Lq1MFZ10r5ks5tWyIggaJpZM4SMj7m.

theGeorg commented 6 years ago

@NorthernMan54 Thanks for the reply.

I have done $ sudo adduser $USER i2c for my pi and homebridge accounts.

How do I run Node with elevated privileges?

When I start up homebridge I get this error message:

[2018-2-21 00:47:15] [Sensor] BME280 initialization failed: { Error: Could not locate the bindings file. Tried:
→ /usr/local/lib/node_modules/homebridge-bme280/node_modules/i2c-bus/build/i2c.node
→ /usr/local/lib/node_modules/homebridge-bme280/node_modules/i2c-bus/build/Debug/i2c.node
→ /usr/local/lib/node_modules/homebridge-bme280/node_modules/i2c-bus/build/Release/i2c.node
→ /usr/local/lib/node_modules/homebridge-bme280/node_modules/i2c-bus/out/Debug/i2c.node
→ /usr/local/lib/node_modules/homebridge-bme280/node_modules/i2c-bus/Debug/i2c.node
→ /usr/local/lib/node_modules/homebridge-bme280/node_modules/i2c-bus/out/Release/i2c.node
→ /usr/local/lib/node_modules/homebridge-bme280/node_modules/i2c-bus/Release/i2c.node
→ /usr/local/lib/node_modules/homebridge-bme280/node_modules/i2c-bus/build/default/i2c.node
→ /usr/local/lib/node_modules/homebridge-bme280/node_modules/i2c-bus/compiled/9.4.0/linux/arm/i2c.node
at bindings (/usr/local/lib/node_modules/homebridge-bme280/node_modules/bindings/bindings.js:93:9)
at Object. (/usr/local/lib/node_modules/homebridge-bme280/node_modules/i2c-bus/i2c-bus.js:4:28)
at Module._compile (module.js:660:30)
at Object.Module._extensions..js (module.js:671:10)
at Module.load (module.js:573:32)
at tryModuleLoad (module.js:513:12)
at Function.Module._load (module.js:505:3)
at Module.require (module.js:604:17)
at require (internal/module.js:11:18)
at new BME280 (/usr/local/lib/node_modules/homebridge-bme280/node_modules/bme280-sensor/BME280.js:12:17)
tries:
[ '/usr/local/lib/node_modules/homebridge-bme280/node_modules/i2c-bus/build/i2c.node',
'/usr/local/lib/node_modules/homebridge-bme280/node_modules/i2c-bus/build/Debug/i2c.node',
'/usr/local/lib/node_modules/homebridge-bme280/node_modules/i2c-bus/build/Release/i2c.node',
'/usr/local/lib/node_modules/homebridge-bme280/node_modules/i2c-bus/out/Debug/i2c.node',
'/usr/local/lib/node_modules/homebridge-bme280/node_modules/i2c-bus/Debug/i2c.node',
'/usr/local/lib/node_modules/homebridge-bme280/node_modules/i2c-bus/out/Release/i2c.node',
'/usr/local/lib/node_modules/homebridge-bme280/node_modules/i2c-bus/Release/i2c.node',
'/usr/local/lib/node_modules/homebridge-bme280/node_modules/i2c-bus/build/default/i2c.node',
'/usr/local/lib/node_modules/homebridge-bme280/node_modules/i2c-bus/compiled/9.4.0/linux/arm/i2c.node' ] }

NorthernMan54 commented 6 years ago

You shouldn’t need to. In my environment I run it with normal permissions

Looking at that message, and it looks like the install had failed.

Try this

1) Remove homebridge-bme280

sudo rm -rf /usr/local/lib/node_modules/homebridge-bme280

2) Reinstall homebridge-bme280, I presume you used the version from Instructables

sudo su sudo npm install -g https://github.com/NorthernMan54/homebridge-bme280

Try that and if you get an error from the install please share.

On Feb 20, 2018, at 6:59 PM, theGeorg notifications@github.com wrote:

@NorthernMan54 https://github.com/northernman54 Thanks for the quick reply.

I have done $ sudo adduser $USER i2c for my pi and homebridge accounts.

How do I run Node with elevated privileges?

When I start up homebridge I get this error message:

[2018-2-21 00:47:15] [Sensor] BME280 initialization failed: { Error: Could not locate the bindings file. Tried: → /usr/local/lib/node_modules/homebridge-bme280/node_modules/i2c-bus/build/i2c.node → /usr/local/lib/node_modules/homebridge-bme280/node_modules/i2c-bus/build/Debug/i2c.node → /usr/local/lib/node_modules/homebridge-bme280/node_modules/i2c-bus/build/Release/i2c.node → /usr/local/lib/node_modules/homebridge-bme280/node_modules/i2c-bus/out/Debug/i2c.node → /usr/local/lib/node_modules/homebridge-bme280/node_modules/i2c-bus/Debug/i2c.node → /usr/local/lib/node_modules/homebridge-bme280/node_modules/i2c-bus/out/Release/i2c.node → /usr/local/lib/node_modules/homebridge-bme280/node_modules/i2c-bus/Release/i2c.node → /usr/local/lib/node_modules/homebridge-bme280/node_modules/i2c-bus/build/default/i2c.node → /usr/local/lib/node_modules/homebridge-bme280/node_modules/i2c-bus/compiled/9.4.0/linux/arm/i2c.node at bindings (/usr/local/lib/node_modules/homebridge-bme280/node_modules/bindings/bindings.js:93:9) at Object. (/usr/local/lib/node_modules/homebridge-bme280/node_modules/i2c-bus/i2c-bus.js:4:28) at Module._compile (module.js:660:30) at Object.Module._extensions..js (module.js:671:10) at Module.load (module.js:573:32) at tryModuleLoad (module.js:513:12) at Function.Module._load (module.js:505:3) at Module.require (module.js:604:17) at require (internal/module.js:11:18) at new BME280 (/usr/local/lib/node_modules/homebridge-bme280/node_modules/bme280-sensor/BME280.js:12:17) tries: [ '/usr/local/lib/node_modules/homebridge-bme280/node_modules/i2c-bus/build/i2c.node', '/usr/local/lib/node_modules/homebridge-bme280/node_modules/i2c-bus/build/Debug/i2c.node', '/usr/local/lib/node_modules/homebridge-bme280/node_modules/i2c-bus/build/Release/i2c.node', '/usr/local/lib/node_modules/homebridge-bme280/node_modules/i2c-bus/out/Debug/i2c.node', '/usr/local/lib/node_modules/homebridge-bme280/node_modules/i2c-bus/Debug/i2c.node', '/usr/local/lib/node_modules/homebridge-bme280/node_modules/i2c-bus/out/Release/i2c.node', '/usr/local/lib/node_modules/homebridge-bme280/node_modules/i2c-bus/Release/i2c.node', '/usr/local/lib/node_modules/homebridge-bme280/node_modules/i2c-bus/build/default/i2c.node', '/usr/local/lib/node_modules/homebridge-bme280/node_modules/i2c-bus/compiled/9.4.0/linux/arm/i2c.node' ] }

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/rxseger/homebridge-bme280/issues/7#issuecomment-367164387, or mute the thread https://github.com/notifications/unsubscribe-auth/AS5CmOPSAG190nv4AwXFXyXB0D5lUgc7ks5tW1xlgaJpZM4SMj7m.

theGeorg commented 6 years ago

My output:

pi@raspberrypi:~ $ sudo rm -rf  /usr/local/lib/node_modules/homebridge-bme280
pi@raspberrypi:~ $ sudo su
root@raspberrypi:/home/pi# sudo npm install -g https://github.com/NorthernMan54/homebridge-bme280

> i2c-bus@1.2.5 install /usr/local/lib/node_modules/homebridge-bme280/node_modules/i2c-bus
> node-gyp rebuild

gyp WARN EACCES user "root" does not have permission to access the dev dir "/root/.node-gyp/9.4.0"
gyp WARN EACCES attempting to reinstall using temporary dev dir "/usr/local/lib/node_modules/homebridge-bme280/node_modules/i2c-bus/.node-gyp"
gyp WARN EACCES user "root" does not have permission to access the dev dir "/usr/local/lib/node_modules/homebridge-bme280/node_modules/i2c-bus/.node-gyp/9.4.0"
gyp WARN EACCES attempting to reinstall using temporary dev dir "/usr/local/lib/node_modules/homebridge-bme280/node_modules/i2c-bus/.node-gyp"

....(repeating those last lines as long as I stop it. )

NorthernMan54 commented 6 years ago

Okay, you must be on the recent version of npm/nodejs

Try this

sudo rm -rf /usr/local/lib/node_modules/homebridge-bme280

sudo su sudo npm install -g —unsafe-perm https://github.com/NorthernMan54/homebridge-bme280 https://github.com/NorthernMan54/homebridge-bme280

On Feb 20, 2018, at 7:19 PM, theGeorg notifications@github.com wrote:

My output:

pi@raspberrypi:~ $ sudo rm -rf /usr/local/lib/node_modules/homebridge-bme280 pi@raspberrypi:~ $ sudo su root@raspberrypi:/home/pi# sudo npm install -g https://github.com/NorthernMan54/homebridge-bme280 https://github.com/NorthernMan54/homebridge-bme280 i2c-bus@1.2.5 install /usr/local/lib/node_modules/homebridge-bme280/node_modules/i2c-bus node-gyp rebuild

gyp WARN EACCES user "root" does not have permission to access the dev dir "/root/.node-gyp/9.4.0" gyp WARN EACCES attempting to reinstall using temporary dev dir "/usr/local/lib/node_modules/homebridge-bme280/node_modules/i2c-bus/.node-gyp" gyp WARN EACCES user "root" does not have permission to access the dev dir "/usr/local/lib/node_modules/homebridge-bme280/node_modules/i2c-bus/.node-gyp/9.4.0" gyp WARN EACCES attempting to reinstall using temporary dev dir "/usr/local/lib/node_modules/homebridge-bme280/node_modules/i2c-bus/.node-gyp"

....(repeating those last lines as long as I stop it. )

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/rxseger/homebridge-bme280/issues/7#issuecomment-367168709, or mute the thread https://github.com/notifications/unsubscribe-auth/AS5CmIsSLo3oL6I6Qov3Mnz_rLyFmIbiks5tW2ECgaJpZM4SMj7m.

theGeorg commented 6 years ago

Yes. Thank you very much! Now it is working.

NorthernMan54 commented 6 years ago

Awesome

On Feb 20, 2018, at 7:34 PM, theGeorg notifications@github.com wrote:

Yes. Thank you very much! Now it is working.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/rxseger/homebridge-bme280/issues/7#issuecomment-367171771, or mute the thread https://github.com/notifications/unsubscribe-auth/AS5CmI8efAHwjgpheElqkK2KHLLwR4eEks5tW2SIgaJpZM4SMj7m.

jos149 commented 3 years ago

Running into a similar issue! I am installing plugins in homebridge-ui in the browser. Does this mean I should remove the plugin there and install it again over the terminal with root privileges?