benlamonica / homebridge-rasppi-gpio-garagedoor

Plugin for HomeBridge for a Raspberry Pi GPIO Garage Door Opener
63 stars 40 forks source link

clarification on in/out, low/high gpio #46

Open MartinGranados opened 5 years ago

MartinGranados commented 5 years ago

I have 2 garage doors using normally closed relays I chose pins that don't activate on raspberry pi boot. also using magnetic reed switch to detect if doors are closed

I'm having trouble configuring the pins correctly in the garage-door-gpio script in /var/lib/homebridge/garage-door-gpio

can anyone explain what needs to be done here?

function export_pin { if [ ! -e /sys/class/gpio/gpio${1} ] ; then echo $1 > /sys/class/gpio/export if [ "$3" == "low" ] ; then echo 1 > /sys/class/gpio/gpio${1}/active_low else echo 0 > /sys/class/gpio/gpio${1}/active_low fi echo $2 > /sys/class/gpio/gpio${1}/direction if [ "$2" == "out" ] ; then echo $4 > /sys/class/gpio/gpio${1}/value fi fi }

function unexport_pin { if [ -e /sys/class/gpio/gpio${1} ] ; then echo $1 > /sys/class/gpio/unexport fi }

if [ "$1" == "start" ] ; then log_daemon_msg "Enabling Garage Door GPIO pins for door 0" export_pin 24 out low 0 export_pin 22 in high 0 log_end_msg 0

log_daemon_msg "Enabling Garage Door GPIO pins for door 1" export_pin 23 out low 0 export_pin 27 in high 0 log_end_msg 0 else [ "$1" == "stop" ]
log_daemon_msg "Disabling Garage Door GPIO pins for door 0" unexport_pin 24 unexport_pin 22

log_daemon_msg "Disabling Garage Door GPIO pins for door 1" unexport_pin 23 unexport_pin 27 fi

TimCombridge commented 5 years ago

I'm having some issues. Got a Pi 3 and a 12v externally powered relay. I've tried GPIO 5/4/17/23, all of which will trigger the open when the power is lost. Am I doing this incorrectly? Do I have to configure the script for these to be restored to their LOW states, or should it be automatic?

toshibochan commented 5 years ago

Now I’m using https://github.com/dubocr/homebridge-gpio-device for my garage doors

toshibochan commented 5 years ago

This is my config for homebridge-gpio-device

            "accessory": "GPIODevice",
            "type": "GarageDoorOpener",
            "name": "Gate",
            "pin": 4,
            "inverted": "false",
            "pulseDuration": 200,
            "invertedInputs": "false",
            "openSensorPin": 24
    }, {
            "accessory": "GPIODevice",
            "type": "GarageDoorOpener",
            "name": "Shop",
            "pin": 5,
            "inverted": "false",
            "pulseDuration": 200,
            "invertedInputs": "false",
            "openSensorPin": 25