Jump to content
AT&T to end email-to-text ×

tehinternet

Members
  • Posts

    3
  • Joined

  • Last visited

Everything posted by tehinternet

  1. Thanks. That looks very helpful! Also, BTW, your version of the base myq-garage script does appear to fix the problem with having to delete the token. Been running great for about 24 hours now as I build a custom home website around it.
  2. Thank you xKing. I'll give that version a try. Also, as an end-user I ran into a little problem in this scenario. I can run the script fine as a normal linux user from the command line. I am attempting to run this python script via PHP using the exec_shell() function within PHP. When I do that, it's really being run as my apache user (www-data). The problem is that www-data can execute the python script, but it dies quickly with this error: Traceback (most recent call last): File "/home/trent/hal/garage_door/myq-garage.py", line 57, in <module> USERNAME = config.get('main', 'USERNAME') File "/usr/lib/python2.7/ConfigParser.py", line 330, in get raise NoSectionError(section) ConfigParser.NoSectionError: No section: 'main' I found that this is because the www-data user really isn't sitting in the directory where the scipt and the config.ini are held. It can run the script, but it doesn't know where to find the config.ini. To resolve this, I had to edit the python script and change this line: config.read('config.ini') to config.read('/full/path/to/find/config.ini') Regardless if my web server or PHP is running the script, this problem is reproducible as a normal user if you run the myq-garage.py script not from the directory it's located in. For example: This works: $ pwd /home/user/garage $./myq-garage.py This would not work: $pwd /home/user/garage $cd ../.. $pwd /home $ /home/user/garage/myq-garage.py Traceback (most recent call last): File "/home/trent/hal/garage_door/myq-garage.py", line 57, in <module> USERNAME = config.get('main', 'USERNAME') File "/usr/lib/python2.7/ConfigParser.py", line 330, in get raise NoSectionError(section) ConfigParser.NoSectionError: No section: 'main' This may not be a concern if you're using ICY, but if you're trying to use it in other ways like I am, it might be problematic for some users. My recommendation, for what it's worth, would be to make a user configurable variable in the top of the python script (which screams out to the user to edit it) which points to the full path of the config file. Or combine the config and script into a singe file. Or make the config file a Python script which then calls the main Python script which interacts with the Chamberain API. xKing, thanks again. I just found this form script yesterday, so I hope to mess with it more and I'll let you know if it solved my token problem or not. EDIT: xKing, I found a little odd thing when running your version. With Mr.Einstin's version I could run it from my command line like this: ./my* status but for yours that fails and it tells me the proper syntax. Your version requires my to run it as ./myq-garage status Basically I can't wildcard the name of the python script when running it. That's kinda odd. I've seen that before, but I can't remember what the fix is.
  3. Hello, Thank you for developing this script and making it public. It's very helpful. I've been experimenting with it on my rasberry pi with the most simple configuration ever; I just added my username/password for my MyQ account and it works for my Chamberlain garage door opener! But, as others have recently reported, I have a problem where after sometime the script no longer returns results (e.g. ./myq_garage.py status returns nothing). I need to delete /tmp/myqtoken.json for it to work again. I first installed it last night, but by this morning I needed to remove /tmp/myqtoken.json for it to work again. Then this morning once I got it working, 2 hours later when I attempt to use it again, it wasn't working. I have not yet done testing to see how long I can get it to work for. /tmp/myqtoken.json is getting created by the standard linux user which I'm using when I run the myq-garage.py from the command line. When it's not working, deleting that file appears to make it work again. I have attempted to change the config.ini's TOKENTTL value from 60 to 50, but that had no effect. Shouldn't the token be getting deleted after 60 (or 50) minutes? Why do I have to manually delete it? What changes would you guys recommend so that this script can be reliably called when needed? Thank you! Also, below, is my log this morning when it wasn't working. The time is a little screwy on my system due to UTC offset. Here is what these times break down to if it helps. 7:00 and 8:00 hour: Over night when I was not using this script or the garage door. When I went to bed it was working. 10:00 hour: When I found it wasn't working this morning and needed to delete the token file to make it work again. Deleted the token file about 10:30. 11:00 to 12:00: When I left the plugin working and went to work. 12:29: Arrived at work to find the plugin no longer working. 13:01: Deleted the token file and the script was working again. 2017-03-27 00:07:12,432 INFO ==================================STARTED================================== 2017-03-27 00:07:13,487 INFO Garage Door is Closed. Last changed at Sun 26 Mar 2017 23:52:22 2017-03-27 00:07:13,558 ERROR Caught Exception in isy_get_var_id: ('Connection aborted.', gaierror(-2, 'Name or service not known')) 2017-03-27 00:07:13,561 ERROR Traceback (most recent call last): 2017-03-27 00:07:13,562 ERROR File "./myq-garage.py", line 407, in <module> 2017-03-27 00:07:13,565 ERROR gdoor_main() 2017-03-27 00:07:13,567 ERROR File "./myq-garage.py", line 380, in gdoor_main 2017-03-27 00:07:13,569 ERROR id, varname, init, value = isy_get_var_id(inst.name) 2017-03-27 00:07:13,571 ERROR TypeError 2017-03-27 00:07:13,572 ERROR : 2017-03-27 00:07:13,574 ERROR 'NoneType' object is not iterable 2017-03-27 00:07:52,759 INFO ==================================STARTED================================== 2017-03-27 00:07:53,908 ERROR Caught Exception in isy_get_var_id: ('Connection aborted.', gaierror(-2, 'Name or service not known')) 2017-03-27 00:07:53,911 ERROR Traceback (most recent call last): 2017-03-27 00:07:53,913 ERROR File "./myq-garage.py", line 407, in <module> 2017-03-27 00:07:53,915 ERROR gdoor_main() 2017-03-27 00:07:53,917 ERROR File "./myq-garage.py", line 391, in gdoor_main 2017-03-27 00:07:53,919 ERROR id, varname, init, value = isy_get_var_id(inst.name) 2017-03-27 00:07:53,921 ERROR TypeError 2017-03-27 00:07:53,923 ERROR : 2017-03-27 00:07:53,924 ERROR 'NoneType' object is not iterable 2017-03-27 00:07:59,447 INFO ==================================STARTED================================== 2017-03-27 00:08:00,421 INFO Garage Door is Opening. Last changed at Mon 27 Mar 2017 00:07:55 2017-03-27 00:08:00,487 ERROR Caught Exception in isy_get_var_id: ('Connection aborted.', gaierror(-2, 'Name or service not known')) 2017-03-27 00:08:00,490 ERROR Traceback (most recent call last): 2017-03-27 00:08:00,492 ERROR File "./myq-garage.py", line 407, in <module> 2017-03-27 00:08:00,494 ERROR gdoor_main() 2017-03-27 00:08:00,496 ERROR File "./myq-garage.py", line 380, in gdoor_main 2017-03-27 00:08:00,499 ERROR id, varname, init, value = isy_get_var_id(inst.name) 2017-03-27 00:08:00,500 ERROR TypeError 2017-03-27 00:08:00,502 ERROR : 2017-03-27 00:08:00,503 ERROR 'NoneType' object is not iterable 2017-03-27 00:08:04,022 INFO ==================================STARTED================================== 2017-03-27 00:08:04,945 INFO Garage Door is Opening. Last changed at Mon 27 Mar 2017 00:07:55 2017-03-27 00:08:05,014 ERROR Caught Exception in isy_get_var_id: ('Connection aborted.', gaierror(-2, 'Name or service not known')) 2017-03-27 00:08:05,016 ERROR Traceback (most recent call last): 2017-03-27 00:08:05,018 ERROR File "./myq-garage.py", line 407, in <module> 2017-03-27 00:08:05,021 ERROR gdoor_main() 2017-03-27 00:08:05,023 ERROR File "./myq-garage.py", line 380, in gdoor_main 2017-03-27 00:08:05,025 ERROR id, varname, init, value = isy_get_var_id(inst.name) 2017-03-27 00:08:05,027 ERROR TypeError 2017-03-27 00:08:05,028 ERROR : 2017-03-27 00:08:05,030 ERROR 'NoneType' object is not iterable 2017-03-27 00:08:07,852 INFO ==================================STARTED================================== 2017-03-27 00:08:08,803 INFO Garage Door is Opening. Last changed at Mon 27 Mar 2017 00:07:55 2017-03-27 00:08:08,869 ERROR Caught Exception in isy_get_var_id: ('Connection aborted.', gaierror(-2, 'Name or service not known')) 2017-03-27 00:08:08,871 ERROR Traceback (most recent call last): 2017-03-27 00:08:08,873 ERROR File "./myq-garage.py", line 407, in <module> 2017-03-27 00:08:08,875 ERROR gdoor_main() 2017-03-27 00:08:08,877 ERROR File "./myq-garage.py", line 380, in gdoor_main 2017-03-27 00:08:08,880 ERROR id, varname, init, value = isy_get_var_id(inst.name) 2017-03-27 00:08:08,881 ERROR TypeError 2017-03-27 00:08:08,883 ERROR : 2017-03-27 00:08:08,884 ERROR 'NoneType' object is not iterable 2017-03-27 00:08:11,034 INFO ==================================STARTED================================== 2017-03-27 00:08:12,023 INFO Garage Door is Open. Last changed at Mon 27 Mar 2017 00:08:09 2017-03-27 00:08:12,092 ERROR Caught Exception in isy_get_var_id: ('Connection aborted.', gaierror(-2, 'Name or service not known')) 2017-03-27 00:08:12,095 ERROR Traceback (most recent call last): 2017-03-27 00:08:12,096 ERROR File "./myq-garage.py", line 407, in <module> 2017-03-27 00:08:12,099 ERROR gdoor_main() 2017-03-27 00:08:12,101 ERROR File "./myq-garage.py", line 380, in gdoor_main 2017-03-27 00:08:12,103 ERROR id, varname, init, value = isy_get_var_id(inst.name) 2017-03-27 00:08:12,105 ERROR TypeError 2017-03-27 00:08:12,106 ERROR : 2017-03-27 00:08:12,108 ERROR 'NoneType' object is not iterable 2017-03-27 00:08:15,108 INFO ==================================STARTED================================== 2017-03-27 00:08:16,053 INFO Garage Door is Open. Last changed at Mon 27 Mar 2017 00:08:09 2017-03-27 00:08:16,130 ERROR Caught Exception in isy_get_var_id: ('Connection aborted.', gaierror(-2, 'Name or service not known')) 2017-03-27 00:08:16,132 ERROR Traceback (most recent call last): 2017-03-27 00:08:16,134 ERROR File "./myq-garage.py", line 407, in <module> 2017-03-27 00:08:16,136 ERROR gdoor_main() 2017-03-27 00:08:16,138 ERROR File "./myq-garage.py", line 380, in gdoor_main 2017-03-27 00:08:16,141 ERROR id, varname, init, value = isy_get_var_id(inst.name) 2017-03-27 00:08:16,143 ERROR TypeError 2017-03-27 00:08:16,144 ERROR : 2017-03-27 00:08:16,146 ERROR 'NoneType' object is not iterable 2017-03-27 10:32:39,220 INFO ==================================STARTED================================== 2017-03-27 10:32:47,251 INFO ==================================STARTED================================== 2017-03-27 10:32:51,102 INFO ==================================STARTED================================== 2017-03-27 10:33:21,730 INFO ==================================STARTED================================== 2017-03-27 10:41:55,218 INFO ==================================STARTED================================== 2017-03-27 10:43:12,552 INFO ==================================STARTED================================== 2017-03-27 10:43:14,650 INFO Garage Door is Open. Last changed at Mon 27 Mar 2017 00:08:09 2017-03-27 10:43:15,098 ERROR Caught Exception in isy_get_var_id: ('Connection aborted.', gaierror(-2, 'Name or service not known')) 2017-03-27 10:43:15,101 ERROR Traceback (most recent call last): 2017-03-27 10:43:15,103 ERROR File "./myq-garage.py", line 407, in <module> 2017-03-27 10:43:15,106 ERROR gdoor_main() 2017-03-27 10:43:15,108 ERROR File "./myq-garage.py", line 380, in gdoor_main 2017-03-27 10:43:15,110 ERROR id, varname, init, value = isy_get_var_id(inst.name) 2017-03-27 10:43:15,112 ERROR TypeError 2017-03-27 10:43:15,114 ERROR : 2017-03-27 10:43:15,116 ERROR 'NoneType' object is not iterable 2017-03-27 10:49:25,594 INFO ==================================STARTED================================== 2017-03-27 10:49:26,651 INFO Garage Door is Closed. Last changed at Mon 27 Mar 2017 10:43:50 2017-03-27 10:49:26,721 ERROR Caught Exception in isy_get_var_id: ('Connection aborted.', gaierror(-2, 'Name or service not known')) 2017-03-27 10:49:26,723 ERROR Traceback (most recent call last): 2017-03-27 10:49:26,725 ERROR File "./myq-garage.py", line 407, in <module> 2017-03-27 10:49:26,727 ERROR gdoor_main() 2017-03-27 10:49:26,729 ERROR File "./myq-garage.py", line 380, in gdoor_main 2017-03-27 10:49:26,731 ERROR id, varname, init, value = isy_get_var_id(inst.name) 2017-03-27 10:49:26,733 ERROR TypeError 2017-03-27 10:49:26,734 ERROR : 2017-03-27 10:49:26,736 ERROR 'NoneType' object is not iterable 2017-03-27 12:29:54,301 INFO ==================================STARTED================================== 2017-03-27 13:00:53,882 INFO ==================================STARTED================================== 2017-03-27 13:01:06,165 INFO ==================================STARTED================================== 2017-03-27 13:01:07,272 INFO Garage Door is Closed. Last changed at Mon 27 Mar 2017 11:20:00 2017-03-27 13:01:07,427 ERROR Caught Exception in isy_get_var_id: ('Connection aborted.', gaierror(-2, 'Name or service not known')) 2017-03-27 13:01:07,430 ERROR Traceback (most recent call last): 2017-03-27 13:01:07,431 ERROR File "./myq-garage.py", line 407, in <module> 2017-03-27 13:01:07,434 ERROR gdoor_main() 2017-03-27 13:01:07,435 ERROR File "./myq-garage.py", line 380, in gdoor_main 2017-03-27 13:01:07,438 ERROR id, varname, init, value = isy_get_var_id(inst.name) 2017-03-27 13:01:07,440 ERROR TypeError 2017-03-27 13:01:07,441 ERROR : 2017-03-27 13:01:07,443 ERROR 'NoneType' object is not iterable
×
×
  • Create New...