Jump to content

Python control of MyQ Garage Doors


einstein.42

Recommended Posts

Isibarra, Sorry for the delay in answer. I was engaged in another project and couldn't stop last night. :)

 

I would agree with Xathros yet again, the only thing I can think of is that you used an integer variable instead of state in the ISY config. That being said, try

 

./myq-garage.py status

 

This is what I get when I run it:

 
Big Door is Closed. Last changed at Fri 18 Dec 2015 07:36:36
MyQ_Big_Door is already set to 0
3rd Car is Closed. Last changed at Tue 15 Dec 2015 19:49:02
MyQ_3rd_Car is already set to 0
 
Paste me what you get.
 
Next I would try to do this:
 
Open up IE or whatever browser you use, and go to http://<your isy ip>/rest/vars/definitions/2
 
It will ask you for a username/password that is your normal ISY username/password. 
 
Paste me the section for e id="38"
 
Thanks,
 
E
Link to comment

Hi einstein.42 & Xathros,

Yes, I created the variable under state variables. I apologize if I didnt include that on my last screenshot. See the new link below.

 

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

 

einstein.42, you indicated to provide you the section for e id="38". I am wondering how did you get that id#. I do not have id="38". The max id # i have is 37. Perhaps could be this could be the issue if the python script is looking for this id="38" instead of id="37"? If so, how do I correct that?

 

Also, running the custom relay commands inside the DSCLink is not working. If I run the command inside terminal, the garage door is responsive but when the command is run inside the DSCLink custom relay, it is not responding. Any idea?

 

Thanks again to both of you.

Link to comment

Yea I meant 37. My bad. What is the output of ./myq-garage.py status?

 

As for the relay server. 

 

Network Resource 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_GARAGE_DOOR

 

In DSCLink > Relay Server

Command: MYQ_OPEN_GARAGE_DOOR

Program: ./myq-garage.py

Arguments: open garage door

 

The myq-garage.py file is in the same folder as the dsclink server correct?

Link to comment

Updated with full logging and better error catching. Now logs to logs/myq-garage.py rotating every day with 30 day cache so it doesn't fill up the drive. If using with io_guy's products, it will be in the same folder as his. 'logs'. Also added some better requests exception catching for web or network failures.

 

Updated Readme here. We will call this version "0.5"

 

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

Link to comment

Hi einstein.42,

 

I uploaded your updated version 0.5 of myq-garage.py. Here is the log.

 

2015-12-18 22:19:07,583 INFO     Get_Var_ID: Request response: 200 <CList type="VAR_INT"><e id="1" name="sAlarmZone1_Garage_Rollup_Door" /><e id="2" name="sAlarmZone9_FrontEntyExitDoor" /><e id="3" name="sAlarmZone10_GarageEntryExitDoor" /><e id="4" name="sAlarmZone11_GarageEntryExitSideDoor" /><e id="5" name="sAlarmZone12_FamilyRoomPatioDoor" /><e id="6" name="sAlarmZone13_DiningRoomPatioDoor" /><e id="7" name="sAlarmZone14_LivingRoomWindow_Left" /><e id="8" name="sAlarmZone15_LivingRoomWindow_Right" /><e id="9" name="sAlarmZone16_KitchenSmallWindow" /><e id="10" name="sAlarmZone17_KitchenLargeWindow" /><e id="11" name="sAlarmZone18_DownstairsBathroomWindow" /><e id="12" name="sAlarmZone19_BedroomWindow_Right" /><e id="13" name="sAlarmZone20_BedroomWindow_Left" /><e id="14" name="sAlarmZone21_MastersBedroomWindow_Left" /><e id="15" name="sAlarmZone22_MastersBedroomWindow_Right" /><e id="16" name="sAlarmZone23_MastersBathroom" /><e id="17" name="sAlarmZone24_HallwayBathroom" /><e id="18" name="sAlarmZone25_LivingRoomMotion" /><e id="19" name="sAlarmZone26_FamilyRoomMotion" /><e id="20" name="sAlarmZone40_KeypadNonTouchscreen" /><e id="21" name="sAlarmZone41_WirelessKeyfob1" /><e id="22" name="sAlarmZone42_WirelessKeyfob2" /><e id="23" name="sAlarmStatus_Alarmed" /><e id="24" name="sAlarmStatus_Disarmed" /><e id="25" name="sAlarmStatus_Ready" /><e id="26" name="sAlarmStatus_ExitDelay" /><e id="27" name="sAlarmStatus_EntryDelay" /><e id="28" name="sAlarmStatus_ArmedStay" /><e id="29" name="sAlarmStatus_ArmedAway" /><e id="30" name="sAlarm_Heartbeat" /><e id="31" name="sAlarm_PanelTrouble" /><e id="32" name="sAlarm_DisarmingUser" /><e id="33" name="mLarry_android" /><e id="34" name="mVirginia_android" /><e id="35" name="Kitchen_Nook_Light_Count" /><e id="36" name="mJohn_android" /><e id="37" name="MyQ_Garage_Door" /></CList>
2015-12-18 22:19:07,585 INFO     Searching ISY Definitions for MyQ_Garage_Door
 
