jbnunn / Alexa-MyQGarage

Use your Echo to control your Chamberlain MyQ Garage door
71 stars 60 forks source link

Multiple garage doors #8

Closed brianwarehime closed 7 years ago

brianwarehime commented 7 years ago

Is there any way that this can support multiple doors? I'd be happy with it opening/closing both at the same time, but, ideally I can say "Close left garage door, open right garage door"

steve772 commented 7 years ago

I would like to do this as well. Right now when I use the skill, only one door responds. I would ideally like to differentiate but even if they both did the same thing that would be good.

CelticWebSolutions commented 7 years ago

Could you not just create multiple instances of the skill? Give them each a different invocation name so that it relates to the other garage door? I've done it with other skills

shildebrand commented 7 years ago

@CelticWebSolutions - I think that would work, but the main.py code would need to be modified for each instance of the skill to pull a different MyQ DeviceID.

Right now it looks like the code locks into the first Garage Door Opener it finds in the MyQ device list and executes all the commands against that device (lines 117-125)

shildebrand commented 7 years ago

To update this, the workaround of modifying the for loop did work.

I setup a second skill and changed the for loop code in that skill to break after it found the second of the garage door openers in the collection instead of the first.

Each skill has a unique name, so they are invoked separately.

steve772 commented 7 years ago

@shildebrand any chance you could add the main.py to the repository that discovers the second door as opposed to the first?

shildebrand commented 7 years ago

@steve772 - I will try to commit a new main.py that makes which garage door to open a configuration item like the myQ username & password.

steve772 commented 7 years ago

Awesome thanks!

steve772 commented 7 years ago

@shildebrand I am going to see if I can try this myself but was wondering if you might have a chance to add your updated files for the second skill? Thanks!

tigerbrain commented 7 years ago

Great news! I had some luck modifying jbnunn's core code and have tested it for my own door which seems to work properly. However, since my unit is currently only connected to one opener, I cannot fully test and verify that it indeed does work for more than one door even though I have already altered the code to support it. Would someone in this forum be willing to give this a try and share your experience?

Here is the link to the zip file that contains everything that you need to get this setup. https://app.box.com/s/lkbrwlawjf80dm34rrxnmseg5lz531fv

Once you have already downloaded the file on to your computer, extract the entire contents on to a folder and open the file named "instructions.txt". This text document will guide you through the entire process of creating your own Alexa Skill Kit and Lambda function.

Good Luck! I am excited to hear about the results of this experiment as I think it will be beneficial to a lot of people in this community. And yes, I guess I just like to help when I can. :)

tigerbrain

steve772 commented 7 years ago

I will give it a shot when I have a chance. Probably tomorrow evening. Thanks so much!!

On Jan 31, 2017, at 5:00 PM, tigerbrain notifications@github.com wrote:

Great news! I had some luck modifying jbnunn's core code and have tested it for my own door which seems to work properly. However, since my unit is currently only connected to one opener, I cannot fully test and verify that it indeed does work for more than one door even though I have already altered the code to support it. Would someone in this forum be willing to give this a try and share your experience?

Here is the link to the zip file that contains everything that you need to get this setup. https://app.box.com/s/lkbrwlawjf80dm34rrxnmseg5lz531fv

Once you have already downloaded the file on to your computer, extract the entire contents on to a folder and open the file named "instructions.txt". This text document will guide you through the entire process of creating your own Alexa Skill Kit and Lambda function.

Good Luck! I am excited to hear about the results of this experiment as I think it will be beneficial to a lot of people in this community. And yes, I guess I just like to help when I can. :)

tigerbrain

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.

tigerbrain commented 7 years ago

Great! Thanks for volunteering to test this out Steve. I think you will love this version as well because I have taken out the need to modify main.py by leveraging the environment variable feature of the Lambda function. So with this version, all you have to do is upload the lambda-upload.zip file that I have provided and perform the environment variable setup step mentioned in the instructions.txt file and voila! Good Luck!

steve772 commented 7 years ago

@tigerbrain I tested this out...after creating everything I tested it in the service simulator and get the following error:

The remote endpoint could not be called, or the response it returned was invalid.

Any thoughts?

steve772 commented 7 years ago

@tigerbrain ok I fixed the end point error (I forgot to change the name of the handler). Now, garage door 1 works fine. All commands seem to work.

Garage door 2 gives an error:

"There was a problem with the selected skills response."

In the lambda log, the only error I am seeing is this:

02:39:14 'value': KeyError Traceback (most recent call last): File "/var/task/main.py", line 42, in lambda_handler speechlet = onIntent(event['request'], event['session']) File "/var/task/main.py", line 163, in onIntent return moveIntent(intent) File "/var/task/main.py", line 203, in moveIntent doornum = intent['slots']['doornum']['value'] KeyError: 'value'

'value': KeyError Traceback (most recent call last): File "/var/task/main.py", line 42, in lambda_handler speechlet = onIntent(event['request'], event['session']) File "/var/task/main.py", line 163, in onIntent return moveIntent(intent) File "/var/task/main.py", line 203, in moveIntent doornum = intent['slots']['doornum']['value'] KeyError: 'value'

