rsg98 / homebridge-gpio-wpi2

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

Adding more pins??? #17

Open kskenyon opened 7 years ago

kskenyon commented 7 years ago

I tried adding more pins by editing config.json in homebridge but I get an error starting up homebridge. I can't figure out why. Any ideas? It works fine without the added pins in config.json

I'm trying to control the LEDs on an Explore Hat from Pimoroni

Apr 8 13:54:49 raspberrypi3 homebridge[3513]: /usr/local/lib/node_modules/homebridge-gpio-wpi2/index.js:72 Apr 8 13:54:49 raspberrypi3 homebridge[3513]: var exportState = sysfs(accessory.context.pin); Apr 8 13:54:49 raspberrypi3 homebridge[3513]: ^ Apr 8 13:54:49 raspberrypi3 homebridge[3513]: TypeError: Cannot read property 'pin' of undefined Apr 8 13:54:49 raspberrypi3 homebridge[3513]: at WPiPlatform.configureAccessory.accessory [as configureAccessory] (/usr/local/lib/node_modules/homebridge-gpio-wpi2/index.js:72:44) Apr 8 13:54:49 raspberrypi3 homebridge[3513]: at Server._configCachedPlatformAccessories (/usr/local/lib/node_modules/homebridge/lib/server.js:342:24) Apr 8 13:54:49 raspberrypi3 homebridge[3513]: at Server.run (/usr/local/lib/node_modules/homebridge/lib/server.js:83:8) Apr 8 13:54:49 raspberrypi3 homebridge[3513]: at module.exports (/usr/local/lib/node_modules/homebridge/lib/cli.js:40:10) Apr 8 13:54:49 raspberrypi3 homebridge[3513]: at Object. (/usr/local/lib/node_modules/homebridge/bin/homebridge:17:22) Apr 8 13:54:49 raspberrypi3 homebridge[3513]: at Module._compile (module.js:435:26) Apr 8 13:54:49 raspberrypi3 homebridge[3513]: at Object.Module._extensions..js (module.js:442:10) Apr 8 13:54:49 raspberrypi3 homebridge[3513]: at Module.load (module.js:356:32) Apr 8 13:54:49 raspberrypi3 homebridge[3513]: at Function.Module._load (module.js:311:12) Apr 8 13:54:49 raspberrypi3 homebridge[3513]: at Function.Module.runMain (module.js:467:10) Apr 8 13:54:49 raspberrypi3 systemd[1]: homebridge.service: main process exited, code=exited, status=1/FAILURE Apr 8 13:54:49 raspberrypi3 systemd[1]: Unit homebridge.service entered failed state.

{ "platform": "WiringPiPlatform", "name": "Pi GPIO - WiringPi", "overrideCache": "true", "autoExport": "true", "gpiopins": [ { "name": "LED01", "pin": 4, "enabled": "true", "mode": "out", "pull": "down", "inverted": "false", "duration": 0, "polling": "true" }, { "name": "LED02", "pin": 17, "enabled": "true", "mode": "out", "pull": "down", "inverted": "false", "duration": 0, "polling": "true" }, { "name": "LED03", "pin": 27, "enabled": "true", "mode": "out", "pull": "down", "inverted": "false", "duration": 0, "polling": "true" }, { "name": "LED04", "pin": 5, "enabled": "true", "mode": "out", "pull": "down", "inverted": "false", "duration": 0, "polling": "true" } My config.json passes jsonlint.com OK. Kevin
rsg98 commented 7 years ago

Can you try clearing cachedAccessories? (As per this thread: https://github.com/rsg98/homebridge-gpio-wpi2/issues/12)

kskenyon commented 7 years ago

I figured out that I can only use GPIO2 and up for "name:" and have it work. I have four outputs working now. I'm not sure how many "name:"s I can add without experimenting. I'm not much of a javascript programmer to understand what configuration setups will work. I'll try the cache removal and see what happens. Thanks

ghost commented 7 years ago

I just figured out how to fix this problem you have to delete all the text in the file called cachedAccessories in the "/home/pi/.homebridge/accessories" there the file is. when you have entered the name you want, and then it should work. ;)