The state variable i entered shows but is cannot find it through the script.
 
Hope this log helps.
 
Larry
Link to comment

Do you know if I need to change the DSCServer.exe file to 755 permission? Could that be an issue? It is currently at 644. Also, below is a section of the config.xml data for the dsc server. This confirms the custom relay is written correctly.

 

</section>
  <section name="relay server">
    <item key="repeater" value="False" />
  </section>
  <section name="customcommands">
    <item key="command0" value="" trigger="MYQ_CLOSE_GARAGE_DOOR" program="./myq-garage.py" args="close garage door" />
    <item key="command1" value="" trigger="MYQ_OPEN_GARAGE_DOOR" program="./myq-garage.py" args="open garage door" />
    <item key="command2" value="" trigger="MYQ_STATUS_GARAGE_DOOR" program="./myq-garage.py" args="status" />
  </section>
 
However, it also not working when the trigger is kicked off.
 
Larry
Link to comment

Can you see the command being accepted via the the dscserver log on the web page? 644 is fine for dscserver because it isn't itself executable. mono runs it. That is so weird. Why isn't it finding it when it is clearly right there. I say you rename your garage door and try a new variable and see what happens.

Link to comment

Hi einstein.42,

 

Below is the partial log from the dscserver.exe

 

2015-12-18 17:59:19 - ISY: <CList type="VAR_INT"><e id="1" name="sAlarmZone1_Garage_Rollup_Door" /><e id="2" name="sAlarmZone9_FrontEntyExitDoor" /><e id="3" name="sAlarmZone10_GarageEntryExitDoor" /><e id="4" name="sAlarmZone11_GarageEntryExitSideDoor" /><e id="5" name="sAlarmZone12_FamilyRoomPatioDoor" /><e id="6" name="sAlarmZone13_DiningRoomPatioDoor" /><e id="7" name="sAlarmZone14_LivingRoomWindow_Left" /><e id="8" name="sAlarmZone15_LivingRoomWindow_Right" /><e id="9" name="sAlarmZone16_KitchenSmallWindow" /><e id="10" name="sAlarmZone17_KitchenLargeWindow" /><e id="11" name="sAlarmZone18_DownstairsBathroomWindow" /><e id="12" name="sAlarmZone19_BedroomWindow_Right" /><e id="13" name="sAlarmZone20_BedroomWindow_Left" /><e id="14" name="sAlarmZone21_MastersBedroomWindow_Left" /><e id="15" name="sAlarmZone22_MastersBedroomWindow_Right" /><e id="16" name="sAlarmZone23_MastersBathroom" /><e id="17" name="sAlarmZone24_HallwayBathroom" /><e id="18" name="sAlarmZone25_LivingRoomMotion" /><e id="19" name="sAlarmZone26_FamilyRoomMotion" /><e id="20" name="sAlarmZone40_KeypadNonTouchscreen" /><e id="21" name="sAlarmZone41_WirelessKeyfob1" /><e id="22" name="sAlarmZone42_WirelessKeyfob2" /><e id="23" name="sAlarmStatus_Alarmed" /><e id="24" name="sAlarmStatus_Disarmed" /><e id="25" name="sAlarmStatus_Ready" /><e id="26" name="sAlarmStatus_ExitDelay" /><e id="27" name="sAlarmStatus_EntryDelay" /><e id="28" name="sAlarmStatus_ArmedStay" /><e id="29" name="sAlarmStatus_ArmedAway" /><e id="30" name="sAlarm_Heartbeat" /><e id="31" name="sAlarm_PanelTrouble" /><e id="32" name="sAlarm_DisarmingUser" /><e id="33" name="mLarry_android" /><e id="34" name="mVirginia_android" /><e id="35" name="Kitchen_Nook_Light_Count" /><e id="36" name="mJohn_android" /><e id="37" name="MyQ_gDoor" /></CList> (vars/definitions/2)

 

