rsg98 / homebridge-gpio-wpi2

Homebridge Raspberry Pi GPIO Platform (API 2) Plugin - using WiringPi as a backend
48 stars 16 forks source link

ERROR LOADING PLUGIN homebridge-gpio-wpi2: #41

Open Kepete opened 6 years ago

Kepete commented 6 years ago

I get this error when running homebridge:

screen shot 2018-01-24 at 19 23 52

This is my config file that has worked before:

screen shot 2018-01-24 at 19 24 31

Wiring Pi is installed:

screen shot 2018-01-24 at 19 25 32

Whats the problem?

lws803 commented 6 years ago

try sudo npm install -g --unsafe-perm homebridge-gpio-wpi2

I had this problem too

Kimovitzh commented 6 years ago

Also here. And running: sudo npm install -g --unsafe-perm homebridge-gpio-wpi2 didn't help.

rsg98 commented 6 years ago

Looks like the node-wiring-pi dependency is failing to build. Can you try

npm install node-wiring-Pi

...and post any errors from that? On Sun, 11 Feb 2018 at 18:32, Kimovitzh notifications@github.com wrote:

Also here. And running:

sudo npm install -g --unsafe-perm homebridge-gpio-wpi2

didn't help.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/rsg98/homebridge-gpio-wpi2/issues/41#issuecomment-364775359, or mute the thread https://github.com/notifications/unsubscribe-auth/ARe_tcPJ52-20P8fB27CpY3BteLUW6i8ks5tTzJLgaJpZM4RrpjG .

Kimovitzh commented 6 years ago

Running it as sudo, I get:

pi@raspberrypi:~ $ sudo npm install node-wiring-Pi npm ERR! code E404 npm ERR! 404 Not Found: node-wiring-Pi@latest

npm ERR! A complete log of this run can be found in: npm ERR! /root/.npm/_logs/2018-02-11T21_07_18_262Z-debug.log

Kimovitzh commented 6 years ago

Tried something else:

root@raspberrypi:/home/pi# sudo npm -g install --unsafe-perm node-wiring-pi

node-wiring-pi@0.0.4 install /usr/lib/node_modules/node-wiring-pi /bin/bash ./install.sh

Checking for wiringpi: install ok installed Building node-wiring-pi ... make: Entering directory '/usr/lib/node_modules/node-wiring-pi/build' CXX(target) Release/obj.target/nodeWiringPi/src/addon.o CXX(target) Release/obj.target/nodeWiringPi/src/wiringPi.o CXX(target) Release/obj.target/nodeWiringPi/src/softPwm.o CXX(target) Release/obj.target/nodeWiringPi/src/softTone.o CXX(target) Release/obj.target/nodeWiringPi/src/wiringPiI2C.o CXX(target) Release/obj.target/nodeWiringPi/src/wiringPiISR.o CXX(target) Release/obj.target/nodeWiringPi/src/wiringPiSPI.o CXX(target) Release/obj.target/nodeWiringPi/src/wiringSerial.o CXX(target) Release/obj.target/nodeWiringPi/src/wiringShift.o CXX(target) Release/obj.target/nodeWiringPi/src/nodeWiringPi.o SOLINK_MODULE(target) Release/obj.target/nodeWiringPi.node COPY Release/nodeWiringPi.node make: Leaving directory '/usr/lib/node_modules/node-wiring-pi/build'

Kimovitzh commented 6 years ago

Any news on this?

Kimovitzh commented 6 years ago

Tried to install it, but now I just get:

pi@raspberrypi:~ $ sudo npm install homebridge-gpio-wpi2 npm WARN saveError ENOENT: no such file or directory, open '/home/pi/package.json' npm WARN enoent ENOENT: no such file or directory, open '/home/pi/package.json' npm WARN pi No description npm WARN pi No repository field. npm WARN pi No README data npm WARN pi No license field.

rsg98 commented 6 years ago

From what I can tell, it looks more like an npm issue, than one directly related to this module. The ENOENT for package.json usually means it's trying to install a package from the local directory, instead of by name. Not sure why it would do that, unless there were some additional spaces / characters on that npm install line.