tigerbrain commented 7 years ago

@steve772 Sorry that this failed for you. I was almost sure that it would work. Anyway, before I proceed with troubleshooting this issue, I may need to first understand your setup better. Are you using a single MyQ device to operate two garage openers? Or do you have two MyQ devices, each trying to operate a single garage door? When you launch your MyQ app and you access the Manage Places menu, how many MyQ places do you have listed? If you click on your listed places, would you mind giving me a brief run down of the devices listed in each place like the sample shown below?

Example:
Place: Home (Two devices under the same unique MyQ serial number) Devices: MyQ 1 MyQ 2

Another thing that I wanted to verify and confirm is that you are accessing all of your MyQ openers with just a single username and password, correct?

Thanks!

steve772 commented 7 years ago

@tigerbrain I have a single MyQ device with two sensors paired to it; one on each Garage Door. I have one place listed in the MyQ Manage Places menu.

Place: Garage Doors Devices: Steve's Garage Door, Julie's Garage Door (both listed under the same unique serial number for place Garage Door).

I am using a single sign-on.

tigerbrain commented 7 years ago

@steve772 Ok Steve, your scenario is exactly what I was trying to support. So now I am at a lost as to what is going on and why it is not working. I already re-reviewed the code last night and still feel like it should work. The other challenge I face is that I don't know the Lambda function enough to know where any python messages I put in the code would print out which you seem to know something about as you were able to provide me some kind of an error log last night. Would you mind giving me some directions or instructions as to how you were able to pull out the log that you provided?

Thanks!

steve772 commented 7 years ago

Actually in the Lambda console, there is a link for cloudwatch.  The logs for the lambda results are kept there.  To get there open the Lambda function, select the monitoring tab and on the right side is a link to view logs in CloudWatch.