I already changed the name on the garage door to gDoor. As you noticed, id="37" is showing MyQ_gDoor. Thus the dscserver is seeing the new state variable.

 

Below is the log from your script:

 

2015-12-18 18:01:14,835 INFO     Get_Var_ID: Request response: 200 <CList type="VAR_INT"><e id="1" name="sAlarmZone1_Garage_Rollup_Door" /><e id="2" name="sAlarmZone9_FrontEntyExitDoor" /><e id="3" name="sAlarmZone10_GarageEntryExitDoor" /><e id="4" name="sAlarmZone11_GarageEntryExitSideDoor" /><e id="5" name="sAlarmZone12_FamilyRoomPatioDoor" /><e id="6" name="sAlarmZone13_DiningRoomPatioDoor" /><e id="7" name="sAlarmZone14_LivingRoomWindow_Left" /><e id="8" name="sAlarmZone15_LivingRoomWindow_Right" /><e id="9" name="sAlarmZone16_KitchenSmallWindow" /><e id="10" name="sAlarmZone17_KitchenLargeWindow" /><e id="11" name="sAlarmZone18_DownstairsBathroomWindow" /><e id="12" name="sAlarmZone19_BedroomWindow_Right" /><e id="13" name="sAlarmZone20_BedroomWindow_Left" /><e id="14" name="sAlarmZone21_MastersBedroomWindow_Left" /><e id="15" name="sAlarmZone22_MastersBedroomWindow_Right" /><e id="16" name="sAlarmZone23_MastersBathroom" /><e id="17" name="sAlarmZone24_HallwayBathroom" /><e id="18" name="sAlarmZone25_LivingRoomMotion" /><e id="19" name="sAlarmZone26_FamilyRoomMotion" /><e id="20" name="sAlarmZone40_KeypadNonTouchscreen" /><e id="21" name="sAlarmZone41_WirelessKeyfob1" /><e id="22" name="sAlarmZone42_WirelessKeyfob2" /><e id="23" name="sAlarmStatus_Alarmed" /><e id="24" name="sAlarmStatus_Disarmed" /><e id="25" name="sAlarmStatus_Ready" /><e id="26" name="sAlarmStatus_ExitDelay" /><e id="27" name="sAlarmStatus_EntryDelay" /><e id="28" name="sAlarmStatus_ArmedStay" /><e id="29" name="sAlarmStatus_ArmedAway" /><e id="30" name="sAlarm_Heartbeat" /><e id="31" name="sAlarm_PanelTrouble" /><e id="32" name="sAlarm_DisarmingUser" /><e id="33" name="mLarry_android" /><e id="34" name="mVirginia_android" /><e id="35" name="Kitchen_Nook_Light_Count" /><e id="36" name="mJohn_android" /><e id="37" name="MyQ_gDoor" /></CList>
2015-12-18 18:01:16,233 INFO     Searching ISY Definitions for MyQ_gDoor
 
Seemed to be doing the same issue.
Link to comment

Awesome. I think we got it resolved. Please get version 0.6 here. Found a compatibility issue between the XML responses of the state variable definitions between 4.3.26 and 5+. Should be resolved now. Also fixed that path direction issue we noticed on testing Isibarra.

 

Thanks for being patient and helping me find that one. Wasn't easy to reproduce! 

Link to comment

Hi einstein.42,

So awesome... as soon as I uploaded the new version, and run it in the terminal... it found the state variable right away. Everything is now working. I still kept the full path on the relay server since replacing it with ./myq-garage.py only does not work on mine.

 

Thank you so much again. I really appreciate all your hard work and effort on getting this fully functional.

 

Cheers,

Larry

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

×
×
  • Create New...