KraigM / homebridge-gpio-garagedoor

RPi GPIO based Garage Door plugin for Homebridge
22 stars 11 forks source link

NO-NC relay #9

Open aptyp222 opened 7 years ago

aptyp222 commented 7 years ago

Hello, I really like your progrrmma to control the gate. but I ran into a problem when connecting the gate will automatically open (there is a connection management contacts at 1 second) What you need to sign in to add to config.json gpio23 was NO by default? He is now NC "Example doorSwitchValue": 1, ""? Thank you!

thewhitestig commented 7 years ago

I have a hack for this, it's done by reversing the switchPort logic. This includes initializing switchPort as 'high' when creating the object, as well as reversing the signal mapping in GPIOPort. In switchPort.ts constructor(pin, service, log, doorSensor: DoorSensorPort, doorOpensInSeconds) { super(pin, 'high'); this.service = service; In GPIOPort.ts export enum GPIOState { On = 0, Off = 1, }

Again, this is just a hack... a more proper way is to create the GPIO object as activeLow true, which requires passing the parameter properly.

rinoronie commented 6 years ago

In versione 0.2.2 I don't find this section: constructor(pin, service, log, doorSensor: DoorSensorPort, doorOpensInSeconds) { super(pin, 'high'); this.service = service;

and

export enum GPIOState { On = 0, Off = 1, }

voggers commented 6 years ago

If anyone else is struggling with this: Changes done in "/usr/lib/node_modules/homebridge-gpio-garagedoor/lib"

SwitchPort.js:

Changed "_super.call(this, pin, 'out');" to "_super.call(this, pin, 'high');"

GPIOPort.js:

Changed "GPIOState[GPIOState["On"] = 0] = "On"; GPIOState[GPIOState["Off"] = 1] = "Off";"

to

"GPIOState[GPIOState["On"] = 1] = "On"; GPIOState[GPIOState["Off"] = 0] = "Off";"

PJMikols commented 5 years ago

Changes done in "/usr/lib/node_modules/homebridge-gpio-garagedoor/lib"

also possible it's in "/usr/local/lib/node_modules/homebridge-gpio-garagedoor/lib/"

WORKED FOR ME! Thanks guys!

junicello commented 5 years ago

Would be great to get this resolved and pushed out. Who can make this happen? I am willing to jump in but don't have much experience with GIT pipeline.

@KraigM Are you still managing this project?

junicello commented 5 years ago

Worked for me as well using a dual relay setup with the following configuration:

{
    "accessory": "GPIOGarageDoor",
    "name": "Door",
    "doorSwitchPin": 23,
    "doorSensorPin": 18,
    "isNCSensor": false,
    "doorOpensInSeconds": 14
},

{
    "accessory": "GPIOGarageDoor",
    "name": "Grill",
    "doorSwitchPin": 24,
    "doorSensorPin": 17,
    "isNCSensor": true,
    "doorOpensInSeconds": 120
}

diff SwitchPort.js SwitchPort.js.backup 16c16 < _super.call(this, pin, 'high'); --- > _super.call(this, pin, 'out'); diff GPIOPort.js GPIOPort.js.backup 16,17c16,17 < GPIOState[GPIOState["On"] = 0] = "On"; < GPIOState[GPIOState["Off"] = 1] = "Off"; --- > GPIOState[GPIOState["On"] = 1] = "On"; > GPIOState[GPIOState["Off"] = 0] = "Off";

base64bits commented 4 years ago

For those unable to find the files to modify in my case I found them under /usr/local/lib/node_modules/@bluephlame/homebridge-gpio-garagedoor/lib