Jump to content

Python control of MyQ Garage Doors


einstein.42

Recommended Posts

Python Chamberlain Garage Door interface

Python used to interface with my MyQ garage doors.

Load it as a module, or download it on a linux box or rpi and

'chmod 755 myq-garage.py'

Edit the file and put your myq username and password. Then use like so:

Command Line options: ./myq-garage.py [open/close/status] [door number] 

 

# If you do a ./myq-garage.py status the door numbers are listed in order starting with 0

 

https://github.com/Einstein42/myq-garage

 

I have a larger project I'm working on that I will add it into for direct consumption from the ISY, but here is the raw code for now. 

Link to comment
  • 2 weeks later...

Hi einstein.42,

I currently have an RPi2 with Raspbian Jessie installed and running it mono to install DSCLink Server for my ISY994 automation. I would love if possible to install this module in it or download your script to the same RPi. Is this something possible? If so, do you have sometime to guide me how to install your python to control my MyQ garage door? I am a noob on linux but technical enough to learn if you have any instructions.

 

Thank you.

Link to comment

Isibarra this is the raw code right now, so while you can control your garage doors with it, it is not built into an interface from the ISY yet. (Coming soon). I updated the readme on the code to include the steps required to install it. Let me know if you have any other questions above and beyond that.

 

Thanks,

 

James

 

<Myq-garage github page>

Edited by einstein.42
Link to comment

Thanks for the quick reply James. I am looking forward to see your work when the interface to ISY is complete.

 

I will try to install your script tonight per your instructions on the readme page.

 

Thanks again,

Larry

Does DSCLink have io_guy's Relay server built in?  If so, then you have everything you need to make this work with the ISY already.  A few simple bash scripts is all it would take to complete the interface between this python module and the ISY.  Use the Relay server to run the scripts via the ISY's network module.  If not, then look at ISYLink or NodeLink both of which offer the Relay server.

 

-Xathros

  • Like 1
Link to comment

In fact that is about as easy as it gets. The only problem is you can't get status.

 

Copy the myq-garage.py file to the same folder as your dsclink program.

Then in DSCLink go to the relay server tab. Under the custom relay commands put:

 

COMMAND:                         Program:                                Arguments:

MYQ_OPEN_0                     ./myq-garage.py                    open 0

MYQ_CLOSE_0                   ./myq-garage.py                    close 0

 

Then add the network resource in your ISY under Configuration>Networking>Network Resources

 

Name: OPEN FIRST DOOR

Protocol: tcp

Host: <your pi ip>

Port: 2402 (by default)

Timeout 500

Mode: C Escaped

Body: MYQ_OPEN_0

 

Hit save then save again, then test. Your door should open. 

 

Add another resource for close. Then you can control it whenever you'd like. 

 

Like I said, you still can't get status for now though. 

Edited by einstein.42
Link to comment

Should be able to call a script to get the status from the python module, evaluate the response and set an ISY var with a /rest call based on the response.

 

No?

 

-Xathros

Link to comment

As usual Xathros is correct. I have updated the code to fully integrate with dsclink(or any of his relay servers), and report back state variables to the ISY. Instructions as usual are here.

 

Edit the myq-garage.py and add in your ISY information. I tried to create the state variables for you, but can't via the REST interface as far as I can tell, so you'll have to create them manually the first time. After that every time 'status' is called, the variables are updated. As well as when you open and close it by the relay server. You will have to poll 'status' on a timer to get 'live data'. 

 

 

ALSO, I added the ability to have as many doors as needed (no limit that I know of), instead of just 2. I also changed over to 'named' calling. So from now on,

 

./myq-garage.py open big door

 

big door would be whatever name you named it in the myq interface. case insensitive. 

Edited by einstein.42
Link to comment

Hi Xathros and einstein.42,

 

Thank you so much. I will try this but being a noob, it may take me awhile to get everything up and running. The way is sounds like it should be no different on how DSCLink server is integrated to ISY. You guys are so awesome. Thank you again for all your help. I will report back as soon as I get everything set.

 

Thanks,

Larry

Link to comment

Hi einstein.42,

