Closed henningdelmenhorst closed 7 years ago
You just need to set the mode
to in
{
"name" : "GPIO3",
"pin" : 22,
"enabled" : "true",
"mode" : "in",
"pull" : "down",
"inverted" : "false",
"duration" : 0
}
However - if you've previously configured this pin as an OUTput, you'll need to clear it from cachedAccessories
, to make the plugin reconfigure the services attached to the pin. This file is under your homebridge user directory (where the config file is) in the accessories
directory.
You can just delete this file and homebridge will recreate it - but it will remove all cached accessories - so might make a mess of any scenes you've set up in HomeKit, etc.
I'll have a look at making the plugin handle reconfigured pins in a better way.
thank you for the fast replay. i uninstalled home bridge and home bridge-gpio-wpi2 and now i can not install it again.
pi@raspberrypi:~ $ sudo npm install -g homebridge-gpio-wpi2 npm ERR! Linux 4.4.38-v7+ npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "install" "-g" "homebridge-gpio-wpi2" npm ERR! node v7.6.0 npm ERR! npm v4.1.2 npm ERR! file /root/.npm/homebridge-gpio-wpi2/0.2.0/package/package.json npm ERR! code EJSONPARSE
npm ERR! Failed to parse json npm ERR! No data, empty input at 1:1 npm ERR! npm ERR! ^ npm ERR! File: /root/.npm/homebridge-gpio-wpi2/0.2.0/package/package.json npm ERR! Failed to parse package.json data. npm ERR! package.json must be actual JSON, not just JavaScript. npm ERR! npm ERR! This is not a bug in npm. npm ERR! Tell the package author to fix their package.json file. JSON.parse
npm ERR! Please include the following file with any support request: npm ERR! /home/pi/npm-debug.log
what happens? is it a problem of my system or a problem by your software?
sorry, i am raspberry pi starter
It looks like the npm
cache on your system is corrupt - try running:
sudo npm -g cache clean
Then reinstall the homebridge.
Hi,
Reading GPIO doesn't work for me too.
I have been playing around one day with this plug in. Writing out all fine, even I would keep switch status to "on" after XXX ms signal was given to trigger the switch.
This example certainly doesn't work with all the cash clean up or fresh install as above. { "name" : "GPIO3", "pin" : 22, "enabled" : "true", "mode" : "in", "pull" : "down", "inverted" : "false", "duration" : 0 }
Please give one correct example json code, if it really and how it works on your own development system to read any kind of pin. Please...
Janis
Got it to read! :) Is there a setting that would allow to invert also read? Instead of putting the GPIO pin on 3.3v to give closed, to give open status?
Janis
Closing this as opened as separate issue (#14)
Hi, I started with the configuration setup, everything is fine. Next step, i will read an input Pin. With wiringpi it is working, but i am not able to read this Pin with homebridge. Can you give an example for reading a pin?
Thank you