jbnunn / Alexa-MyQGarage

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

Instructions current? #4

Closed mefree98 closed 7 years ago

mefree98 commented 8 years ago

Hi, I apologize up front as I'm not a dev, but I'm trying to follow your instructions on setting up an Alexa Skill. None of the items you posted in the instructions were available, I have a feeling Amazon has changed the UI/steps since you posted the instructions? I'm hoping that's the case since I can't seem to get even close to your instructions. If you have a minute would you mind checking and seeing if they have changed things?

jbnunn commented 8 years ago

Updated the README to reflect both changes to the UI, and general guidance to be more clear. See if that helps?

nabheet commented 8 years ago

I don't see the option for "Alexa Skills Kit" during step 5 while doing the Lambda Function setup->Configure Triggers.

For the "Configure Triggers" page, click in the dotted box to show the triggers options, and select "Alexa Skills Kit." Click next to continue.

Can you please suggest an alternate option?

nabheet commented 8 years ago

And now I copy/pasted the function ARN but ASK is giving me an error:

Error: Invalid ARN for NA region. Please provide a valid ARN in the form 'arn:aws:lambda:us-east-1:000000000000:function:myFunction:myFunctionVersion'

I think I am missing a value for myFunctionVersion but not sure ...

nabheet commented 8 years ago

I think the free ASK service is only available in US-EAST-1 region/datacenter. So I am going to give that a shot.

Select US East (N. Virginia) region (upper right)– this is the only region with Alexa/Lambda free tier service

nabheet commented 8 years ago

OMG! The Alexa Skills Kit option is available when I clicked on the dotted box. So your instructions are valid for the US EAST Region.

nabheet commented 8 years ago

So close ... I am getting this error while testing the lambda function:

{ "errorMessage": "Unable to import module 'lambda_function'" }

I even changed the filename for main.py to lambda_function.py and still getting the same error. :-(

nabheet commented 8 years ago

Resolved my issue with unable to import module 'lambda_function' - http://stackoverflow.com/a/38623471/892101.

I should not use finder to zip up the folder. Use this command in the Alexa-MyQGarage directory instead:

$ zip -rv Alexa-MyQGarage.zip lambda_function.py requests requests-2.9.1.dist-info

But I am now getting:

'UserId': KeyError
Traceback (most recent call last):
  File "/var/task/lambda_function.py", line 32, in lambda_handler
    login()
  File "/var/task/lambda_function.py", line 95, in login
    myq_userid = response["UserId"]
KeyError: 'UserId'

I think it might be because this line is failing:

response = requests.get(login_uri()).json()

I tried a GET against the URL https://myqexternal.myqdevice.com/Membership/ValidateUserWithCulture and got:

{
  "Message": "No HTTP resource was found that matches the request URI 'http://myqexternal.myqdevice.com/Membership/ValidateUserWithCulture'."
}

I realize this is not a supported app but I am so close ... hope you can provide some assistance.

nabheet commented 8 years ago

OMG!!! EUREKA!!!! I needed to url-encode my MyQ password ... because it is sent as a query string parameter in the GET login request ... wow! what an adventure 👍

{
  "version": "1.0",
  "response": {
    "outputSpeech": {
      "text": "No, your garage door is closed",
      "type": "PlainText"
    },
    "shouldEndSession": true,
    "reprompt": {
      "outputSpeech": {
        "text": "I didn't understand that. You can say ask the garage door if it's open",
        "type": "PlainText"
      }
    },
    "card": {
      "content": "MyQ - No, your garage door is closed",
      "type": "Simple",
      "title": "MyQ - No, your garage door is closed"
    }
  },
  "sessionAttributes": {}
}
blakedietz commented 7 years ago

I think the free ASK service is only available in US-EAST-1 region/datacenter. So I am going to give that a shot.

I thinks that this is the problem. changing from us-west-2 to us-east-1 made the skills integration available for the lambda function.

tigerbrain commented 7 years ago

Hi,

I just added a Step By Step Instruction document to the repository which I hope would help anyone who is struggling with the base instructions provided. Hope this helps you.

tigerbrain

skykep commented 7 years ago

What is the current URL for the authorization?
I'm using the format: http://myqexternal.myqdevice.com/Membership/ValidateUserWithCulture?appId=appId&securityToken=null&username=username&password=password&culture=culture and the appId I am using is NWknvuBd7LoFHfXmKNMBcgajXtZEgKUh4V7WNzMidrpUUluDpVYVZx+xT4PCM5Kx but I am constantly getting "Your request has been denied."

tigerbrain commented 7 years ago

Hi @mattkeperling, judging from the URL that you are using. It appears to me that you are still using the old outdated HTTP GET method. I advise you to download the latest code from the repository and edit the main.py file all over again as there have been significant changes to the code that is hard to point out.

SConaway commented 7 years ago

@mattkeperling I believe the appid has changed also. Good Luck!

skykep commented 7 years ago

@tigerbrain, I was using a php script that was current, but for testing I was trying to paste directly into a browser, which I learned is not going to work.

@SConaway, the appId I posted above is the current.

I was able to do some of this testing in a VB.net application with success (using the cURL equivalent with JSON encoding). I am actually trying to use this for my home automation (HomeSeer) setup which uses .NET. I was able to authenticate and grab status, so tomorrow I will work on the control function, which I believe is rather straightforward. I could have paid for a $30 plugin, but I prefer to figure these things out myself. ;)