jbnunn / Alexa-MyQGarage

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

Can't get this to work. #19

Closed rshames closed 7 years ago

rshames commented 7 years ago

I think I have followed the instructions to the letter but can't get it to work. Every time I try to give Alexa a command I get "There is a problem with the requested skills response"

I don't know where to look. Any assistance would be appreciated.

jbnunn commented 7 years ago

@rshames That's usually a problem with the Lambda function. To debug that, go to Lambda, open your code, and click on the Monitoring tab. Click "View Logs In Cloudwatch" and click one of the entries. There, you'll likely see an error. Let me know if you see anything.

rshames commented 7 years ago

Thanks,

The error is below

Syntax error in module 'main': Non-ASCII character '\xe2' in file /var/task/main.py on line 15, but no encoding declared; see http://python.org/dev/peps/pep-0263/ for details (main.py, line 15)

But line 15 is the myQ username.

USERNAME = “rob%40shamesnet.com”

jbnunn commented 7 years ago

Try replacing the "%40" with "@"

rshames commented 7 years ago

I tried that with no luck. But Interestingly , I retyped the quotes around the username and got a different error.

No JSON object could be decoded: ValueError Traceback (most recent call last): File "/var/task/main.py", line 32, in lambda_handler login() File "/var/task/main.py", line 95, in login response = requests.get(login_uri()).json() File "/var/task/requests/models.py", line 808, in json return complexjson.loads(self.text, **kwargs) File "/usr/lib64/python2.7/json/init.py", line 339, in loads return _default_decoder.decode(s) File "/usr/lib64/python2.7/json/decoder.py", line 364, in decode obj, end = self.raw_decode(s, idx=_w(s, 0).end()) File "/usr/lib64/python2.7/json/decoder.py", line 382, in raw_decode raise ValueError("No JSON object could be decoded") ValueError: No JSON object could be decoded

jbnunn commented 7 years ago

Looks like a problem in your login endpoint, can you add something at line 95? Instead of this:

def login():
    response = requests.get(login_uri()).json()

make it say this:

def login():
    print("Login URL: " + login_uri())
    response = requests.get(login_uri()).json()

That will print the login URL. Careful when posting the error logs for this one, that line you add will print your password. Don't share the password here but share that Login URL with the password removed or change to something harmless.

rshames commented 7 years ago

this is the response in the log. (I replaced the password with ****, thanks for the warning)

Login URL: https://myqexternal.myqdevice.com/Membership/ValidateUserWithCulture?appId=Vj8pQggXLhLy0WHahglCD4N1nAkkXQtGYpq2HrHD7H1nvmbT55KqtN6RSF4ILB%2Fi&securityToken=null&username=rob%40shamesnet.com&password=********&culture=en

jbnunn commented 7 years ago

Weird, I'm getting the same error now too. Wondering if Chamberlain changed something. Digging in now, thanks for the catch. I'll update this when I know more.

rshames commented 7 years ago

Thank you so much!!

jbnunn commented 7 years ago

There's an issue on the MyQ side -- all requests are getting denied :( Do you have the Chamberlain app on your phone? Mine quit working a few days ago, wondering now if that's related to this issue as well.

rshames commented 7 years ago

My Chamberlain mobile app is still working.

jbnunn commented 7 years ago

Ok thanks. I'll keep this open and will try to track down the new API url.

rshames commented 7 years ago

Ok, Let me know if you would like me to test anything.

jbnunn commented 7 years ago

@tigerbrain Does the code still work for you?

arraylabs commented 7 years ago

@jbnunn Hello, not using this project but another that reaches the endpoints the same way and I am seeing the same error and getting the same request denied message. Just an FYI.

arraylabs commented 7 years ago

The gateway is reaching out to 206.229.155.179 port 8883 and wireshark shows a protocol of mqtt, is the mqtt part new or has it always been that?

tigerbrain commented 7 years ago

Hi @jbnunn, No this code has stopped working for me as well. I have a feeling Chamberlain did something to stop it from working or the APP_ID has changed which is so sad since I just finished modifying your code so that it can support opening and closing two doors without having the need to modify main.py. This just happened this morning as yesterday I had @steve772 test out the modified code and it was working properly for him. The other thing is that the server might just be down but if that was the case, their app itself should not work as well.

jbnunn commented 7 years ago

Thanks @tigerbrain, sorry. Your hard work isn't lost, we'll figure something out.

@arraylabs the MQTT part is new, it's only been using an HTTP GET until now. That's a good sign though, it might show Chamberlain is making some updates and will release something official. What does wireshark show when the official mobile app makes a call back to chamberlain? anything we can learn from that?

arraylabs commented 7 years ago

@jbnunn the mqtt is from the capture between the gateway device and the myq servers. I just looked at the capture from my iphone while moving the door and see it going to the resolved ip for myqexternal.myqdevice.com. Mostly all https so not sure thats going to be much help, i'm new to wireshark so guessing without ssl keys not much going to happen there.

arraylabs commented 7 years ago

@jbnunn I'm talking again with the API like this: https://myqexternal.myqdevice.com/api/user/validatewithculture?appId=Vj8pQggXLhLy0WHahglCD4N1nAkkXQtGYpq2HrHD7H1nvmbT55KqtN6RSF4ILB%2Fi&username=email@email.com&password=supersecret&culture=en

channingcorn commented 7 years ago

Looks like they changed the Device_List_Endpoint to all lower case. I made the following two changes and I can get the status of my garage:

LOGIN_ENDPOINT = "api/user/validatewithculture" DEVICE_LIST_ENDPOINT = "api/userdevicedetails"

Updating those two fixed it. Opening and Closing are working...

tigerbrain commented 7 years ago

@channingcorn Thanks for figuring this out. I will give this a try after I get home.

jbnunn commented 7 years ago

Works! Thanks @channingcorn and @arraylabs. How'd you find this out? I'd like to learn how for the next time this happens.

channingcorn commented 7 years ago

@arraylabs did most of the work. I noticed the URL he posted was lowercase, so once I got past login with his supplied URL, I saw that "device_list_uri" was failing so I tried changing it to all lowercase.

Dumb luck, but it worked. I'm sure sniffing with Wireshark might have worked, but I tried the simple approach first.

SConaway commented 7 years ago

FYI just uploaded the most recent code to Lambda and it works. :-)

arraylabs commented 7 years ago

@jbnunn @channingcorn glad to help! Honestly I just stumbled across another python project that was using different endpoints and starting poking at them with Postman till I got a response.

tigerbrain commented 7 years ago

Nice work everyone. Thanks for sharing your discoveries and keeping this luxury alive. It is really such a shame that we could not get MyQ to just support this work. It benefits them in the end rather than losing their sales to another competitor that supports Amazon Echo.

bhusang commented 7 years ago

Agreed on the nice work to debug this issue. My garage door started working again after changing LOGIN_ENDPOINT to "api/user/validatewithculture" and DEVICE_LIST_ENDPOINT = "api/userdevicedetails".

It's odd that DEVICE_SET_ENDPOINT = "Device/setDeviceAttribute" and DEVICE_STATUS_ENDPOINT = "Device/getDeviceAttribute" don't need to be changed. I just tested the device status endpoint and it reported the door state correctly.

r34220 commented 7 years ago

Anyone having issues again?

arraylabs commented 7 years ago

Yes, they changed again sometime yesterday. I tracked down the valid ones and updated my project earlier today. @jbnunn you can pull them from:

https://github.com/arraylabs/myq

r34220 commented 7 years ago

@arraylabs is that repo private?

arraylabs commented 7 years ago

@r34220 no, i just initially linked it wrong.

FlyingDiver commented 7 years ago

Are people testing the set_state() functionality? The equivalent in my code (Indigo HA plugin) keeps returning a response of

{"ReturnCode":"217","ErrorMessage":"Error processing request (217)","CorrelationId":"dba949ea-986d-4975-b063-3705316f24e8"}

I swear my code is including the exact same parameters, etc, as @arraylabs' code.

arraylabs commented 7 years ago

@FlyingDiver Mine was tested earlier today. Looks like you are sending alot of extra params and not sure about the post data, my params are different as well as my header items.

FlyingDiver commented 7 years ago

Are you looking at my GitHub repository? My current code is not uploaded yet. Is there a way to get requests to spit back all the info that went into the request, so I can compare the actual calls?

FlyingDiver commented 7 years ago

OK, latest commit has my current code. https://github.com/FlyingDiver/Indigo-MyQ/commit/7d1b89f8b9db55c9df7d51777ffbbc95f02b9405

Still getting the 217 error whenever I try to execute my changeDevice function ("DeviceAttribute/PutDeviceAttribute" call). Authentication works fine, as does the "userdevicedetails/get" call.

Any help you can give figuring this out would be appreciated.

arraylabs commented 7 years ago

@FlyingDiver did you try with params=payload instead of json=payload? I'm only posting json on the authenticate, others are get or put.

FlyingDiver commented 7 years ago

It's actually data=payload now, which matches what you have.

jbnunn commented 7 years ago

Ok all, I updated the code based on @arraylabs findings. Working again -- please let me know if it is for you as well.