That said, it looks like homebridge-gpio-wpi2 is installed correctly (as per the last line). If homebridge still won't start (and your earlier message shows that node-wiring-pi is building OK), then it may be down to permissions on your node_modules folder.

There's some tips here: https://github.com/npm/npm/wiki/Troubleshooting - but upgrading node / npm to the latest versions, and running a cache clean - then npm install -verbose homebridge-gpio-wpi2

The combinations of sudo and -g also make it more complex from a permissions point of view, so it isn't easy! npm likes to do things in the current path by default (without the -g flag); so it can end up spraying node_modules all over the place.

Kimovitzh commented 6 years ago

After the install, homebridge-gpio-wpi2 dosen't appear under /usr/lib/node_modules. And starting homebridge results in this:

[2018-2-17 17:41:22] Loaded config.json with 0 accessories and 1 platforms. [2018-2-17 17:41:22] --- [2018-2-17 17:41:22] Loading 1 platforms... /usr/lib/node_modules/homebridge/lib/api.js:122 throw new Error("The requested platform '" + name + "' was not registered by any plugin."); ^

Error: The requested platform 'WiringPiPlatform' was not registered by any plugin. at API.platform (/usr/lib/node_modules/homebridge/lib/api.js:122:13) at Server._loadPlatforms (/usr/lib/node_modules/homebridge/lib/server.js:294:45) at Server.run (/usr/lib/node_modules/homebridge/lib/server.js:85:36) at module.exports (/usr/lib/node_modules/homebridge/lib/cli.js:40:10) at Object. (/usr/lib/node_modules/homebridge/bin/homebridge:17:22) at Module._compile (module.js:643:30) at Object.Module._extensions..js (module.js:654:10) at Module.load (module.js:556:32) at tryModuleLoad (module.js:499:12) at Function.Module._load (module.js:491:3) at Function.Module.runMain (module.js:684:10) at startup (bootstrap_node.js:187:16) at bootstrap_node.js:608:3

toshibochan commented 6 years ago

Did you install using -g? sudo bom install -g homebridge sudo npm install -g homebridge-gpio-wpi2

Kimovitzh commented 6 years ago

That did something ...

This is now the output:

pi@raspberrypi:~ $ homebridge WARNING The program 'node' uses the Apple Bonjour compatibility layer of Avahi. WARNING Please fix your application to use the native API of Avahi! WARNING For more information see http://0pointer.de/avahi-compat?s=libdns_sd&e=node WARNING The program 'node' called 'DNSServiceRegister()' which is not supported (or only supported partially) in the Apple Bonjour compatibility layer of Avahi. WARNING Please fix your application to use the native API of Avahi! WARNING For more information see http://0pointer.de/avahi-compat?s=libdns_sd&e=node&f=DNSServiceRegister [2018-2-17 20:30:26] Loaded plugin: homebridge-ds18b20 [2018-2-17 20:30:26] Registering accessory 'homebridge-temperature-ds18b20.DS18B20' [2018-2-17 20:30:26] --- [2018-2-17 20:30:26] ==================== [2018-2-17 20:30:26] ERROR LOADING PLUGIN homebridge-gpio-wpi2: [2018-2-17 20:30:26] Error: Could not locate the bindings file. Tried: → /usr/lib/node_modules/homebridge-gpio-wpi2/node_modules/node-wiring-pi/build/nodeWiringPi.node → /usr/lib/node_modules/homebridge-gpio-wpi2/node_modules/node-wiring-pi/build/Debug/nodeWiringPi.node → /usr/lib/node_modules/homebridge-gpio-wpi2/node_modules/node-wiring-pi/build/Release/nodeWiringPi.node → /usr/lib/node_modules/homebridge-gpio-wpi2/node_modules/node-wiring-pi/out/Debug/nodeWiringPi.node → /usr/lib/node_modules/homebridge-gpio-wpi2/node_modules/node-wiring-pi/Debug/nodeWiringPi.node → /usr/lib/node_modules/homebridge-gpio-wpi2/node_modules/node-wiring-pi/out/Release/nodeWiringPi.node → /usr/lib/node_modules/homebridge-gpio-wpi2/node_modules/node-wiring-pi/Release/nodeWiringPi.node → /usr/lib/node_modules/homebridge-gpio-wpi2/node_modules/node-wiring-pi/build/default/nodeWiringPi.node → /usr/lib/node_modules/homebridge-gpio-wpi2/node_modules/node-wiring-pi/compiled/8.9.4/linux/arm/nodeWiringPi.node at bindings (/usr/lib/node_modules/homebridge-gpio-wpi2/node_modules/bindings/bindings.js:88:9) at Object. (/usr/lib/node_modules/homebridge-gpio-wpi2/node_modules/node-wiring-pi/index.js:1:99) at Module._compile (module.js:643:30) at Object.Module._extensions..js (module.js:654:10) at Module.load (module.js:556:32) at tryModuleLoad (module.js:499:12) at Function.Module._load (module.js:491:3) at Module.require (module.js:587:17) at require (internal/module.js:11:18) at Object. (/usr/lib/node_modules/homebridge-gpio-wpi2/index.js:1:75) [2018-2-17 20:30:26] ==================== [2018-2-17 20:30:27] Loaded plugin: homebridge-plex [2018-2-17 20:30:27] Registering accessory 'homebridge-plex.Plex' [2018-2-17 20:30:27] --- [2018-2-17 20:30:29] Loaded plugin: homebridge-unifi-occupancy-sensor [2018-2-17 20:30:29] Registering accessory 'homebridge-unifi-occupancy-sensor.UniFi Occupancy Sensor' [2018-2-17 20:30:29] --- [2018-2-17 20:30:29] Loaded plugin: homebridge-webos3 [2018-2-17 20:30:29] Registering accessory 'homebridge-webos3.webos3' [2018-2-17 20:30:29] --- [2018-2-17 20:30:29] Loaded config.json with 0 accessories and 1 platforms. [2018-2-17 20:30:29] --- [2018-2-17 20:30:29] Loading 1 platforms... /usr/lib/node_modules/homebridge/lib/api.js:122 throw new Error("The requested platform '" + name + "' was not registered by any plugin."); ^

Error: The requested platform 'WiringPiPlatform' was not registered by any plugin. at API.platform (/usr/lib/node_modules/homebridge/lib/api.js:122:13) at Server._loadPlatforms (/usr/lib/node_modules/homebridge/lib/server.js:294:45) at Server.run (/usr/lib/node_modules/homebridge/lib/server.js:85:36) at module.exports (/usr/lib/node_modules/homebridge/lib/cli.js:40:10) at Object. (/usr/lib/node_modules/homebridge/bin/homebridge:17:22) at Module._compile (module.js:643:30) at Object.Module._extensions..js (module.js:654:10) at Module.load (module.js:556:32) at tryModuleLoad (module.js:499:12) at Function.Module._load (module.js:491:3) at Function.Module.runMain (module.js:684:10) at startup (bootstrap_node.js:187:16) at bootstrap_node.js:608:3

Kimovitzh commented 6 years ago

Also, I don't know if it has any relevance but, the ´node make-gpio-script config.json set-gpio.sh´ gives me this:

pi@raspberrypi:~ $ node make-gpio-script config.json set-gpio.sh module.js:540 throw err; ^

Error: Cannot find module '/home/pi/make-gpio-script' at Function.Module._resolveFilename (module.js:538:15) at Function.Module._load (module.js:468:25) at Function.Module.runMain (module.js:684:10) at startup (bootstrap_node.js:187:16) at bootstrap_node.js:608:3 pi@raspberrypi:~ $

Kimovitzh commented 6 years ago

I managed to get it working the third time I tried on a vanilla install.

Now, I can start the homebridge connect to it via HomeKit at switch on and off. But I dosen't actually do any thing. The homebridge view shows this:

[2018-2-18 21:29:20] [Pi GPIO (WiringPi)] Turning on pin #7 [2018-2-18 21:29:20] [Pi GPIO (WiringPi)] Turning off pin #7 [2018-2-18 21:29:21] [Pi GPIO (WiringPi)] Turning on pin #7 [2018-2-18 21:29:21] [Pi GPIO (WiringPi)] Turning off pin #7 [2018-2-18 21:29:21] [Pi GPIO (WiringPi)] Turning on pin #7 [2018-2-18 21:29:21] [Pi GPIO (WiringPi)] Turning off pin #7 [2018-2-18 21:29:21] [Pi GPIO (WiringPi)] Turning on pin #7 [2018-2-18 21:29:22] [Pi GPIO (WiringPi)] Turning off pin #7

But the diode on pin 7 dosen's do anything. I've got WiringPi installed, what am I missing?

Kepete commented 6 years ago

Hi guys, I started this issue and for now I have fixed it. Sadly I went the route of making a fresh install form my RPI3 and installed everything from the start. After this I have never had this issue again. So can't help you with fixing this issue right now.

Kepete commented 6 years ago

@Kimovitzh it seems that everything from the software side is working correctly, are your sure you have wired everything correctly? How did you connect your LED?

Kimovitzh commented 6 years ago

@Kepete

Diodes negative to negative and diodes positive to pin 7. Normally I use a darlington array, the diode is just to confirm that it's working. I had the diode turn on and off with HAP-NodeJS and I works fine, so it's not the hardware.

rsg98 commented 6 years ago

Could you confirm which physical pin you’re connecting to?

https://pinout.xyz/

Pin 7 in the config corresponds to pin 26 on the connector. Physical pin 7 would correspond to Pin 4 in the config. On Mon, 19 Feb 2018 at 10:12, Kimovitzh notifications@github.com wrote:

@Kepete https://github.com/kepete

Diodes negative to negative and diodes positive to pin 7. Normally I use a darlington array, the diode is just to confirm that it's working. I had the diode turn on and off with HAP-NodeJS and I works fine, so it's not the hardware.

— You are receiving this because you commented.

Reply to this email directly, view it on GitHub https://github.com/rsg98/homebridge-gpio-wpi2/issues/41#issuecomment-366643930, or mute the thread https://github.com/notifications/unsubscribe-auth/ARe_tcaGQO0Yux5DujQ8hh7DrB3iXQ64ks5tWUkGgaJpZM4RrpjG .

Kimovitzh commented 6 years ago

@rsg98

TY! I'm used to use the physical pinout. Using the BCM pins work!

HapCoderWei commented 6 years ago

Hi, I meet the same problem, and i can true my problem is caused by the node-wiring-pi. Below is the error info, it seemed that there has a compile error in /src/wiringPi.cc file.

Checking for wiringpi: install ok installed
Building node-wiring-pi ...
make: Entering directory '/usr/lib/node_modules/homebridge-gpio-wpi2/node_modules/node-wiring-pi/build'
  CXX(target) Release/obj.target/nodeWiringPi/src/addon.o
In file included from ../../nan/nan.h:192:0,
                 from ../src/addon.h:10,
                 from ../src/addon.cc:2:
../../nan/nan_maybe_43_inl.h: In function ‘Nan::Maybe<bool> Nan::ForceSet(v8::Local<v8::Object>, v8::Local<v8::Value>, v8::Local<v8::Value>, v8::PropertyAttribute)’:
../../nan/nan_maybe_43_inl.h:112:73: warning: ‘v8::Maybe<bool> v8::Object::ForceSet(v8::Local<v8::Context>, v8::Local<v8::Value>, v8::Local<v8::Value>, v8::PropertyAttribute)’ is deprecated (declared at /home/pi/.node-gyp/9.11.1/include/node/v8.h:3164): Use CreateDataProperty / DefineOwnProperty [-Wdeprecated-declarations]
   return obj->ForceSet(isolate->GetCurrentContext(), key, value, attribs);
                                                                         ^
  CXX(target) Release/obj.target/nodeWiringPi/src/wiringPi.o
In file included from ../../nan/nan.h:192:0,
                 from ../src/addon.h:10,
                 from ../src/wiringPi.h:5,
                 from ../src/wiringPi.cc:1:
../../nan/nan_maybe_43_inl.h: In function ‘Nan::Maybe<bool> Nan::ForceSet(v8::Local<v8::Object>, v8::Local<v8::Value>, v8::Local<v8::Value>, v8::PropertyAttribute)’:
../../nan/nan_maybe_43_inl.h:112:73: warning: ‘v8::Maybe<bool> v8::Object::ForceSet(v8::Local<v8::Context>, v8::Local<v8::Value>, v8::Local<v8::Value>, v8::PropertyAttribute)’ is deprecated (declared at /home/pi/.node-gyp/9.11.1/include/node/v8.h:3164): Use CreateDataProperty / DefineOwnProperty [-Wdeprecated-declarations]
   return obj->ForceSet(isolate->GetCurrentContext(), key, value, attribs);
                                                                         ^
../src/wiringPi.cc: In function ‘Nan::NAN_METHOD_RETURN_TYPE nodewpi::piBoardRev(Nan::NAN_METHOD_ARGS_TYPE)’:
../src/wiringPi.cc:382:13: error: ‘::piBoardRev’ has not been declared
   int res = ::piBoardRev();
             ^
../src/wiringPi.cc:382:13: note: suggested alternative:
In file included from ../src/addon.h:10:0,
                 from ../src/wiringPi.h:5,
                 from ../src/wiringPi.cc:1:
../src/wiringPi.cc:378:12: note:   ‘nodewpi::piBoardRev’
 NAN_METHOD(piBoardRev) {
            ^
../../nan/nan.h:1321:33: note: in definition of macro ‘NAN_METHOD’
     Nan::NAN_METHOD_RETURN_TYPE name(Nan::NAN_METHOD_ARGS_TYPE info)
                                 ^
nodeWiringPi.target.mk:109: recipe for target 'Release/obj.target/nodeWiringPi/src/wiringPi.o' failed
make: *** [Release/obj.target/nodeWiringPi/src/wiringPi.o] Error 1
make: Leaving directory '/usr/lib/node_modules/homebridge-gpio-wpi2/node_modules/node-wiring-pi/build'
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/usr/lib/node_modules/npm/node_modules/npm-lifecycle/node_modules/node-gyp/lib/build.js:258:23)
gyp ERR! stack     at ChildProcess.emit (events.js:180:13)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:209:12)
gyp ERR! System Linux 4.9.35-v7+
gyp ERR! command "/usr/bin/node" "/usr/lib/node_modules/npm/node_modules/npm-lifecycle/node_modules/node-gyp/bin/node-gyp.js" "configure" "build"
gyp ERR! cwd /usr/lib/node_modules/homebridge-gpio-wpi2/node_modules/node-wiring-pi
gyp ERR! node -v v9.11.1
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok

> sleep@5.1.1 install /usr/lib/node_modules/homebridge-gpio-wpi2/node_modules/sleep
> node-gyp rebuild

make: Entering directory '/usr/lib/node_modules/homebridge-gpio-wpi2/node_modules/sleep/build'
  CXX(target) Release/obj.target/node_sleep/sleep.o
In file included from ../../nan/nan.h:192:0,
                 from ../sleep.cc:2:
../../nan/nan_maybe_43_inl.h: In function ‘Nan::Maybe<bool> Nan::ForceSet(v8::Local<v8::Object>, v8::Local<v8::Value>, v8::Local<v8::Value>, v8::PropertyAttribute)’:
../../nan/nan_maybe_43_inl.h:112:73: warning: ‘v8::Maybe<bool> v8::Object::ForceSet(v8::Local<v8::Context>, v8::Local<v8::Value>, v8::Local<v8::Value>, v8::PropertyAttribute)’ is deprecated (declared at /home/pi/.node-gyp/9.11.1/include/node/v8.h:3164): Use CreateDataProperty / DefineOwnProperty [-Wdeprecated-declarations]
   return obj->ForceSet(isolate->GetCurrentContext(), key, value, attribs);
                                                                         ^
  SOLINK_MODULE(target) Release/obj.target/node_sleep.node
  COPY Release/node_sleep.node

Could you have any ideas?