Thank you again for your willing to assist. me. I am reading again your instructions on creating the state variables in ISY. Per your instructions, the Variable format is ISY_VAR_PREFIX + MyQ Door name. If my door name is "Garage Door", does it mean the name of the variable will be as follows:

 

ISY_VAR_PREFIX MyQ_Garage_Door

 

Also, do I install the python pip package first before copying myq-garage.py to the same folder as the DSCLink Server?

 

Really appreciate all your help.

 

Thanks,

Larry

Link to comment

HI,

 

I edited the required fields from your script and uploaded it in the same folder where the DSCLink is saved. I created the state variable in ISY as well. Also, I entered the information below in the Relay Server of DSCLink

 

COMMAND:                         Program:                                Arguments:

MYQ_OPEN_0                     ./myq-garage.py                    open 0

MYQ_CLOSE_0                   ./myq-garage.py                    close 0

 

I also made these entries in the Network Resource Module in ISY:

 

Name: MyQ_Garage_Door_Open

Protocol: tcp

Host: <your pi ip>

Port: 2402 (by default)

Timeout 500

Mode: C Escaped

Body: MYQ_OPEN_0

 

When I tested it I see the log from the DSCLink below. However, the garage door does not respond.

 

2015-12-17 07:55:09 - Relay Server: Running program (./myq-garage.py)
2015-12-17 07:59:25 - Relay Server: Running program (./myq-garage.py)
2015-12-17 08:02:25 - Relay Server: Running program (./myq-garage.py)
2015-12-17 08:04:11 - Relay Server: Running program (./myq-garage.py)
 
Any idea?
 
Please let me know. Thanks.
 
Larry
Link to comment

Hey Isibarra sorry for the delayed response. In my previous post I said I changed the door number (0 or 1) to the actual doorname. 

 

So login via ssh to the raspberry pi. Go to your dsclink folder where the myq-garage.py file is and type this (if your garage door is named Garage Door).

 

./myq-garage open garage door

 

See if it produces any errors. I need to update my README I apologize. I must have missed that part. 

Link to comment

Hi einstein.42,

Thanks for getting back to me and I apologize for being such a novice on this.

 

However, I am a little confused. I did try both ways where I replaced door number to the actual doorname. Thus, I entered this in the relay server section of DSCLink

 

COMMAND:                                                    Program:                                Arguments:

MYQ_OPEN_GARAGE_DOOR                     ./myq-garage.py                    open garage door

MYQ_CLOSE_GARAGE_DOOR                   ./myq-garage.py                    close garage door

 

I also then updated the network resource as follows:

 

Name: MyQ_Garage_Door_Open

Protocol: tcp

Host: <your pi ip>

Port: 2402 (by default)

Timeout 500

Mode: C Escaped

Body: MYQ_OPEN_GARAGE_DOOR

 

However, it still didn't work. Could you help guide me what I should really enter in the relay server section of DSCLink and also the Network Resource in ISY?

 

I didn't fully understand your comment regarding adding this line

 

./myq-garage open garage door

 

to the myq-garage.py file. What section of the myq-garage.py file I should add this line

 

./myq-garage open garage door

 

Should I add it on row 244 of your script?

 

Thanks for your help.

Link to comment

Hi einstein.42,

I just tried running that command in the terminal while I am in the file directory where myq-garage.py was saved. First the permission was off. I guess I forgot to run the 'chmod 755 myq-garage.py'. As soon as I did that it worked. I was able to open and close my garage door when running that command in the terminal file directory. However, here is my new problem. Everytime I run the command, I get the error "State variable: MyQ_Garage_Door not found in ISY variable list..." See the link below for a screenshot.

 

The screenshot in blue is the ISY state variable I set. However, I still get the error message that it cannot find the state variable in ISY. Do you have any idea why this is?

 

https://drive.google.com/file/d/0B9dzdbhY3LB1dzY2Q2hfdld4YUE/view?usp=sharing

 

I feel that I am so close getting this completed and I wouldn't be able to accomplish this without your great help. Thank you.

Link to comment
Guest
This topic is now closed to further replies.

×
×
  • Create New...