SmartThings Community

AskHome - Alexa/SmartThings programmers kit. Alexa can do anything

Bingo!

Thank you so much for this. It was the last remaining piece to my new found love for SmartThings because of Alexa.

-SiP

3 Likes

Great Job!

3 Likes

By the way, it’s pretty easy to support multiple locations with AskHome. You just duplicate what you did the first time, and change the Ask word (Invocation name) to Cabin or Work or whatever on the copy. “ask cabin to shut off the water”

Your other locations can even be in the same smartthings location. …, add just the devices in the polebarn to the new copy of the SmartApp/Skill/Lambda combination and say things like “ask polebarn to turn off the lights”

And if your friends will give you a token & id to their smartThings AskHome app…your Alexa can control their stuff too. You can even use a different invocation name when you talk about their devices than what they use. (you’ll need their list of nouns too for the Alexa skill part) Great for helping out old parents by remote control. “Ask moms-house to water the lawn.” (you know, like when she’s on vacation with your brothers family and grand kids or something.)

1 Like

Very nice, well done!

2 Likes

@N8XD

I can’t seem to get the right appID or the Token.
I get an error when running the simulator to get them

this is the error i get.

grails.validation.ValidationException: Validation Error(s) occurred during save():

  • Field error in object ‘physicalgraph.device.Device’ on field ‘name’: rejected value [null]; codes [physicalgraph.device.Device.name.nullable.error.physicalgraph.device.Device.name,physicalgraph.device.Device.name.nullable.error.name,physicalgraph.device.Device.name.nullable.error.java.lang.String,physicalgraph.device.Device.name.nullable.error,device.name.nullable.error.physicalgraph.device.Device.name,device.name.nullable.error.name,device.name.nullable.error.java.lang.String,device.name.nullable.error,physicalgraph.device.Device.name.nullable.physicalgraph.device.Device.name,physicalgraph.device.Device.name.nullable.name,physicalgraph.device.Device.name.nullable.java.lang.String,physicalgraph.device.Device.name.nullable,device.name.nullable.physicalgraph.device.Device.name,device.name.nullable.name,device.name.nullable.java.lang.String,device.name.nullable,nullable.physicalgraph.device.Device.name,nullable.name,nullable.java.lang.String,nullable]; arguments [name,class physicalgraph.device.Device]; default message [{0} cannot be null]
1 Like

Don’t forget the Tap for portability, I have all three!

1 Like

Hi Bamarayne,

Looks like a lot of devices you don’t have assigned to the inputs. You have to fill in all the inputs in the simulator, and you don’t have those same devices as I do.:wink: Go get a copy of AskHome-Bare-1-device.groovy and use that code instead. I just uploaded it. It has all the inputs and switch structure for the nouns and ops removed…except for one light.

While in the SmartApp editor, make sure you’ve chosen App settings and have enabled Oauth. Then go to the simulator pick your location, choose a light and install. And get your token and ID (don’t uninstall!). Then over time add your inputs at the top for your own devices and switch/case structure to call the routines when they match. I’d do this one at a time, test it out with alexa. Look at the full code for examples of how the inputs and switch/case can be worked.

–Keith

2 Likes

Whippm,

Yea, it should work with Tap’s too. Alexa handles all that. Though I don’t have a Tap, there was nothing I needed to change to make this work with my dots. My dots are assigned to the same amazon account as my echo.

–Keith

I thought that was my problem, but it was around 2am. Thanks!

2 Likes

@N8XD

I have no idea what I’m doing wrong.

in Lambda when I save/test I keep getting this error below the box:
“errorMessage”: “Process exited before completing request”

when I test in the developer console I get this response:
“The app on smartthings did not return any message”

1 Like

What does the smartthings log say for your smartApp when you run the test? Does anything show up there?

the logs are blank???

1 Like

Ok…so you turned on logging…ran the test and nothing showed up. That’s ok.
In the lambda test…the lower left has that box with the process exiting…whats in the right lower box?

START RequestId: cd4b94df-112a-11e6-b83c-5fac0961332f Version: $LATEST
2016-05-03T12:30:21.226Z cd4b94df-112a-11e6-b83c-5fac0961332f TypeError: Cannot read property ‘intent’ of undefined
at exports.handler (/var/task/index.js:10:21)
END RequestId: cd4b94df-112a-11e6-b83c-5fac0961332f
REPORT RequestId: cd4b94df-112a-11e6-b83c-5fac0961332f Duration: 47.31 ms Billed Duration: 100 ms Memory Size: 128 MB Max Memory Used: 18 MB
Process exited before completing request

1 Like

What is the JSON code in your Lambda, Actions / Configure Test Event box

{
“key3”: “value3”,
“key2”: “value2”,
“key1”: “value1”
}

1 Like

Go back to the Alexa Developer console Test section, and type in something like “ask home to turn on the bedroom light” Below it, it will create a valid JSON test code for Lambda. Put that in the Lambda test window in place of the key1key2key3 stuff. And try the test again. And show me the code too. :wink:

{
“session”: {
“sessionId”: “SessionId.50262640-180f-46fc-9962-02041dcbf98a”,
“application”: {
“applicationId”: “amzn1.echo-sdk-ams.app.bd9bd9ab-2dc7-482e-ae35-356d46678eeb”
},
“user”: {
“userId”: “amzn1.ask.account.AFP3ZWPOS2BGJR7OWJZ3DHPKMOMNWY4AY66FUR7ILBWANIHQN73QHCD3E2XHPBMHHR2BQJB36X5U25SI67QDW6DHLRXOTODH6LDJ53FWM65PNSI2LUOI64CX5N7DPGQQ37R54IS6T4XU2WMS2VU5VG6S2X3B36DXE3CDOWTQXDTGPKY5FXHT7SNGIHPQQZLVYVPKJ5ENDZZHKUA”
},
“new”: true
},
“request”: {
“type”: “IntentRequest”,
“requestId”: “EdwRequestId.a71404fb-4ad4-4aad-bb29-e83242b5c156”,
“timestamp”: “2016-05-03T12:44:57Z”,
“intent”: {
“name”: “Home”,
“slots”: {
“Operator”: {
“name”: “Operator”,
“value”: “on”
},
“Operand”: {
“name”: “Operand”
},
“Inquisitor”: {
“name”: “Inquisitor”
},
“Noun”: {
“name”: “Noun”,
“value”: “vanity light”
}
}
},
“locale”: “en-US”
},
“version”: “1.0”
}

1 Like

That looks good now…what did Lambda say, in the lower left and right…what did the smartthings log say when you hit the test?

the log is still blank. I’m looking at the log located beneath the smartapp window.