From: tigerbrain notifications@github.com Reply-To: jbnunn/Alexa-MyQGarage reply@reply.github.com Date: Wednesday, February 1, 2017 at 12:53 PM To: jbnunn/Alexa-MyQGarage Alexa-MyQGarage@noreply.github.com Cc: steve772 steve772@rochester.rr.com, Mention mention@noreply.github.com Subject: Re: [jbnunn/Alexa-MyQGarage] Multiple garage doors (#8)

@steve772 Ok Steve, your scenario is exactly what I was trying to support. So now I am at a lost as to what is going on and why it is not working. I already re-reviewed the code last night and still feel like it should work. The other challenge I face is that I don't know the Lambda function enough to know where any python messages I put in the code would print out which you seem to know something about as you were able to provide me some kind of an error log last night. Would you mind giving me some directions or instructions as to how you were able to pull out the log that you provided?

Thanks!

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.

tigerbrain commented 7 years ago

@steve772 ok Steve, thanks for sharing this tip. Now I know where the messages go. I will make some code modifications to print more messages that I can use to debug the problem better. The next lambda-upload.zip file that I will be providing you will contain the messages to print but it won't solve the problem. It is just there to help me understand what is going on. I may not be able to furnish you the file until later tonight though, so you may have to wait till tomorrow to try it out.

Thanks!

steve772 commented 7 years ago

Sounds good. Feel free to send them directly to me if you prefer. Steve772@rochester.rr.com

Sent from my iPhone

On Feb 1, 2017, at 5:43 PM, tigerbrain notifications@github.com wrote:

@steve772 ok Steve, thanks for sharing this tip. Now I know where the messages go. I will make some code modifications to print more messages that I can use to debug the problem better. The next lambda-upload.zip file that I will be providing you will contain the messages to print but it won't solve the problem. It is just there to help me understand what is going on. I may not be able to furnish you the file until later tonight though, so you may have to wait till tomorrow to try it out.

Thanks!

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.

tigerbrain commented 7 years ago

@steve772 Hi Steve, sorry no file tonight, but thanks to your tip for viewing the logs, I was already able to figure out the problem. I just couldn't send you a file yet because there is still one final challenge that I have to face with Alexa. I think I already have the solution but I still need to give it a try first. Hopefully, by tomorrow night, the problem is solved.

shildebrand commented 7 years ago

@steve772 sorry I was never able to get my fix into GitHub, but it sounds like @tigerbrain might have a more elegant solution. If it turns out you want my version instead, let me know and I'll upload it somewhere other than Git.

Cheers.

steve772 commented 7 years ago

@shildebrand thanks! Actually we are still working through the new way with @tigerbrain. Hopefully he is able to figure it out. Would you mind posting yours as well (elsewhere as you stated)? At a minimum I'm trying to learn the programming language so I'd love to see what you did. Thanks!

tigerbrain commented 7 years ago

@steve772 Great News! I have already completed the updates to the code and have tested it in my home and everything seems to be working as far as I can tell. I have no way to confirm that garage door 2 would actually open or close but I have found a way to make Alexa accept the command and it appears to be working.

Please follow the instructions provided very carefully and do not skip any steps as some of the steps have been modified to support a more enhanced feature set including the capability to turn on a feature that prevents Alexa from opening doors for security reasons.

Here is the link to the updated code: https://app.box.com/s/nfcht5ne9z9wh11vbjvlt61o7jmlmvx4 and I truly hope that this code set will work for you this time.

Enjoy!

tigerbrain

steve772 commented 7 years ago

Works like a charm!!  This is awesome!!  Thank you so much!!

From: tigerbrain notifications@github.com Reply-To: jbnunn/Alexa-MyQGarage reply@reply.github.com Date: Friday, February 3, 2017 at 3:25 AM To: jbnunn/Alexa-MyQGarage Alexa-MyQGarage@noreply.github.com Cc: steve772 steve772@rochester.rr.com, Mention mention@noreply.github.com Subject: Re: [jbnunn/Alexa-MyQGarage] Multiple garage doors (#8)

@steve772 Great News! I have already completed the updates to the code and have tested it in my home and everything seems to be working as far as I can tell. I have no way to confirm that garage door 2 would actually open or close but I have found a way to make Alexa accept the command and it appears to be working.

Please follow the instructions provided very carefully and do not skip any steps as some of the steps have been modified to support a more enhanced feature set including the capability to turn on a feature that prevents Alexa from opening doors for security reasons.

Here is the link to the updated code: https://app.box.com/s/nfcht5ne9z9wh11vbjvlt61o7jmlmvx4 and I truly hope that this code set will work for you this time.

Enjoy!

tigerbrain

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.

tigerbrain commented 7 years ago

You're welcome @steve772. Thanks for being the guinea pig and I am certainly please that I was able to help you out.

tigerbrain

tigerbrain commented 7 years ago

@steve772 something happened today that caused the code that I sent you yesterday to fail but the issue has already been resolved. I have since updated the affected file and uploaded it to a forked Git repository that I created yesterday. To fix the issue, all you have to do is retrieve the updated lambda-upload.zip file from https://github.com/tigerbrain/Alexa-MyQ-WithMultiDoorSupport and re-upload the file to your AWS Lambda Function code and you should be up and running again. Enjoy!

tigerbrain

steve772 commented 7 years ago

Thanks for the update!

Sent from my iPad

On Feb 5, 2017, at 3:52 AM, tigerbrain notifications@github.com wrote:

@steve772 something happened today that caused the code that I sent you yesterday to fail but the issue has already been resolved. I have since updated the affected file and uploaded it to a forked Git repository that I created yesterday. To fix the issue, all you have to do is retrieve the updated lambda-upload.zip file from https://github.com/tigerbrain/Alexa-MyQ-WithMultiDoorSupport and re-upload the file to your AWS Lambda Function code and you should be up and running again. Enjoy!

tigerbrain

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.

steve772 commented 7 years ago

@tigerbrain I saw that there were changes again this week. Will you be updating your lambda.zip file with the changes? Anything I can do to help? Thanks!

tigerbrain commented 7 years ago

Hi @steve772. Yes, I will be. I actually already started last night but was unable to finish in time.

steve772 commented 7 years ago

Thanks you are the best!!

From: tigerbrain notifications@github.com Reply-To: jbnunn/Alexa-MyQGarage reply@reply.github.com Date: Wednesday, February 15, 2017 at 9:24 AM To: jbnunn/Alexa-MyQGarage Alexa-MyQGarage@noreply.github.com Cc: steve772 steve772@rochester.rr.com, Mention mention@noreply.github.com Subject: Re: [jbnunn/Alexa-MyQGarage] Multiple garage doors (#8)

Hi @steve772. Yes, I will be. I actually already started last night but was unable to finish in time.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.

tigerbrain commented 7 years ago

Hi @steve772, Good news, I just completed the changes and tested it on my side. Everything seems to be working so I already uploaded the code to my repository. Let me know if the code works for you. Thanks!

tigerbrain

steve772 commented 7 years ago

Awesome thanks!

From: tigerbrain notifications@github.com Reply-To: jbnunn/Alexa-MyQGarage reply@reply.github.com Date: Wednesday, February 15, 2017 at 1:32 PM To: jbnunn/Alexa-MyQGarage Alexa-MyQGarage@noreply.github.com Cc: steve772 steve772@rochester.rr.com, Mention mention@noreply.github.com Subject: Re: [jbnunn/Alexa-MyQGarage] Multiple garage doors (#8)

Hi @steve772, Good news, I just completed the changes and tested it on my side. Everything seems to be working so I already uploaded the code to my repository. Let me know if the code works for you. Thanks!

tigerbrain

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.

tigerbrain commented 7 years ago

Hi @steve772, I forgot to mention that the only thing you need to do is upload the zip file and that should be it. Please let me know if the open and close feature is working cause I forgot to test that piece.

steve772 commented 7 years ago

I uploaded the lambda file already and will test when I get home.  Thanks again!

jbnunn commented 7 years ago

For multidoor, use @tigerbrain's repository: https://github.com/tigerbrain/Alexa-MyQ-WithMultiDoorSupport