Homebridge + homebridge-gpio-device

Hi there,

I have been using OSMC for years (now the latest debian stretch version) on my Raspberry PI 2 and I’m loving it. Now I want to take it a step further by also running Homebridge on my OSMC Pi. In particular, I want to power AND control a simple chain of IKEA Särdal LED lights (12 LEDs; originally powered by 2xAA batteries, but I will solder jumpers cables to Pi instead; total power requirements: 3v / 0.36w). For that I plan to use the GPIO pins of Pi - pin 18 as 3.3v power source/control (on/off) and pin GND as ground.

Up until this point I managed to successfully install everything necessary for homebridge according to the official instructions and homebridge is running properly. So now I want to install a homebridge plugin to control the GPIO pins. Updated: I successfully used this homebridge plugin: GitHub - dubocr/homebridge-gpio-device: Homebridge GPIO device expose several HomeKit accessories interacting with GPIO

Outdated: it seems that the homebridge-gpio-wpi2 should do the job. As the plugin relies on WiringPi as backend I need to install it, however I am failing to do so - when I run sudo apt-get install wiringpi on my osmc, then it starts reading the package list, etc., but fails with E: Unable to locate package wiringpi.

I would truly appreciate if anyone could please help me.

Thanks,
Reinis

Ah, wiringpi rings a bell!

Oh ok - I thought that I could install wiringpi as a package. Nevertheless, I successfully compiled and installed wiring pi using the instructions from Raspberry Pi | Wiring | Download & Install | Wiring Pi. I can now access wiringpi’s command line utility called “gpio” and can manually toggle the GPIO pin on/off - I can confirm that the IKEA LED chain powers/lights on and off properly.

But I would still like toggle the LED chain on/off via homebridge and its plugin homebridge-gpio-wpi2. When I attempt to install homebridge-gpio-wpi2 by running sudo npm install -g --unsafe-perm homebridge-gpio-wpi2 then it fails and spits out the following. I guess it wants to see the wiringpi package - I am a but confused now as I already manually compiled and installed wiringpi. I would truly appreciate some help! Thanks.

osmc@osmc:~$ sudo npm install -g --unsafe-perm homebridge-gpio-wpi2
> epoll@0.1.22 install /usr/lib/node_modules/homebridge-gpio-wpi2/node_modules/epoll
> node-gyp rebuild

make: Entering directory '/usr/lib/node_modules/homebridge-gpio-wpi2/node_modules/epoll/build'
  CXX(target) Release/obj.target/epoll/src/epoll.o
  SOLINK_MODULE(target) Release/obj.target/epoll.node
  COPY Release/epoll.node
make: Leaving directory '/usr/lib/node_modules/homebridge-gpio-wpi2/node_modules/epoll/build'

> node-wiring-pi@0.0.3 install /usr/lib/node_modules/homebridge-gpio-wpi2/node_modules/node-wiring-pi
> /bin/bash ./install.sh

dpkg-query: package 'wiringpi' is not installed and no information is available
Use dpkg --info (= dpkg-deb --info) to examine archive files,
and dpkg --contents (= dpkg-deb --contents) to list their contents.
dpkg-query: no packages found matching wiringpi
Checking for wiringpi:
Could not find wiringpi package - try 'sudo apt-get install wiringpi'
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! node-wiring-pi@0.0.3 install: `/bin/bash ./install.sh`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the node-wiring-pi@0.0.3 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2018-01-12T12_44_20_322Z-debug.log
osmc@osmc:~$

You’ll need to ask the developers of homebridge-gpio-wpi2, I’m afraid.

I tried a different plugin - GitHub - dubocr/homebridge-gpio-device: Homebridge GPIO device expose several HomeKit accessories interacting with GPIO - it worked perfectly. Moreover, I also made sure that homebridge is run by systemd to ensure it starts on boot - for that I followed these instuctions https://timleland.com/setup-homebridge-to-start-on-bootup/ (note that in /etc/systemd/system/homebridge.service the User needs to be root User=root for the plugin to work - this is noted in the plugin’s README).

To sum up - my OSMC is now running Homebridge and is powering/controlling my IKEA LED light chain. I can turn on/off the LED lights via my iPhone and even Siri.

Thanks everyone for help!