Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with closing garage door... #6

Open
titoudoc opened this issue Dec 30, 2018 · 4 comments
Open

Issue with closing garage door... #6

titoudoc opened this issue Dec 30, 2018 · 4 comments

Comments

@titoudoc
Copy link

Hi, I can't close my garage door, nothing happens when I click the door in homekit.

I've setup everything on my RaspPi with homebridge-garagedoor-command.
The open.sh, close.sh and check_state.sh work fine when the script is launch from the pi.
But, from homebridge only the open.sh and check_state.sh seems to be working. Nothing happend when I click to close the door when the door is alerady open.

Any idea ?

@titoudoc
Copy link
Author

titoudoc commented Dec 31, 2018

I've managed to resolve my issue by changing the close.sh script :

!/bin/bash
retval=`curl -b gogocookie.txt http://gogogatelocalIP/isg/statusDoor.php?numdoor=1`

if [ "$retval" == "FAIL" ]
    then
        echo CLOSED
    else
        curl -d 'login=userlogin&pass=userpassword&send-login=submit' -c gogocookie.txt http://gogogatelocalIP/index.php
        curl -b gogocookie.txt http://gogogatelocalIP/isg/opendoor.php?numdoor=1
fi

@edubai
Copy link
Owner

edubai commented Dec 31, 2018

Door is open returns = OK
Door is closed returns = FAIL
So when you execute close.sh we assume the door is open and you want to close it, we first check the status of the door which should return OK(door is still open), then you execute a close command, after that you echo CLOSED.

@titoudoc
Copy link
Author

I understand it well, but how explain my issue ?

Launched directly form the pi, open.sh close.sh and check_state.sh works well.
But, with homebridge, the door open, the status return is fine but the door don't close ?

With my alternate version of close.sh, everything work fin in homebridge...

Any idea ?

@edubai
Copy link
Owner

edubai commented Dec 31, 2018

No idea really, you can try an alternative javascript which someone posted on reddit.

by
leehadassin
https://www.reddit.com/r/homebridge/comments/8ihs1w/homebridge_gogogate2_plugin/

Thanks for finding a solution. I still want to make a native plugin for the Gogogate and incorportate polling. As an interim test I have taken the curl scripts and made javascript equivalents:
OPEN/CLOSE

var request = require('request'); request = request.defaults({jar: true});
var formData = { login: 'USERLOGIN', pass: 'USERPASSWORD', 'send-login': 'submit', }; request.post({url:'http://IPADDRESS/index.php', formData: formData}, function optionalCallback(err, httpResponse, body) { if (err) { return console.error('login failed:', err); } else { request ('http://IPADDRESS/isg/opendoor.php?numdoor=1'); }; });

CHECK_STATUS

var request = require('request'); request = request.defaults({jar: true});
var formData = { login: ‘USERLOGIN’, pass: ‘USERPASSWORD’, 'send-login': 'submit', }; request.post({url:'http://IPADDRESS/index.php', formData: formData}, function optionalCallback(loginerr, loginResponse, loginbody) { if (loginerr) { return console.error('login failed:', loginerr); } else { request ('http://IPADDRESS/isg/statusDoor.php?numdoor=1', function optionalCallback(statuserror, statusresponse, statusbody) { if (statusbody == "FAIL") { console.log('CLOSED'); } else if (statusbody == "OK") { console.log('OPEN'); }; }); }; });

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants