dubocr / homebridge-gpio-device Goto Github PK
View Code? Open in Web Editor NEWHomebridge GPIO device expose several HomeKit accessories interacting with GPIO
License: Apache License 2.0
Homebridge GPIO device expose several HomeKit accessories interacting with GPIO
License: Apache License 2.0
Hey there! I hope you are well!
I am trying to use the type : "LockMechanism" with homebridge-gpio-device but I get this error :
/usr/lib/node_modules/homebridge/lib/api.js:50
if (name.indexOf('.') == -1) {
^
TypeError: Cannot read property 'indexOf' of undefined
at API.accessory (/usr/lib/node_modules/homebridge/lib/api.js:50:11)
at Server._loadAccessories (/usr/lib/node_modules/homebridge/lib/server.js:254:42)
at Server.run (/usr/lib/node_modules/homebridge/lib/server.js:81:38)
at module.exports (/usr/lib/node_modules/homebridge/lib/cli.js:40:10)
at Object.<anonymous> (/usr/lib/node_modules/homebridge/bin/homebridge:17:22)
at Module._compile (module.js:571:32)
at Object.Module._extensions..js (module.js:580:10)
at Module.load (module.js:488:32)
at tryModuleLoad (module.js:447:12)
at Function.Module._load (module.js:439:3)
I tried homebridge as well as sudo homebridge (as required) but both get the same error.
Here's the complete CLI
pi@raspberrypi:~ $ sudo homebridge
*** WARNING *** The program 'nodejs' 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=nodejs>
*** WARNING *** The program 'nodejs' 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=nodejs&f=DNSServiceRegister>
[10/8/2017, 2:50:10 AM] Loaded plugin: homebridge-gpio-device
homebridge-gpio-device API version: 2.2
[10/8/2017, 2:50:10 AM] Registering accessory 'homebridge-gpio-device.GPIODevice'
[10/8/2017, 2:50:10 AM] ---
[10/8/2017, 2:50:10 AM] Loaded config.json with 1 accessories and 0 platforms.
[10/8/2017, 2:50:10 AM] ---
[10/8/2017, 2:50:10 AM] Loading 0 platforms...
[10/8/2017, 2:50:10 AM] Loading 1 accessories...
/usr/lib/node_modules/homebridge/lib/api.js:50
if (name.indexOf('.') == -1) {
^
TypeError: Cannot read property 'indexOf' of undefined
at API.accessory (/usr/lib/node_modules/homebridge/lib/api.js:50:11)
at Server._loadAccessories (/usr/lib/node_modules/homebridge/lib/server.js:254:42)
at Server.run (/usr/lib/node_modules/homebridge/lib/server.js:81:38)
at module.exports (/usr/lib/node_modules/homebridge/lib/cli.js:40:10)
at Object.<anonymous> (/usr/lib/node_modules/homebridge/bin/homebridge:17:22)
at Module._compile (module.js:571:32)
at Object.Module._extensions..js (module.js:580:10)
at Module.load (module.js:488:32)
at tryModuleLoad (module.js:447:12)
at Function.Module._load (module.js:439:3)
and here my config.json :
{
"bridge": {
"name": "Homebridge",
"username": "CC:22:3D:E3:CE:30",
"port": 51826,
"pin": "031-66-154",
"manufacturer": "Homebridge",
"model": "Homebridge",
"serialNumber": "0.4.20"
},
"description": "Insert description",
"accessories": [{
"accesory": "GPIODevice",
"name": "Porte de l'imeuble",
"type": "LockMechanism",
"pin": [1],
"duration": 10
}],
"platforms": []
}
Thank you for your help!
can you add a smoke sensor?
Romain! Thanks a lot for your amazing plugin!
Want to advice more functionality. Water valve with several types as HomeKit have them:
Can you please add a LockMechanism for a front gate latch:
Something like this:
{
"accesory": "GPIODevice",
"name": "Front gate",
"type": "LockMechanism",
"pin": 4
"duration": 2000
},
The ideia is to unlock the latch (i.e, set the GPIO pin to OUT 0/GND) for a duration of around 2 secs (and then reset it back to IN floating) so a person at the front gate can push the gate open during that time.
P.S.
The LockMechanism ServiceType uses LockCurrentState and LockTargetState characteristics
When the motion sensor is triggered, it's not showing in app. But when I reload app, the motion sensor triggers. And why after the motion sensor triggered, it shows that all time, even if it doesn't triggered.
request for control ceiling fan with relay connect to remote control.
I have ceiling one fan with 6 speeded 2 fan with 3 speed. I want control with HomeKit.
I see this video on YouTube https://www.youtube.com/watch?v=bFAyaKc0ChU&t=13s
hope is possible do similar with homebridge.
Hi thanks in advance for this nice work. Worked pretty well.
Is it possible for u to create another accessory type:
I mentioned about a breakage of glass sensor.
For sure it is just working as input with a HIGH signal on a GPIO if the window is intact.
If it is broken singal goes LOW and with this send a notification through apple's home app every minute for example. Best would be adjustable time
Something like that:
"accessory": "GPIODevice",
"name": "Kitchen Window",
"type": "GlassBreakageSensor",
"pin": 5,
"notificationtime": 300
Hi, after plugin update garage door don't read open sensor pin status
I have this config
"accessories": [{
"accessory": "GPIODevice",
"name": "Box",
"type": "GarageDoorOpener",
"pin": 5,
"inverted": true,
"openSensorPin": 12
},
and I have another little problem, if I reboot the system the icon show opening
Homebridge would not start with the error Unable to determine hardware version. I see: Hardware: BCM2835 expecting BCM2708 or BCM2709. Please report this to [email protected]
Followed instructions here and changed to wiringpi-node library which appears to fix it.
I'd like to be able to change the status of the pin from outside of homekit/homebridge but this plugin won't read that change. I know the wp2 plugin has a polling option, but it does not support lock type.
thanks!
my shutters are moving as long as the electricity.
not working with impulse.,
Standar up/down motor control
can you help me
Hi,
I’m new with raspberry and all this,
I want to control 2 relay as lock mechanism triggers.
I’ve installed an set up WiFi, Homebridge and your plugin, but I don’t quite get what lines of command I should type when I ssh my Pi to:
I have request if possible to do push button for trigger other devices or senes?
Thank you
With door closed if I say “siri close garage” door opens.
This is a problem if I put garage door in “goodnight” scene, goodnight try to close and (if door already closed) opens my garage.
my door garage after the opening command closes after 25 seconds, is it possible to insert a time so that in the homekit the status changes from open to closed after a settable time?
Hi is possible to have push button service?
Somethink like this (but with inverted feuture)
https://www.npmjs.com/package/homebridge-gpio-services
Thank
Hi.
Could you by any chance implement a latching relay feature?
I’ve got an normal switch for lighting, witch I would replace with one with a spring.
The switch would be connected to the raspberry, and when I push the physical switch a switch in HomeKit would turn on and vice versa.
So instead of the the state of switch is remembered by a physical switch it would be remembered in software.
This is needed for a software switch and a physical to work together.
/kimovitzh
I don't have the file /etc/systemd/system/homebridge.service
which I could update with User=root
.
So, I tried to run homebride, as root, directly in terminal with sudo homebridge
, but my iOS devices dosen't see any of my homebridge devices (which worked perfectly before).
Can you add it? with ability to choose number of pins to control gate - one or two. with open\close sensor and garage door eye sensor?
Hi,
thanks for the great plugin.
When trying out the GarageDoorOpener I find it works very well except in the cases when the opening or closing motion is interrupted manually (with hardwired switch in garage).
I believe after every setState, or stateChange there needs to be a timeout with the opening/closingDuration. If no Sensor is active (means target is not reached) the state needs to be reset to "Open"
I have played around with something like this, added after line 770, you may use the idea for the various cases. (I am not a seasoned programmer, so this may be quite crude...)
this.shiftTimeoutID = setTimeout(function(){
var closeState = this.closeSensorPin !== null ? wpi.digitalRead(this.closeSensorPin) : this.INPUT_INACTIVE;
var openState = this.openSensorPin !== null ? wpi.digitalRead(this.openSensorPin) : this.INPUT_INACTIVE;
if(openState == this.INPUT_INACTIVE && closeState == this.INPUT_INACTIVE) {
this.log("timeout while closing, reset to open");
this.targetCharac.updateValue(Characteristic.TargetDoorState.OPEN);
this.stateCharac.updateValue(Characteristic.CurrentDoorState.OPEN);
}
this.shiftTimeoutID = null;
}.bind(this), this.closingDuration);
The getState method requires a similar modification to show that the door is "Open" as long as the closed sensor is not active. I added the following if clause (program will never reach your else-clause)
else if(openState == this.INPUT_INACTIVE && closeState == this.INPUT_INACTIVE) {
callback(null, Characteristic.CurrentDoorState.OPEN);
...
thanks for great work. is for good your homebridge can do many kind of devices.
I have garage and gate. relay working okay to open and close the doors, but sensor pin not working. just show closed.
will it be?
The test for !config.pin
fails for WiringPi pin 0. I substituted !config.hasOwnProperty('pin')
and similar for pins
and this fixes.
Hello,
I would like to use MotionSensor but the sensor I am using is inverted, in other words when there is no motion it is in High state.
Is there the possibility to invert the plugin behaviour? Please advise,
Thanks,
Dan
Bonjour,
c'est encore moi du plugin homebridge Tahoma,
J'ai installé ce plugin afin de contrôler des volets Becker (la centrale domotique becker étant assez chère...). J'ai donc soudé sur des télécommandes et relié aux ports GPIO. Tout fonctionne à merveille. Enfin presque 😀
C'est dans un cabinet dentaire, et donc le personnel ouvre et ferme également les volets. Mon problème est que quand j'ai fermé le volet via homekit, et qu'un employé ouvre le volet avec sa télécommande, homekit le croit toujours fermé, du coup si je demande à siri de fermer le volet, il n'actionne pas le relai, car pour lui c'est déjà fermé.
Serait-ce vraiment trop bourrin, si à la fin de chaque commande d'ouverture ou fermeture homebridge, je mets un SetTimeout de quelques secondes, afin de remettre le currentState à 50% ?
Ou vois-tu une autre solution?
This is my Code, but when i Push the button, nothing happens.
{ ������������"accessory": "GPIODevice", ������������"type": "MotionSensor", ������������"name": "Hall Motion", ������������"pin": 27 ��������}
I use a contact button on gpio 27 Pin 13 with doorpi and homebridge-contactsensor and it works with an raspi3. But i need a Motion sensor.
Can you help me?
If the open/close sensor is not present it is necessary to set a timeout
My relays that are setup as switches are on ON after boot. I could be the state of the gpio pins during boot but i'm not sure, Is it possible to control the state via the configs? If not that would be very helpful vs trying to change the gpio pins default state. AWESOME PROJECT THANK YOU.
It seems you changed the default behavior of the ContactSensor
In 0.1.5 the default behaviour was - LOW : sensor triggered, HIGH : sensor not triggered
In 0.2.5 the default behaviour is now - LOW : sensor not triggered, HIGH : sensor triggered
So now in order to get the same bahaviour as before I have to:
"inverted": true
Is this correct?
Too slow. Is any option to change that ? Sensor state is changing only when Homekit app re-read accessories.
I have a relay that pull opposite, so I would need the inverted option to work for the window covering. I see the key for a few other accessories in the documentation, but it doesnt appear to work on the window covering type.
Good night,
My name is Pere and I want to know how it would be possible to add “duration” into the function outlet.
Thank you very much,
Pere
It is possible to have an input pin (optional) to connect an external (physical) button to the gpio? For example controlling a light both from app (home) and from a button.
Thank
after updating to version 0.1.8 it does not work anymore, I have configured a smoke sensor in config.json
Works fine! But i combine it with tis plugin - https://github.com/Samfox2/homebridge-videodoorbell#readme
How i do that:
Hi, is possible to add support for temperature and humidity sensor like dht22 or dht11 ?
Thank
Unfortunately this beloved piece of software can't be build with node v10.
I know it hangs on wiringpi-node but this is unmaintained since more than 2 years an so i have more hope that you are able to find a other solution.
../ GRC / wiringPi.CC:886:3: note: in expansion of macro EXPORT_CONSTANT_INT ‘
EXPORT_CONSTANT_INT(FSEL_ALT5);
^~~~~~~~~~~~~~~~~~~
WiringPi.purpose.MK: 122: recipe execution error for target ' release / obj parameter.target / WiringPi/GRC / wiringPi.about»
grade: * * * [Release / obj.target / WiringPi/GRC / wiringPi.o] Error 1
to do: exit from directory "/usr/lib/node_modules folder/homebridge ports of the I / o device/folder node_modules/wiringpi-node/gather»
gyp ERR! build error
gyp ERR! stack error: 'make' failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (in/usr/lib in/node_modules/NPM folder/node_modules folder/node-jeep/lib/build.js: 262: 23)
gyp ERR! stack at ChildProcess.to emit (events.js: 182: 13)
gyp ERR! stack in the process.ChildProcess._handle.onexit (internal/child_process.js: 239: 12)
gyp ERR! System Linux 4.14.62-v7+
gyp ERR! command "/usr/bin/node" "directory/usr/lib in/node_modules/NPM folder/node_modules folder/node-jeep/bin / node-jeep.JSC " restore"
gyp ERR! Dov in /usr/lib/node_modules folder/homebridge ports of the I / o device/folder node_modules/wiringpi node
gyp ERR! node-v v10.9.0
gyp ERR! node-gyp -V v3.8.0
gyp ERR! not OK
made.
Enjoy !
please help
Hi
Thanks for your homebridge plugin. I tried using it with a light sensor plugged into the GPIO ports (configured as ContactSensor). It works incredibly fast. Actually, in my case too fast. The light sensor sometimes has some flickering before or after switching. Have you ever though about a debouncing feature, where the input signal has to hold a certain value for some time before actually switching?
Thanks again
Bastian
Thanks for your code, this looks like it will work well for me.
Typical for me, I used wPi 0 and the script seems to panic and dump out of homebridge. I've tried with "0" (quotes) but no love. Works great with 1 though!
Hey,
would be nice to trigger a "doorbell notification" during a GPIO Pin. Is it possible to do this? Would love to insert a sound sensor into my doorbell and trigger that notification via homekit.
greets from germany!
please help. I have this error.
/usr/lib/node_modules/homebridge/lib/api.js:64
throw new Error("The requested accessory '" + name + "' was not registered by any plugin.");
^
Error: The requested accessory 'GPIODevice' was not registered by any plugin.
at API.accessory (/usr/lib/node_modules/homebridge/lib/api.js:64:13)
at Server._loadAccessories (/usr/lib/node_modules/homebridge/lib/server.js:286:42)
at Server.run (/usr/lib/node_modules/homebridge/lib/server.js:87:38)
at module.exports (/usr/lib/node_modules/homebridge/lib/cli.js:45:10)
at Object. (/usr/lib/node_modules/homebridge/bin/homebridge:17:22)
at Module._compile (internal/modules/cjs/loader.js:799:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:810:10)
at Module.load (internal/modules/cjs/loader.js:666:32)
at tryModuleLoad (internal/modules/cjs/loader.js:606:12)
at Function.Module._load (internal/modules/cjs/loader.js:598:3)
at Function.Module.runMain (internal/modules/cjs/loader.js:862:12)
at internal/main/run_main_module.js:21:11
Thank you for maintaining this Plug-in and the new updates.
I am sorry for this beginner’s question.
The connection: GND <---> SENSOR <---> PIN
does not work for me.
It only works if I connect:
3.3V <---> SENSOR <---> PIN
or
GND <—> SENSOR <---> PIN <---> Resistor <---> 3.3V
Which way is correct?
simulating the issue:
-gate(7) is closed and shop(3) is opened
-press the shop(3) to close
this happens:
[3/12/2019, 3:19:48 PM] [Gate] openSensorPin[7] switch to 0 (inactive) => door closing
[3/12/2019, 3:19:48 PM] [Shop] openSensorPin[3] switch to 1 (active) => door opened
[3/12/2019, 3:19:54 PM] [Shop] openSensorPin[3] switch to 0 (inactive) => door closing
[3/12/2019, 3:19:55 PM] [Gate] Shift ends => door closed
[3/12/2019, 3:20:01 PM] [Shop] Shift ends => door closed
in the app show shop closing and gate show closing even I don't press for gate to close because is closed.
so look like when open or close one door is looking for all door if is closing or opened.
Hi,
Congratulations! This plug-in is working like a charm!
Thank you so much for creating it and making available to the world.
I really like one toolbox to set-up all automation around my house.
Wanted to suggest one enhancement, if this would seem feasible to you.
For example in the Window Accessory type.
It would be great, if it would have option to use two pins to read actual status. For example Windows that I have, have two separate status relays that I can connect to two RPI pins to read - one is active when Window is fully open and other is active when it is fully closed.
That can be used for HomeKit Characteristic (Characteristic.PositionState) to show to user confirmed real final status instead of estimated based on shiftDuration, or also to update initPosition to the real status if fully closed or fully open status is detected upon launch.
Janis
Hi,
I looked at the GarageDoorOpener autoClose functionality.
If I may, wanted to give two suggestion to improve it.
I'm using currently for this purpose other RPI with an old but working PlugIn (simple-garage-door-opener) than I would love to upgrade to gpio-device.
Janis
Hi,
The "gpio readall" command fails on RPI3B+ with this error:
pi@raspberrypi:~ $ gpio readall
Oops - unable to determine board type... model: 13
pi@raspberrypi:~ $ watch -d=comulative -n 0.1 gpio readall
Oops - unable to determine board type... model: 13
It seems that a fix for this is to upgrade the wiringPI to version 2.46
https://www.raspberrypi.org/forums/viewtopic.php?t=208735
http://wiringpi.com/wiringpi-updated-for-the-pi-v3plus/
Your "homebridge-gpio-device" plugin is currently installing/using 2.44
pi@raspberrypi:~ $ cat /usr/lib/node_modules/homebridge-gpio-device/node_modules/wiringpi-node/WiringPi/VERSION
2.44
Can you please update "homebridge-gpio-device" to use wiringPi version 2.46 so we can use the "gpio readall" command to determine the state of the GPIO pins?
Or is there another command to read the GPIO pins?
Thanks,
Miguel
I'm trying now for three days and I always run into the same error:
Dec 29 22:29:03 raspberrypi homebridge[4632]: [12/29/2018, 10:29:03 PM] ====================
Dec 29 22:29:03 raspberrypi homebridge[4632]: [12/29/2018, 10:29:03 PM] ERROR LOADING PLUGIN homebridge-gpio-device:
Dec 29 22:29:03 raspberrypi homebridge[4632]: [12/29/2018, 10:29:03 PM] Error: Cannot find module '../build/Release/WiringPi'
Dec 29 22:29:03 raspberrypi homebridge[4632]: at Function.Module._resolveFilename (internal/modules/cjs/loader.js:603:15)
Dec 29 22:29:03 raspberrypi homebridge[4632]: at Function.Module._load (internal/modules/cjs/loader.js:529:25)
Dec 29 22:29:03 raspberrypi homebridge[4632]: at Module.require (internal/modules/cjs/loader.js:657:17)
Dec 29 22:29:03 raspberrypi homebridge[4632]: at require (internal/modules/cjs/helpers.js:22:18)
Dec 29 22:29:03 raspberrypi homebridge[4632]: at Object. (/usr/local/lib/node_modules/homebridge-gpio-device/node_modules/wiringpi-node/lib/exports.js:1:18)
Dec 29 22:29:03 raspberrypi homebridge[4632]: at Module._compile (internal/modules/cjs/loader.js:721:30)
Dec 29 22:29:03 raspberrypi homebridge[4632]: at Object.Module._extensions..js (internal/modules/cjs/loader.js:732:10)
Dec 29 22:29:03 raspberrypi homebridge[4632]: at Module.load (internal/modules/cjs/loader.js:620:32)
Dec 29 22:29:03 raspberrypi homebridge[4632]: at tryModuleLoad (internal/modules/cjs/loader.js:560:12)
Dec 29 22:29:03 raspberrypi homebridge[4632]: at Function.Module._load (internal/modules/cjs/loader.js:552:3)
Dec 29 22:29:03 raspberrypi homebridge[4632]: [12/29/2018, 10:29:03 PM] ====================
OK, so I'm successfully deployed motion detector on GPIO PIN 3, I connected 1 line to PIN 3, but where I had to plug second?? GND? 5V? 3.3V? Pls help me!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.