[NO LONGER SUPPORTED] Ask Alexa

Well I did something wrong. When I ask alexa to tell smartthings to turn on a specific device she reports that there was an error with the askalexa smart app execution and to contact the author. Where do I start?
EDIT: I was able to successfully tell smartthings ton turn on and off two of my ten Hue lights. The only thing showing in the IDE log for askalexa is when I go into my phone smart app setup and it reports the setup page.
Thanks,
Nate

What did you change that might cause this? It sounds like the ST to Amazon integration got screwed up (either the ARN number from Lambda to the developer site or the Oauth and token from the App to the Lambda code). Have you checked that? To be clear, when you are telling Alexa to turn on the hue lights are you actually using the app (i.e. Alexa, tell smartthings…) or simply “Alexa, turn on/off…”…If it is the latter, that does NOT use my app, going back to the code issues I mentioned.

Let me know if that helps at all.

I am asking alexa to tell smartthings to turn on the device. In the alexa app it shows lambda errors ask aleax-smatthings integration so at least alexa knows that the integration exists. . One of the lamps I was able to control is not listed in smartthings which I thought was unusual. Also another lamp I was able to control through the integration did not always work and would return the error… I always receive the error when commanding the door lock.

Thanks,
Nate

First, I would ignore the native integration…it is NOT needed for my app and will just confuse the matter when explaining what works and what doesn’t.

Regarding my app, it sounds, again, like the Oauth and Token are not set correctly in the Lambda code…I am betting they changed in the SmartApp somehow. I would go through that installation section again to ensure the Lambda code looks ok.

Second, you can IGNORE the Lambda errors for my app…they will not give you proper information to troubleshoot this unless you dig deep into the logs. The best thing you can do is post screenshots and watch the SmartThings Live Logging to really determine what is happening.

Let me know if that helps.

Is the Aoath you are referring to STappID in Lambda? If so it is correct as well as the Token (STtoken) are the same as what is shown in the askalexa app. Would the url have anything to do with this? I copied what you had in the wiki but I think it should be different:
https://graph-na02-useast1.api.smartthings.com/api/smartapps/installations/
as apposed to:
https://graph.api.smartthings.com/api/smartapps/installations/

Thanks,
Nate

You must copy it from the Setup Variables in the Settings section of the app. The specific instructions are here: http://thingsthataresmart.wiki/index.php?title=Ask_Alexa#Finalizing_The_Function_Code

You must copy the data correctly to the Lambda code or your integration will not operate.

Correcting the URL did the trick.
Thanks,
Nate

1 Like

Alexa is cranky tonight. She called me a foolish human so I provoked her further. Finally she brought out the big guns and called me a Mother#$$%^&. I can’t figure out what HAL sees in her. Must be those huge sever racks.

1 Like

I’ve completed all of the steps in the wiki.
I’ve created a CoRE piston called “bed time” that changes mode to night, turns off some lights, etc.
I’ve created a Voice Macro in the Ask Alexa smartapp called “bed time” that executes the CoRE piston.

When I put in the utterance “bed time” in the developer console Service Simulator, it executes my macro, which executes my piston, which does all of the correct things.

However, if I actually say “Alexa, tell smartthings bed time”, Alexa doesn’t know what I’m asking. Am I using the wrong phrasing or is there some other integration step I missed?

Does any of the app work? For example, if you say “Alexa, Ask SmarThings Help” does it error out? If so, there is an account issue between your developer account and your device account.

Let me know if this is relevant to your issue.

Hmm, that voice command works for me. I can also do things like list reports, ask about switches, etc. It seems to just be an issue with getting her to run my voice macro.

Are you SURE it is running in the simulator? What are the commands you are giving it… Have you tried renaming it ‘bedtime’? I bet it is hearing it as one word.

I changed one of my voice macros from goodbye to just “gone”. Since doing that I’ve had less issues with it. Sometimes Alexa is picky about wordage.

That was it. I went back through my history and saw that she was recognizing it as “bedtime” instead of “bed time”, so once I renamed it and updated LIST_OF_MACROS it worked. Thank you so much! I’ll be sure to check her history from now on.

1 Like

Hi…I just tried to set this up but I’m getting the error

I re-pasted the raw code in the lambda are and upon choosing " save & test" I’m getting the error “Unexpected token < in JSON at position 2”

From the developer logs I am getting the response "There was an error with the Ask Alexa SmartApp execution. If this continues, please contact the author of the SmartApp. "

When following the wiki instructions on the developer site on the configuration page, I noticed that my screen looks different where you paste the Lambda ARN…

I don’t have a box to input the info except under the “pick geographical region…” section, so that was where I pasted the ARN…is that correct?

Any advice would greatly appreciated as I am a noob with coding and don’t know how to sort out the issue.

You can ignore the Amazon AWS logging and testing…Unless you know what you are looking for it will always get items that look like errors. It is better to test with the ST live logging and the developer site. However if that doesn’t show anything prepare to post some screenshots to determine where your issue is.

Thanks for the prompt reply @MichaelS.

One thing I noticed right now is that the OAuth ID on my ST IDE interface is different than the info on the html page that I used for setting up the developer site…could that be the issue?

I updated the ST user id and token on the Lambda code to match what the html page said, but I still get the same error statement from Alexa.

Can you please tell me what info I could provide and from where to help sort the issue?. Or, any specific step I should re-do to resolve? Thanks again and apologies for the noobness and incorrect terminology if there is any

The Oauth produced by the app via Settings->setup variables are the codes you need. If you did that did you also paste the ARN from the Lambda site to the developer site? Those are the most important pieces outside of the slot info.

Thanks @MichaelS, think I got a little further as I am no longer getting that same error after changing the Lambda code Oauth with the info provided by the app. Alexa is now responding but saying she can’t find the device or something of that sort.

Pasting the ARN code in the box under North America on the developer config page is correct, yes?

I think I have to go over the last steps with the developer site and re-do the custom slots, etc… sound logical to you?

Thanks again for taking the time out your day to lend a hand.

Update: Got it sorted out. After using the Oauth from the app instead and updating the custom slots, it seems to be working out. Thank you for your help! Appreciate this awesome app you created and all the info you put together to make it a reality here for me.

1 Like

Great. Glad it is working for you…Enjoy!

1 Like